private void LoadProfile_OnClick(object sender, RoutedEventArgs e) { String selected = ""; selected = Config.CFG_PATH + "default"; profNameTextBox.Text = "default"; if (!String.IsNullOrEmpty(ConfigFilesCB.SelectionBoxItem.ToString())) { selected = Config.CFG_PATH + ConfigFilesCB.SelectionBoxItem; profNameTextBox.Text = ConfigFilesCB.SelectionBoxItem.ToString(); } if (!String.IsNullOrEmpty(selected)) { cfg = SaveNLoad.deSerialize(selected); Config.actionBT = cfg.actionBT; dcsTree.Clear(); for (int j = 0; j < cfg.dcsTree.Count; j++) { dcsTree.Add(cfg.dcsTree[j]); } } if (Config.actionBT.root != null) { NewImageBtn.Visibility = Visibility.Hidden; } }
public static void shutDownPc(Object source, ElapsedEventArgs e) { Console.Write("shutting down PC..."); Profile shutdownCfg = SaveNLoad.deSerialize(Config.CFG_PATH + "ShutDownPc"); shutdownCfg.actionBT.run(); Thread.Sleep(2000); shutdownCfg.actionBT.run(); E7Timer shutDown = new E7Timer(5000); shutDown.SetFunction(shutFct); shutDown.Start(); }
private void SaveProfile_OnClick(object sender, RoutedEventArgs e) { String filePath = Config.CFG_PATH + "default"; if (!String.IsNullOrEmpty(profNameTextBox.Text)) { filePath = Config.CFG_PATH + profNameTextBox.Text; } cfg.actionBT = Config.actionBT; cfg.dcsTree = dcsTree; SaveNLoad.serializeFile(filePath, cfg); Config.getCfg(ConfigFilesCB); }