Exemplo n.º 1
0
        private void startstopbutton_Click(object sender, EventArgs e)
        {
            if (_worker != null)
            {
                _worker.CancelAsync();
                ResetViewAfterExecution();
            }
            else
            {
                var config = ConfigTextConverter.TryTextToObject(configTextBox.Text);
                if (config == null)
                {
                    return;
                }

                RuntimeVariables.ActiveConfig = config;

                PrepareViewForExecution();
                _worker                     = new BackgroundWorker();
                _worker.DoWork             += WorkerOnDoWork;
                _worker.RunWorkerCompleted += WorkerOnRunWorkerCompleted;

                _worker.WorkerReportsProgress = true;
                _worker.ProgressChanged      += WorkerOnProgressChanged;

                _worker.RunWorkerAsync();
            }
        }
Exemplo n.º 2
0
        private void RefreshedActiveConfig()
        {
            configTextBox.Text = ConfigTextConverter.ObjectToText(RuntimeVariables.ActiveConfig);

            authortextbox.Text     = RuntimeVariables.ActiveConfig.Author;
            nametextbox.Text       = RuntimeVariables.ActiveConfig.Name;
            changedatetextbox.Text = RuntimeVariables.ActiveConfig.ChangeDate;
        }
Exemplo n.º 3
0
        private void saveconfigbutton_Click(object sender, EventArgs e)
        {
            var config = ConfigTextConverter.TryTextToObject(configTextBox.Text);

            if (config == null)
            {
                return;
            }

            RuntimeVariables.ActiveConfig = config;
            config.ChangeDate             = DateTime.Now.ToString("dd. MM. yyyy HH:mm");
            config.Author = authortextbox.Text;
            config.Name   = nametextbox.Text;

            configTextBox.Text = ConfigTextConverter.ObjectToText(config);

            File.WriteAllText(Path.Combine(FileHelper.GetConfigBasePath(), configSourceComboBox.SelectedItem.ToString()), configTextBox.Text);
        }
Exemplo n.º 4
0
        private void configSourceComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var cb = sender as ComboBox;

            if (cb == null)
            {
                return;
            }

            var file = cb.SelectedItem as string;

            if (file == null)
            {
                return;
            }

            var content = File.ReadAllText(Path.Combine(FileHelper.GetConfigBasePath(), file));

            RuntimeVariables.ActiveConfig = ConfigTextConverter.TextToObject(content);
            RefreshedActiveConfig();
        }