示例#1
0
        public void changePath()
        {
            string   newFolder = string.Empty;
            Settings newSt     = new Settings();

            newSt.CountRowOnMonitor = this.sets.CountRowOnMonitor;
            newSt.WorkFolder        = this.sets.WorkFolder;

            FolderBrowserDialog FBD = new FolderBrowserDialog();

            if (FBD.ShowDialog() == WForms.DialogResult.OK)
            {
                newFolder = FBD.SelectedPath.ToString();
                WForms.MessageBox.Show("Вы выбрали : " + newFolder);

                newSt.WorkFolder = newFolder;
                ResultSettings resultSaveWorkFolder = AppSetting.saveSetting(newSt);//AppSettings.setWorkFolder(newFolder);

                if (resultSaveWorkFolder.code == 0)
                {
                    WForms.MessageBox.Show("Сохранено");
                    //this.sets = resultSaveWorkFolder.settings;
                    this.sets.WorkFolder        = resultSaveWorkFolder.settings.WorkFolder;
                    this.sets.CountRowOnMonitor = resultSaveWorkFolder.settings.CountRowOnMonitor;
                    this.startWatch();

                    this.teest = newFolder;
                }
                else
                {
                    WForms.MessageBox.Show("Ошибка сохранения.\n" + resultSaveWorkFolder.info);
                }
            }
        }
示例#2
0
 public void ResultListenerInheritingFromIResultListener()
 {
     try
     {
         var resultListener = new InterfaceTestResultListenser();
         var setting        = new ResultSettings();
         setting.Add(resultListener);
     }
     catch (Exception ex)
     {
         Assert.Fail("Unit test for result listener inheriting from the IResultListener interface has trown an exception: " + ex.Message);
     }
 }
        public static ResultSettings saveSetting(Settings st)
        {
            ResultSettings result       = new ResultSettings();
            string         settingsJson = JsonConvert.SerializeObject(st);

            using (StreamWriter writer = new StreamWriter(Directory.GetCurrentDirectory() + "\\appsettings.json"))
            {
                writer.Write(settingsJson);
            }

            result.code     = 0;
            result.info     = "";
            result.settings = st;

            return(result);
        }