private void CreateNetworksManager() { if (!StopRequest()) { return; } var network = new NetworksManager(CtlTabs, null, OnNetworkUIChanged); if (network.Config != null) { NetworksManager = network; CtlInputDataPresenter.LoadConfig(NetworksManager.Config, this); ReplaceNetworksManagerControl(NetworksManager); if (NetworksManager.IsValid()) { ApplyChangesToStandingNetworks(); } else { MessageBox.Show("Network parameter is not valid.", "Error"); } } }
private bool SaveConfig() { Config.Main.Set(Const.Param.ScreenWidth, ActualWidth); Config.Main.Set(Const.Param.ScreenHeight, ActualHeight); Config.Main.Set(Const.Param.ScreenTop, Top); Config.Main.Set(Const.Param.ScreenLeft, Left); Config.Main.Set(Const.Param.OnTop, Topmost); Config.Main.Set(Const.Param.DataWidth, DataWidth.ActualWidth); Config.Main.Set(Const.Param.NetworkHeight, NetworkHeight.ActualHeight); ConfigParams.ForEach(p => p.SaveConfig()); if (!SaveSettings()) { return(false); } if (NetworksManager != null) { CtlInputDataPresenter.SaveConfig(NetworksManager.Config); if (!NetworksManager.IsValid()) { MessageBox.Show("Network parameter is invalid", "Error"); return(false); } else { NetworksManager.SaveConfig(); } } Config.Main.FlushToDrive(); if (NetworksManager != null) { NetworksManager.Config.FlushToDrive(); } return(true); }
private bool SaveConfig() { if (!SaveSettings()) { return(false); } if (NetworksManager != null) { if (!NetworksManager.IsValid()) { MessageBox.Show("Network parameter is invalid", "Error"); return(false); } else { NetworksManager.SaveConfig(); } } return(true); }
private void LoadNetworksManager(string name) { if (!StopRequest()) { return; } if (String.IsNullOrEmpty(name)) { return; } if (!File.Exists(name)) { name = "\\Networks\\" + System.IO.Path.GetFileName(name); } if (File.Exists(name)) { NetworksManager = new NetworksManager(CtlTabs, name, OnNetworkUIChanged); Config.Main.Set(Const.Param.NetworksManagerName, name); CtlInputDataPresenter.LoadConfig(NetworksManager.Config, this); ReplaceNetworksManagerControl(NetworksManager); if (NetworksManager.IsValid()) { ApplyChangesToStandingNetworks(); } else { MessageBox.Show("Network parameter is not valid.", "Error"); } } else { MessageBox.Show($"Network '{name}' is not found!", "Error", MessageBoxButton.OK); Config.Main.Set(Const.Param.NetworksManagerName, string.Empty); } }