public EditPage(Config conf)
        {
            InitializeComponent();
            Config = conf;

            nameTextBox.Text = conf.name;
            commandTextBox.Text = conf.command;
            argumentsTextBox.Text = conf.arguments;
            autoStartCheckbox.IsChecked = conf.autoStart;
            hideWindowCheckbox.IsChecked = conf.hideWindow;
            baseDirectoryName = conf.baseDir;
            baseDirectoryLabel.Content = baseDirectoryName;
            watchBaseDirectoryCheckbox.IsChecked = conf.watchBaseDir;

        }
        public void UpdateItem(String uid, Config conf)
        {
            ProcessItem proc = Processes[uid];
            proc.Config = conf;
            if(proc.Config.autoStart == true && proc.Started)
            {
                proc.Stop();
                proc.Start();
            }
            else if (proc.Config.autoStart)
            {
                proc.Start();
            }

            OnUpdated();
        }
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            Config conf = new Config();

            conf.uid = Config.uid;
            conf.name = nameTextBox.Text;
            conf.command = commandTextBox.Text;
            conf.arguments = argumentsTextBox.Text;
            conf.hideWindow = (Boolean)hideWindowCheckbox.IsChecked;
            conf.autoStart = (Boolean)autoStartCheckbox.IsChecked;
            conf.baseDir = baseDirectoryName;
            conf.watchBaseDir = (Boolean)watchBaseDirectoryCheckbox.IsChecked;

            try
            {
                conf.Validate();
                MainWindow.Registrar.UpdateItem(Config.uid, conf);
                NavigationService.GoBack();
            }
            catch (ConfigValidationException ex)
            {
                HandleErrors(ex);
            }
        }
 public void EditItem(Config conf) {
     MainFrame.Content = new EditPage(conf);
 }
 /**
  * This file provides a simple means to preload the process config without
  * triggering a save
  */
 public void Queue(Config config)
 {
     Console.WriteLine(config.uid);
     Processes.Add(config.uid, new ProcessItem(config));
     OnQueued();
 }
        public ProcessItem(Config item)
        {
            Config = item;

            InitialConfig();
        }
        public void Update(Config item)
        {
            Config.name = item.name;
            Config.command = item.command;
            Config.arguments = item.arguments;
            Config.hideWindow = item.hideWindow;
            Config.autoStart = item.autoStart;

            Restart();
        }