Skip to content

Commit

Permalink
Network manager & RED can be open at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfusedPolarBear committed Mar 4, 2019
1 parent c5a2f12 commit ac38b85
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Core</RootNamespace>
<AssemblyName>Core</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
Expand Down
2 changes: 2 additions & 0 deletions RED/Models/ControlCenterModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ internal class ControlCenterModel
internal XboxControllerInputViewModel _xboxController4;
internal FlightStickViewModel _flightStickController;
internal KeyboardInputViewModel _keyboardController;

internal bool _networkManagerEnabled;
}
}
8 changes: 6 additions & 2 deletions RED/RED.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RED</RootNamespace>
<AssemblyName>RED</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
Expand Down Expand Up @@ -462,6 +462,10 @@
<Project>{2b6222de-ac5c-419a-a97a-ff3608c20023}</Project>
<Name>Core</Name>
</ProjectReference>
<ProjectReference Include="..\RoverNetworkManager\RoverNetworkManager.csproj">
<Project>{dd54c007-0165-449c-b091-682670174c62}</Project>
<Name>RoverNetworkManager</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="ViewModels\Network\" />
Expand Down
23 changes: 20 additions & 3 deletions RED/ViewModels/ControlCenterViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ public class ControlCenterViewModel : Screen, ILogger
{
private readonly ControlCenterModel _model;

public SettingsManagerViewModel SettingsManager
public bool NetworkManagerEnabled {
get {
return _model._networkManagerEnabled;
}
set {
_model._networkManagerEnabled = value;
NotifyOfPropertyChange(() => NetworkManagerEnabled);
}
}

public SettingsManagerViewModel SettingsManager
{
get
{
Expand Down Expand Up @@ -379,7 +389,7 @@ public ControlCenterViewModel()
MetadataManager = new MetadataManager(Console, ConfigManager);

Rovecomm = Rovecomm.Instance;
ResubscribeAll();
//ResubscribeAll();

Science = new ScienceViewModel(Rovecomm, MetadataManager, Console);
GPS = new GPSViewModel(Rovecomm, MetadataManager);
Expand Down Expand Up @@ -414,6 +424,8 @@ public ControlCenterViewModel()
TelemetryLogTool = new TelemetryLogToolViewModel(MetadataManager);

SettingsManager = new SettingsManagerViewModel(ConfigManager, this);

NetworkManagerEnabled = true;
}

protected override void OnDeactivate(bool close)
Expand All @@ -426,7 +438,12 @@ protected override void OnDeactivate(bool close)
public void ResubscribeAll()
{
Rovecomm.SubscribeMyPCToAllDevices();
}
}

public void NetworkManager() {
new RoverNetworkManager.RNMBootstrapper().DisplayNetworkManager();
NetworkManagerEnabled = false;
}

public void Log(string message, params object[] args) {
Core.CommonLog.Instance.Log(message, args);
Expand Down
5 changes: 3 additions & 2 deletions RED/Views/ControlCenterView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Margin="5">
<Button DockPanel.Dock="Bottom" x:Name="ResubscribeAll">Resubscribe All</Button>
<controls:MetroTabControl TabStripMargin="0">
<Button DockPanel.Dock="Bottom" x:Name="NetworkManager" IsEnabled="{Binding NetworkManagerEnabled}" Content="Open Network Manager" Margin="0 0 0 5"/>
<controls:MetroTabControl TabStripMargin="0">
<TabItem Header="State" controls:ControlsHelper.HeaderFontSize="12">
<StackPanel>
<DockPanel>
Expand All @@ -105,7 +106,7 @@
<ContentControl x:Name="StopwatchTool" />
</TabItem>
</controls:MetroTabControl>
</DockPanel>
</DockPanel>
<ContentControl Grid.Row="1" Margin="5" x:Name="Console" />
<ContentControl Grid.Row="2" Margin="5" x:Name="InputManager"/>
</Grid>
Expand Down
8 changes: 4 additions & 4 deletions RED/app.config
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
6 changes: 3 additions & 3 deletions RoverNetworkManager/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
</configuration>
44 changes: 18 additions & 26 deletions RoverNetworkManager/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 9 additions & 13 deletions RoverNetworkManager/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions RoverNetworkManager/RNMBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor<MainWindowViewModel>();
}

public void DisplayNetworkManager() {
OnStartup(null, null);
}
}
}
1 change: 1 addition & 0 deletions RoverNetworkManager/RoverNetworkManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
7 changes: 6 additions & 1 deletion RoverNetworkManager/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
using Core.Network;
using RoverNetworkManager.Models;
using Core.Configurations;
using System;

namespace RoverNetworkManager.ViewModels
{
public class MainWindowViewModel : Screen
{
private readonly MainWindowModel _model;

public RoveCommCustomPacketViewModel RoveCommCustomPacket
public override void CanClose(Action<bool> callback) {
callback(false);
}

public RoveCommCustomPacketViewModel RoveCommCustomPacket
{
get
{
Expand Down

0 comments on commit ac38b85

Please sign in to comment.