Esempio n. 1
0
 private void SaveConfigs()
 {
     using (RegistryIo writer = new RegistryIo())
     {
         writer.WriteProject(projComboBox.Text);
         writer.WriteProjectPath(txtSourceCodePath.Text);
         writer.WriteConfig(new WebConfigData
         {
             DataSource     = txtSource.Text,
             InitialCatalog = txtInit.Text,
             BaseCatalog    = txtBase.Text
         });
     }
 }
Esempio n. 2
0
        private void ReadExcludedProjects()
        {
            using (RegistryIo registry = new RegistryIo())
            {
                this.excludedProjects = registry.GetExcludedProjects().ToList();

                StringBuilder excludedProj = new StringBuilder();
                foreach (var x in this.excludedProjects)
                {
                    excludedProj.Append(x + Environment.NewLine);
                }

                txtExcludedProj.Text = excludedProj.ToString();
            }
        }
Esempio n. 3
0
        private void SaveExcludedProjects()
        {
            if (String.IsNullOrEmpty(txtExcludedProj.Text))
            {
                return;
            }

            string[] projects = txtExcludedProj.Text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
            excludedProjects.Clear();
            excludedProjects.AddRange(projects);

            using (RegistryIo writer = new RegistryIo())
            {
                writer.WriteExcludedProjects(projects.Where(x => !string.IsNullOrEmpty(x)).ToArray());
            }
        }
Esempio n. 4
0
        private void InitializeBackgroundWorker()
        {
            worker.DoWork += (sender, eventHandler) =>
            {
                RegistryIo reader = new RegistryIo();
                var        result = new Dictionary <string, object>
                {
                    ["ProjectName"]   = reader.GetProject(),
                    ["ProjectPath"]   = reader.GetProjectPath(),
                    ["WebConfigList"] = reader.GetConfigsList()
                };
                eventHandler.Result = result;
            };

            worker.RunWorkerCompleted += (sender, eventHandler) =>
            {
                // if an exception not occurred during DoWork
                if (eventHandler.Error == null)
                {
                    ReadExcludedProjects();

                    var result = (Dictionary <string, object>)eventHandler.Result;

                    if (!String.IsNullOrEmpty(result["ProjectPath"]?.ToString()))
                    {
                        txtSourceCodePath.Text = result["ProjectPath"].ToString();
                        PopulateProjComboBoxData();

                        if (!String.IsNullOrEmpty(result["ProjectName"]?.ToString()) &&
                            !this.excludedProjects.Contains(result["ProjectName"]?.ToString()))
                        {
                            projComboBox.Text = result["ProjectName"].ToString();
                        }

                        mainTabCtrl.SelectTab(1);
                    }

                    webConfigList = (List <WebConfigData>)result["WebConfigList"];
                    FillDataSourceTextBox();
                }
            };
            worker.RunWorkerAsync();
        }