private void frmPreferences_Shown(object sender, EventArgs e)
        {
            Prefs = PreferenceSet.Instance;

            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 1) + "CSS");
            StyleList.Items.Clear();
            foreach (System.IO.FileInfo fi in di.GetFiles())
            {
                StyleList.Items.Add(fi.Name.ToString().ToLower().Replace(".css", ""));
            }

            // Visual Style tab
            StyleList.SelectedItem = Prefs.CSSFileName.ToLower().Replace(".css", "");

            // Scheduled Tasks tab
            txtWebGenMinutes.Text       = Prefs.GenerateInterval.ToString();
            chkWebSiteGenerator.Checked = Prefs.GenerateWeb;
            chkAppStart.Checked         = Prefs.SyncOnLoad;
            chkScheduled.Checked        = Prefs.SyncOnSchedule;
            txtCollectMinutes.Text      = Prefs.SyncTimeMinutes.ToString();
            txtWebSiteBase.Text         = Prefs.WebRoot;

            // Web
            txtEOCUserID.Text       = Prefs.EOCUserID.ToString();
            txtStanfordUserID.Text  = Prefs.StanfordID;
            txtStanfordTeamID.Text  = Prefs.TeamID.ToString();
            chkUseProxy.Checked     = Prefs.UseProxy;
            chkUseProxyAuth.Checked = Prefs.UseProxyAuth;
            txtProxyServer.Text     = Prefs.ProxyServer;
            txtProxyPort.Text       = Prefs.ProxyPort.ToString();
            txtProxyUser.Text       = Prefs.ProxyUser;
            txtProxyPass.Text       = Prefs.ProxyPass;
        }
Example #2
0
 public Parameters(IWorker worker)
 {
     this.worker = worker;
     preferences = worker.Preferences;
     InitializeComponent();
     ViewRefresh();
     DialogResult = DialogResult.None;
 }
Example #3
0
        public void PreferenceSet_Set_String_Test()
        {
            var prefs = new PreferenceSet();

            prefs.Set(Preference.EmailReportingFromAddress, (string)null);
            prefs.Set(Preference.EmailReportingFromAddress, "*****@*****.**");
            prefs.Set(Preference.EmailReportingFromAddress, "*****@*****.**");
        }
Example #4
0
        public void PreferenceSet_Set_Collection_Test()
        {
            var prefs = new PreferenceSet();

            prefs.Set(Preference.FormColumns, (List <string>)null);
            prefs.Set(Preference.FormColumns, (IEnumerable <string>) new[] { "a", "b", "c" });
            prefs.Set(Preference.FormColumns, (ICollection <string>) new[] { "a", "b", "c" });
        }
Example #5
0
 public void DeletePreferenceSet(PreferenceSet preferenceSet)
 {
     if ((preferenceSet.EntityState == EntityState.Detached))
     {
         this.ObjectContext.PreferenceSets.Attach(preferenceSet);
     }
     this.ObjectContext.PreferenceSets.DeleteObject(preferenceSet);
 }
Example #6
0
        public void PreferenceSet_Set_ValueType_Test()
        {
            var prefs = new PreferenceSet();

            prefs.Set(Preference.FormSplitterLocation, (object)null);
            prefs.Set(Preference.FormSplitterLocation, "60");
            prefs.Set(Preference.FormSplitterLocation, 120);
            prefs.Set(Preference.FormSplitterLocation, 360);
        }
Example #7
0
        public void PreferenceSet_Set_Class_Test()
        {
            var prefs = new PreferenceSet();

            prefs.Set(Preference.ClientRetrievalTask, (ClientRetrievalTask)null);
            prefs.Set(Preference.ClientRetrievalTask, new ClientRetrievalTask());
            prefs.Set(Preference.ClientRetrievalTask, new ClientRetrievalTask {
                Enabled = false
            });
        }
Example #8
0
 public void InsertPreferenceSet(PreferenceSet preferenceSet)
 {
     if ((preferenceSet.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(preferenceSet, EntityState.Added);
     }
     else
     {
         this.ObjectContext.PreferenceSets.AddObject(preferenceSet);
     }
 }
Example #9
0
      public void PreferenceSet_Get_Benchmark_String_Test()
      {
         var prefs = new PreferenceSet();

         var sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000000; i++)
         {
            //Assert.AreEqual("logcache", prefs.Get<string>(Preference.CacheFolder));
            var obj = prefs.Get<string>(Preference.CacheFolder);
         }
         sw.Stop();
         Debug.WriteLine("Get String: {0}ms", sw.ElapsedMilliseconds);
      }
Example #10
0
      public void PreferenceSet_Get_Benchmark_ValueType_Test()
      {
         var prefs = new PreferenceSet();

         var sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000000; i++)
         {
            //Assert.AreEqual(360, prefs.Get<int>(Preference.FormSplitLocation));
            var obj = prefs.Get<int>(Preference.FormSplitterLocation);
         }
         sw.Stop();
         Debug.WriteLine("Get ValueType: {0}ms", sw.ElapsedMilliseconds);
      }
Example #11
0
      public void PreferenceSet_Get_Benchmark_Null_String_Test()
      {
         var prefs = new PreferenceSet();

         var sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000000; i++)
         {
            //Assert.AreEqual(String.Empty, prefs.Get<string>(Preference.EmailReportingFromAddress));
            var obj = prefs.Get<string>(Preference.EmailReportingFromAddress);
         }
         sw.Stop();
         Debug.WriteLine("Get Null String: {0}ms", sw.ElapsedMilliseconds);
      }
Example #12
0
        public void PreferenceSet_Get_Benchmark_String_Test()
        {
            var prefs = new PreferenceSet();

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //Assert.AreEqual("logcache", prefs.Get<string>(Preference.CacheFolder));
                var obj = prefs.Get <string>(Preference.CacheFolder);
            }
            sw.Stop();
            Debug.WriteLine("Get String: {0}ms", sw.ElapsedMilliseconds);
        }
Example #13
0
        public void PreferenceSet_Get_Benchmark_ValueType_Test()
        {
            var prefs = new PreferenceSet();

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //Assert.AreEqual(360, prefs.Get<int>(Preference.FormSplitLocation));
                var obj = prefs.Get <int>(Preference.FormSplitterLocation);
            }
            sw.Stop();
            Debug.WriteLine("Get ValueType: {0}ms", sw.ElapsedMilliseconds);
        }
Example #14
0
        public void PreferenceSet_Get_Benchmark_Collection_Test()
        {
            var prefs = new PreferenceSet();

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //Assert.IsNotNull(prefs.Get<IEnumerable<Color>>(Preference.GraphColors));
                var obj = prefs.Get <IEnumerable <Color> >(Preference.GraphColors);
            }
            sw.Stop();
            Debug.WriteLine("Get Collection: {0}ms", sw.ElapsedMilliseconds);
        }
Example #15
0
        public void PreferenceSet_Get_Benchmark_Null_Collection_Test()
        {
            var prefs = new PreferenceSet();

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //Assert.IsNull(prefs.Get<ICollection<string>>(Preference.FormColumns));
                var obj = prefs.Get <ICollection <string> >(Preference.FormColumns);
            }
            sw.Stop();
            Debug.WriteLine("Get Null Collection: {0}ms", sw.ElapsedMilliseconds);
        }
Example #16
0
        public void PreferenceSet_Get_Benchmark_Null_String_Test()
        {
            var prefs = new PreferenceSet();

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //Assert.AreEqual(String.Empty, prefs.Get<string>(Preference.EmailReportingFromAddress));
                var obj = prefs.Get <string>(Preference.EmailReportingFromAddress);
            }
            sw.Stop();
            Debug.WriteLine("Get Null String: {0}ms", sw.ElapsedMilliseconds);
        }
Example #17
0
      public void PreferenceSet_Get_Benchmark_Class_Test()
      {
         var prefs = new PreferenceSet();

         //object prev = null;
         var sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000000; i++)
         {
            var obj = prefs.Get<ClientRetrievalTask>(Preference.ClientRetrievalTask);
            //Assert.AreNotSame(prev, obj);
            //prev = obj;
         }
         sw.Stop();
         Debug.WriteLine("Get Class: {0}ms", sw.ElapsedMilliseconds);
      }
Example #18
0
      public void PreferenceSet_Get_Test()
      {
         var prefs = new PreferenceSet();

         Assert.AreEqual(360, prefs.Get<int>(Preference.FormSplitterLocation));
         Assert.AreEqual(String.Empty, prefs.Get<string>(Preference.EmailReportingFromAddress));
         Assert.AreEqual("logcache", prefs.Get<string>(Preference.CacheFolder));
         var task1 = prefs.Get<ClientRetrievalTask>(Preference.ClientRetrievalTask);
         var task2 = prefs.Get<ClientRetrievalTask>(Preference.ClientRetrievalTask);
         Assert.AreNotSame(task1, task2);
         Assert.AreEqual(new ClientRetrievalTask(), task1);
         Assert.IsNull(prefs.Get<ICollection<string>>(Preference.FormColumns));
         var graphColors1 = prefs.Get<IEnumerable<Color>>(Preference.GraphColors);
         var graphColors2 = prefs.Get<IEnumerable<Color>>(Preference.GraphColors);
         Assert.AreNotSame(graphColors1, graphColors2);
      }
Example #19
0
        public void PreferenceSet_Get_Benchmark_Class_Test()
        {
            var prefs = new PreferenceSet();

            //object prev = null;
            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                var obj = prefs.Get <ClientRetrievalTask>(Preference.ClientRetrievalTask);
                //Assert.AreNotSame(prev, obj);
                //prev = obj;
            }
            sw.Stop();
            Debug.WriteLine("Get Class: {0}ms", sw.ElapsedMilliseconds);
        }
Example #20
0
        public void PreferenceSet_Get_Test()
        {
            var prefs = new PreferenceSet();

            Assert.AreEqual(360, prefs.Get <int>(Preference.FormSplitterLocation));
            Assert.AreEqual(String.Empty, prefs.Get <string>(Preference.EmailReportingFromAddress));
            Assert.AreEqual("logcache", prefs.Get <string>(Preference.CacheFolder));
            var task1 = prefs.Get <ClientRetrievalTask>(Preference.ClientRetrievalTask);
            var task2 = prefs.Get <ClientRetrievalTask>(Preference.ClientRetrievalTask);

            Assert.AreNotSame(task1, task2);
            Assert.AreEqual(new ClientRetrievalTask(), task1);
            Assert.IsNull(prefs.Get <ICollection <string> >(Preference.FormColumns));
            var graphColors1 = prefs.Get <IEnumerable <Color> >(Preference.GraphColors);
            var graphColors2 = prefs.Get <IEnumerable <Color> >(Preference.GraphColors);

            Assert.AreNotSame(graphColors1, graphColors2);
        }
Example #21
0
        private DataTable CreatePreferenceOptionsSource(PreferenceSet set)
        {
            // prepare table
            var table = new DataTable();

            table.Columns.Add("set");
            table.Columns.Add("value");
            table.Columns.Add("classes");
            table.Columns.Add("label");

            // iterate sets
            foreach (var option in set.Options)
            {
                var row = table.NewRow();
                row["set"]      = set.Name;
                row["value"]    = option.Value;
                row["classes"] += option.Active ? " active" : string.Empty;
                row["label"]    = option.Label;
                table.Rows.Add(row);
            }

            return(table);
        }
Example #22
0
 public void UpdatePreferenceSet(PreferenceSet currentPreferenceSet)
 {
     this.ObjectContext.PreferenceSets.AttachAsModified(currentPreferenceSet, this.ChangeSet.GetOriginal(currentPreferenceSet));
 }
Example #23
0
      public void PreferenceSet_Get_Benchmark_Collection_Test()
      {
         var prefs = new PreferenceSet();

         var sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000000; i++)
         {
            //Assert.IsNotNull(prefs.Get<IEnumerable<Color>>(Preference.GraphColors));
            var obj = prefs.Get<IEnumerable<Color>>(Preference.GraphColors);
         }
         sw.Stop();
         Debug.WriteLine("Get Collection: {0}ms", sw.ElapsedMilliseconds);
      }
Example #24
0
      public void PreferenceSet_Set_ValueType_Test()
      {
         var prefs = new PreferenceSet();

         prefs.Set(Preference.FormSplitterLocation, (object)null);
         prefs.Set(Preference.FormSplitterLocation, "60");
         prefs.Set(Preference.FormSplitterLocation, 120);
         prefs.Set(Preference.FormSplitterLocation, 360);
      }
Example #25
0
      public void PreferenceSet_Get_Benchmark_Null_Collection_Test()
      {
         var prefs = new PreferenceSet();

         var sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000000; i++)
         {
            //Assert.IsNull(prefs.Get<ICollection<string>>(Preference.FormColumns));
            var obj = prefs.Get<ICollection<string>>(Preference.FormColumns);
         }
         sw.Stop();
         Debug.WriteLine("Get Null Collection: {0}ms", sw.ElapsedMilliseconds);
      }
Example #26
0
      public void PreferenceSet_Set_String_Test()
      {
         var prefs = new PreferenceSet();

         prefs.Set(Preference.EmailReportingFromAddress, (string)null);
         prefs.Set(Preference.EmailReportingFromAddress, "*****@*****.**");
         prefs.Set(Preference.EmailReportingFromAddress, "*****@*****.**");
      }
Example #27
0
      public void PreferenceSet_Set_Class_Test()
      {
         var prefs = new PreferenceSet();

         prefs.Set(Preference.ClientRetrievalTask, (ClientRetrievalTask)null);
         prefs.Set(Preference.ClientRetrievalTask, new ClientRetrievalTask());
         prefs.Set(Preference.ClientRetrievalTask, new ClientRetrievalTask { Enabled = false });
      }
Example #28
0
      public void PreferenceSet_Set_Collection_Test()
      {
         var prefs = new PreferenceSet();

         prefs.Set(Preference.FormColumns, (List<string>)null);
         prefs.Set(Preference.FormColumns, (IEnumerable<string>)new[] { "a", "b", "c" });
         prefs.Set(Preference.FormColumns, (ICollection<string>)new[] { "a", "b", "c" });
      }