コード例 #1
0
    void Start()
    {
        var pref = new UserPreference("bongteng16", "くわ", "sometoken1234", "{\"meat\":5, \"fish\":3}");

        pref.Save();
        var pref2 = new UserPreference("bongteng", "わわ", "anothertoken456", "{}");

        pref.Save();

        pref2.Print();
    }
コード例 #2
0
        private void importFromDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DB.SuspendTreeUpdates();
                var path = UserPreference.Lookup("bulk_import_folder");

                FolderBrowserDialog dlg = new FolderBrowserDialog();
                if (Directory.Exists(path))
                {
                    dlg.SelectedPath = path;
                }
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    UserPreference.Save("bulk_import_folder", dlg.SelectedPath);
                    BulkImportForm f = new BulkImportForm();
                    f.ImportClick += delegate {
                        BulkImportDirectory.Import(DB, f.SelectedPath, f.Filter, f.RegexFilter);
                    };
                    f.SelectedPath = dlg.SelectedPath;

                    f.ShowDialog();
                    DatabaseChanged();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DB.ResumeTreeUpdates();
            }
        }
コード例 #3
0
ファイル: PiscesForm.cs プロジェクト: govtmirror/Pisces
 private void OpenClick(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         Performance    p  = new Performance();
         OpenFileDialog fd = new OpenFileDialog();
         fd.DefaultExt = "*.pdb";
         fd.Filter     = "Pisces database (*.pdb)|*.pdb";
         if (fd.ShowDialog() == DialogResult.OK)
         {
             explorer1.Open(fd.FileName);
             DatabaseChanged();
         }
         UserPreference.Save("fileName", fd.FileName);
         p.Report("done reading " + fd.FileName);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
コード例 #4
0
ファイル: FormStatus.cs プロジェクト: usbr/HydrometTools
        public static void ShowStatus(string status, bool showAllways = false)
        {
            var lines = status.Split('\n');

            foreach (var item in lines)
            {
                Logger.WriteLine(item);
            }

            if (UserPreference.Lookup("HideStatusDialog") != "True" || showAllways)
            {
                var f = new FormStatus();
                f.Lines = lines;
                f.ShowDialog();

                if (f.HideDialogNextTime)
                {
                    UserPreference.Save("HideStatusDialog", "True");
                }
                else
                {
                    UserPreference.Save("HideStatusDialog", "False");
                }
            }
        }
コード例 #5
0
ファイル: QuestionManager.cs プロジェクト: jphacks/NG_1808
    IEnumerator SetQuestions()
    {
        for (int i = 0; i < QuestionCount; i++)
        {
            SetTwoCategory(ref LeftButton, ref RightButton, i);

            while (currentChoice == CategoryChoice.No)
            {
                yield return(null);
            }

            AddCategoryScore(currentChoice);
            ResetProperty();

            yield return(null);
        }
        string json = Json.Serialize(categoryDatabase.categoryDictionary);

        Debug.Log(json);
        PlayerPrefs.SetString("LikeJson", json);
        UserPreference userPreference = new UserPreference(UserData.userData.userId, UserData.userData.userName, UserData.userData.userAccessToken, json);

        userPreference.Save();
        SceneManager.LoadScene("Send");
    }
コード例 #6
0
 private void addPiscesDatabase_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         Performance    p  = new Performance();
         OpenFileDialog fd = new OpenFileDialog();
         fd.DefaultExt = "*.pdb";
         fd.Filter     = "Pisces database (*.pdb)|*.pdb";
         if (fd.ShowDialog() == DialogResult.OK)
         {
             SQLiteServer       svr = new SQLiteServer(fd.FileName);
             TimeSeriesDatabase db  = new TimeSeriesDatabase(svr, false);
             DB.InsertDatabase(CurrentFolder, db);
             DatabaseChanged();
         }
         UserPreference.Save("fileName", fd.FileName);
         p.Report("done reading " + fd.FileName);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
コード例 #7
0
ファイル: SaveOptions.cs プロジェクト: usbr/HydrometTools
 private void buttonOk_Click(object sender, EventArgs e)
 {
     UserPreference.Save("SaveToVMS", SaveToVMS.ToString());
     if (checkBoxDependencies.Enabled)
     {
         UserPreference.Save("ComputeDependencies", ComputeDependencies.ToString());
     }
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: woohn/Pisces
 private void OpenFile(string fileName)
 {
     this.textBoxExcelFileName.Text = fileName;
     InitilizeSpreadsheet();
     xls.Open(fileName);
     runForecast1.Reload(xls);
     UserPreference.Save("FileName", fileName);
 }
コード例 #9
0
        private void RefreshClick(object sender, System.EventArgs e)
        {
            if (this.comboBoxInputs.Text.IndexOf(":") == 0)
            {
                return;
            }

            UserPreference.Save("Inputs" + m_db.ToString(), this.comboBoxInputs.Text);

            this.dragPoint1.Active = false;
            Cursor = Cursors.WaitCursor;
            timeSeriesSpreadsheet1.Clear();
            Application.DoEvents();
            try
            {
                dataTable = this.GetTimeSeries();
                dataTable.AcceptChanges();
                dataTable.RowChanged += new DataRowChangeEventHandler(dataTable_RowChanged);
                Logger.WriteLine(UserPreference.Lookup("HydrometServer"), "ui");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Logger.WriteLine("error reading data from " + UserPreference.Lookup("HydrometServer") + " " + ex.ToString(), "ui");
                Logger.WriteLine(ex.ToString());
            }
            finally
            {
                Cursor = Cursors.Default;
            }
            if (dataTable == null)
            {
                return;
            }


            Logger.WriteLine(dataTable.Rows.Count + " rows of data read", "ui");
            if (dataTable.Rows.Count > 0)
            {
                dataTable.WriteXml(originalDataXmlFilename, XmlWriteMode.WriteSchema);
            }

            Graph();

            SetupUsgsLink();
            timeSeriesSpreadsheet1.SetDataTable(dataTable, m_db, true);
            timeSeriesSpreadsheet1.AutoFlagDayFiles = UserPreference.Lookup("AutoFlagDayFiles") == "True";

            //this.comboBoxEditSeries.Items.Clear();
            //this.comboBoxEditSeries.Items.Add("None");
            //for(int i=0; i<tChart1.Series.Count; i++)
            //{
            //    string columnName = tChart1.Series[i].Title;
            //    this.comboBoxEditSeries.Items.Add(columnName);
            //}

            //this.comboBoxEditSeries.SelectedIndex =0;
        }
コード例 #10
0
 private void ReadFile(string filename)
 {
     labelFileName.Text = filename;
     if (!File.Exists(filename))
     {
         return;
     }
     comboBoxInputs.Items.Clear();
     comboBoxInputs.Items.AddRange(File.ReadAllLines(filename));
     labelFileName.Text = filename;
     UserPreference.Save(m_db.ToString() + "FileName", filename);
 }
コード例 #11
0
ファイル: Login.cs プロジェクト: usbr/HydrometTools
        private void buttonOk_Click(object sender, System.EventArgs e)
        {
            s_password     = this.textBoxPass.Text;
            mpoll_password = this.textBoxPassMpoll.Text;
            UserPreference.Save("UserName", this.textBoxUser.Text);
            //UserPreference.Save("BuildCropCharts", checkBoxCropCharts.Checked.ToString());
            //UserPreference.Save("ComputeET",checkBoxET.Checked.ToString());
            UserPreference.Save("RunArchiver", checkBoxArchiver.Checked.ToString());
            //UserPreference.Save("SendToWeb", checkBoxWeb.Checked.ToString());

            Close();
            this.CancelClicked = false;
        }
コード例 #12
0
ファイル: PiscesForm.cs プロジェクト: govtmirror/Pisces
        private void NewDatabaseClick(object sender, EventArgs e)
        {
            SaveFileDialog fd = new SaveFileDialog();

            fd.Title      = "Create a new Database";
            fd.DefaultExt = "*.pdb";
            fd.Filter     = "Pisces database (*.pdb)|*.pdb";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                explorer1.Open(fd.FileName, true);
                DatabaseChanged();
                UserPreference.Save("fileName", fd.FileName);
            }
        }
コード例 #13
0
ファイル: ServerDatabaseDialog.cs プロジェクト: woohn/Pisces
        private void save_Click(object sender, EventArgs e)
        {
            if (!dbList.Contains(this.comboBox1.Text))
            {
                string val = comboBox1.Text;
                if (this.comboBox1.SelectedItem != null)
                {
                    val = comboBox1.Text;
                }
                dbList.Insert(0, val);
                Properties.Settings.Default.Save();
            }

            credentials.Save(comboBox1.Text.Trim(), textBoxPassword.Text);
            UserPreference.Save("SelectedDatabaseServer", comboBox1.Text.Trim());
        }
コード例 #14
0
ファイル: Settings.cs プロジェクト: dloney/HydrometTools
        public void SaveUserPref()
        {
            if (!Ready)
            {
                return;
            }


            UserPreference.Save("HideStatusDialog", this.checkBoxHideStatus.Checked.ToString());
            UserPreference.Save("Admin", this.checkBoxAdmin.Checked.ToString());
            UserPreference.Save("EnableComputations", this.checkBoxCompute.Checked.ToString());
            //UserPreference.Save("AgrimetCalculations", this.checkBoxAgrimet.Checked.ToString());
            UserPreference.Save("MultipleYAxis", this.checkBoxMultipleYAxis.Checked.ToString());
            UserPreference.Save("AutoFlagDayFiles", this.checkBoxAutoFlagDayfiles.Checked.ToString());
            var pw = textBoxDbPassword.Text;

            UserPreference.Save("timeseries_database_password", StringCipher.Encrypt(pw, ""));
        }
コード例 #15
0
 private void SaveToUserPref()
 {
     if (this.radioButtonPnHydromet.Checked)
     {
         UserPreference.Save("HydrometServer", HydrometHost.PN.ToString());
     }
     else
     if (this.radioButtonBoiseLinux.Checked)
     {
         UserPreference.Save("HydrometServer", HydrometHost.PNLinux.ToString());
     }
     else
     if (this.radioButtonYakHydromet.Checked)
     {
         UserPreference.Save("HydrometServer", HydrometHost.Yakima.ToString());
     }
     else
     if (this.radioButtonGP.Checked)
     {
         UserPreference.Save("HydrometServer", HydrometHost.GreatPlains.ToString());
     }
 }
コード例 #16
0
ファイル: ServerSelection.cs プロジェクト: lulzzz/Pisces
        private void SaveToUserPref()
        {
            if (this.radioButtonPnHydromet.Checked)
            {
                UserPreference.Save("HydrometServer", HydrometHost.PN.ToString());
            }
            else
            if (this.radioButtonBoiseLinux.Checked)
            {
                UserPreference.Save("HydrometServer", HydrometHost.PNLinux.ToString());
            }
            else
            if (this.radioButtonYakHydromet.Checked)
            {
                UserPreference.Save("HydrometServer", HydrometHost.Yakima.ToString());
            }
            else
            if (this.radioButtonGP.Checked)
            {
                UserPreference.Save("HydrometServer", HydrometHost.GreatPlains.ToString());
            }
            else
            if (this.radioButtonLocal.Checked)
            {
                UserPreference.Save("HydrometServer", HydrometHost.LocalSource.ToString());
            }

            else
            if (this.radioButtonYakLinux.Checked)
            {
                UserPreference.Save("HydrometServer", HydrometHost.YakimaLinux.ToString());
            }


            UserPreference.Save("TimeSeriesDatabaseName", this.textBoxDbName.Text);
        }
コード例 #17
0
ファイル: SnowGG.cs プロジェクト: muguangyuze/Pisces
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                timeSeriesGraph1.AnnotationOnMouseMove = checkBoxAnnotate.Checked;
                Cursor = Cursors.WaitCursor;
                Application.DoEvents();
                string pcode = DeterminePcode();

                timeSeriesGraph1.Clear();

                string cbtt = comboBoxCbtt.Text.Trim();

                if (cbtt.Trim() == "" || pcode.Trim() == "")
                {
                    return;
                }

                UserPreference.Save("Snowgg->cbtt", cbtt);
                UserPreference.Save("Snowgg->pcode", comboBoxPcode.Text.Trim());

                int[] waterYears = this.yearSelector1.SelectedYears;
                var   server     = HydrometInfoUtility.HydrometServerFromPreferences();
                var   range      = monthRangePicker1.MonthDayRange;

                Series s  = new HydrometDailySeries(cbtt, pcode, server);
                var    sl = new SeriesList();
                sl.Add(s);

                var wyList = PiscesAnalysis.WaterYears(sl, waterYears, false, 10, true);

                AddStatistics(wyList);

                if (checkBoxGP.Checked)
                {
                    GPAverage(cbtt, server, range, wyList);
                }

                var mp = ReadMpollData(pcode, cbtt);
                mp.RemoveMissing();
                if (mp.Count > 0)
                {
                    wyList.Add(mp);
                }

                // remove months outside selected range
                var list = FilterBySelectedRange(range, wyList);

                this.timeSeriesGraph1.AnalysisType = AnalysisType.WaterYears;
                this.timeSeriesGraph1.Series       = list;
                this.timeSeriesGraph1.Title        = HydrometInfoUtility.LookupSiteDescription(cbtt) + "  Elevation:" + HydrometInfoUtility.LookupElevation(cbtt);
                this.timeSeriesGraph1.Draw(true);


                timeSeriesGraph1.GraphSettings = GetGraphSettings();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
コード例 #18
0
        /// <summary>
        /// graphs data in dataTable
        /// </summary>
        void Graph()
        {
            UserPreference.Save("ShowPoints", this.checkBoxShowPoints.Checked.ToString());

            tChart1.Text = "";
            if (dataTable == null)
            {
                return;
            }
            Console.WriteLine("graph()");

            tChart1.Series.Clear();
            tChart1.Zoom.Undo();
            int sz = dataTable.Columns.Count;

            if (sz == 2 || (sz == 3 && m_db == TimeInterval.Irregular) ||
                (sz == 3 && m_db == TimeInterval.Monthly))     // single graph series.
            {
                this.tChart1.Legend.Visible = false;
            }
            else
            {
                this.tChart1.Legend.Visible = true;
            }
            string subTitle = "";

            this.tChart1.Header.Text       = GetHeaderTitle(out subTitle);
            this.tChart1.SubHeader.Visible = false;
            if (subTitle.Trim() != "")
            {
                this.tChart1.SubHeader.Text    = subTitle;
                this.tChart1.SubHeader.Visible = true;
            }
            int increment = 1;

            if (m_db == TimeInterval.Irregular || m_db == TimeInterval.Monthly)
            {
                increment = 2;
            }
            tChart1.Axes.Custom.RemoveAll();
            tChart1.Panel.MarginLeft                  = 3;
            tChart1.Axes.Left.Title.Text              = "";
            tChart1.Axes.Right.Title.Text             = "";
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "MM/dd";
            for (int i = 1; i < sz; i += increment)
            {
                try
                {
                    string columnName = dataTable.Columns[i].ColumnName;
                    double avg        = AverageOfColumn(dataTable, columnName);
                    Steema.TeeChart.Styles.Line series = MakeSeries(dataTable, columnName, avg);

                    series.VertAxis        = Steema.TeeChart.Styles.VerticalAxis.Left;
                    series.Pointer.Visible = this.checkBoxShowPoints.Checked;

                    var    tokens = TextFile.Split(columnName);
                    string pcode  = "";
                    string cbtt   = "";
                    if (tokens.Length == 2)
                    {
                        cbtt  = tokens[0].Trim();
                        pcode = tokens[1].Trim();
                    }


                    string units = LookupUnits(pcode);


                    if (UserPreference.Lookup("MultipleYAxis") == "True")
                    {
                        TChartDataLoader.SetupMultiLeftAxis(tChart1, series, units);
                    }
                    else
                    {
                        TChartDataLoader.SetupAxisLeftRight(tChart1, series, units);
                    }

                    /*    //if (i == 1)
                     *  //{
                     *  //    vertLabel1 = Hydromet.LookupMcfPcodeDescription(cbtt, pcode);
                     *  //    tChart1.Axes.Left.Title.Text = vertLabel1;
                     *  //    firstPcode = pcode;
                     *  //}
                     *  //else
                     *  //{ // determine if we should use right vertical axis.
                     *  //    if (firstPcode.ToLower().Trim() != pcode.Trim().ToLower())
                     *  //    {
                     *  //        series.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
                     *  //    }
                     *  //}
                     */


                    tChart1.Series.Add(series);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString() + " series index " + i);
                    Logger.WriteLine(e.ToString(), "ui");
                }

                if (tChart1.Series.Count > 0)
                {
                    dragPoint1.Series = tChart1[0];
                    dragPoint1.Active = true;
                }
                else
                {
                    dragPoint1.Active = false;
                }
            }
            //tChart1.Zoom.ZoomPercent(94);
            this.comboBoxEditSeries_SelectedIndexChanged(null, null);
        }
コード例 #19
0
ファイル: SnowGG.cs プロジェクト: woohn/Pisces
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                timeSeriesGraph1.AnnotationOnMouseMove = checkBoxAnnotate.Checked;
                Cursor = Cursors.WaitCursor;
                Application.DoEvents();
                string pcodeOrig = DeterminePcode();

                timeSeriesGraph1.Clear();

                string cbttOrig = comboBoxCbtt.Text.Trim();
                string cbtt = cbttOrig, pcode = pcodeOrig;

                var seriesList = new List <string>();
                if ((cbttOrig.Trim() == "" || pcodeOrig.Trim() == "") && textBoxMultiple.Text == "")
                {
                    return;
                }
                else
                {
                    if (!checkBoxUseList.Checked)
                    {
                        UserPreference.Save("Snowgg->cbtt", cbttOrig);
                        UserPreference.Save("Snowgg->pcode", comboBoxPcode.Text.Trim());
                        seriesList.Add(cbttOrig + "_" + pcodeOrig);
                    }
                    else
                    {
                        var seriesItems = textBoxMultiple.Text.Split(',');
                        foreach (string item in seriesItems)
                        {
                            if (item.Trim().Split(' ').Length == 2)
                            {
                                seriesList.Add(item.Trim().Split(' ')[0] + "_" + item.Trim().Split(' ')[1]);
                            }
                        }
                    }
                }

                int[]      waterYears            = this.yearSelector1.SelectedYears;
                SeriesList finalSeriesCollection = new SeriesList();
                foreach (string series in seriesList)
                {
                    cbtt = series.Split('_')[0];
                    comboBoxCbtt.Text  = cbtt;
                    pcode              = series.Split('_')[1];
                    comboBoxPcode.Text = pcode;
                    var server = HydrometInfoUtility.HydrometServerFromPreferences();
                    var range  = monthRangePicker1.MonthDayRange;

                    Series s  = new HydrometDailySeries(cbtt, pcode, server);
                    var    sl = new SeriesList();
                    sl.Add(s);

                    var wyList = PiscesAnalysis.WaterYears(sl, waterYears, false, 10, true);

                    foreach (var item in wyList)
                    {
                        item.Name = cbtt + " " + pcode;
                    }


                    wyList = ApplyDeltas(wyList, waterYears);
                    AddStatistics(wyList);

                    if (checkBoxGP.Checked)
                    {
                        GPAverage(cbtt, server, range, wyList);
                    }

                    var mp = ReadMpollData(pcode, cbtt);
                    mp.RemoveMissing();
                    if (mp.Count > 0)
                    {
                        wyList.Add(mp);
                    }

                    // remove months outside selected range
                    var list = FilterBySelectedRange(range, wyList);
                    finalSeriesCollection.Add(list);
                }

                // Set series line colors
                var uniqueSeriesNames  = new List <string>();
                var uniqueSeriesColors = new List <string>();
                int colorCounter       = 0;
                foreach (var item in finalSeriesCollection)
                {
                    // set line color by year which is identified in the legendtext field
                    if (!uniqueSeriesNames.Contains(item.Appearance.LegendText) && !item.Appearance.LegendText.Contains("%") &&
                        !item.Appearance.LegendText.Contains("avg") && !item.Appearance.LegendText.Contains("max") && !item.Appearance.LegendText.Contains("min"))
                    {
                        uniqueSeriesNames.Add(item.Appearance.LegendText);//.Name);
                        uniqueSeriesColors.Add(snowGgColors[colorCounter]);
                        colorCounter = (colorCounter + 1) % snowGgColors.Count;
                    }
                }
                foreach (var item in finalSeriesCollection)
                {
                    try
                    {
                        int colIdx = uniqueSeriesNames.IndexOf(item.Appearance.LegendText);//.Name);
                        item.Appearance.Color = uniqueSeriesColors[colIdx];
                    }
                    catch
                    {
                        item.Appearance.Color = "Black";
                    }
                }

                this.timeSeriesGraph1.AnalysisType = AnalysisType.WaterYears;
                this.timeSeriesGraph1.Series       = finalSeriesCollection;
                if (seriesList.Count == 1)
                {
                    this.timeSeriesGraph1.Title = HydrometInfoUtility.LookupSiteDescription(cbtt) + "  Elevation:" + HydrometInfoUtility.LookupElevation(pcode);
                }
                //timeSeriesGraph1.GraphSettings = GetGraphSettings();

                this.timeSeriesGraph1.Draw(true);

                comboBoxCbtt.Text  = cbttOrig;
                comboBoxPcode.Text = pcodeOrig;

                timeSeriesGraph1.GraphSettings = GetGraphSettings();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
コード例 #20
0
ファイル: SnowGG.cs プロジェクト: usbr/HydrometTools
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                timeSeriesGraph1.AnnotationOnMouseMove = checkBoxAnnotate.Checked;
                timeSeriesGraph1.AnnotationDateShift   = !cySelected;
                Cursor = Cursors.WaitCursor;
                Application.DoEvents();
                string pcodeOrig = DeterminePcode();

                timeSeriesGraph1.Clear();

                string cbttOrig = comboBoxCbtt.Text.Trim();
                string cbtt = cbttOrig, pcode = pcodeOrig;

                var seriesList = new List <string>();
                if ((cbttOrig.Trim() == "" || pcodeOrig.Trim() == "") && textBoxMultiple.Text == "")
                {
                    return;
                }
                else
                {
                    if (!checkBoxUseList.Checked)
                    {
                        UserPreference.Save("Snowgg->cbtt", cbttOrig);
                        UserPreference.Save("Snowgg->pcode", comboBoxPcode.Text.Trim());
                        seriesList.Add(cbttOrig + "_" + pcodeOrig);
                    }
                    else
                    {
                        var seriesItems = textBoxMultiple.Text.Split(',');
                        foreach (string item in seriesItems)
                        {
                            if (item.Trim().Split(' ').Length == 2)
                            {
                                seriesList.Add(item.Trim().Split(' ')[0] + "_" + item.Trim().Split(' ')[1]);
                            }
                        }
                    }
                }

                int[]      waterYears            = this.yearSelector1.SelectedYears;
                SeriesList finalSeriesCollection = new SeriesList();
                foreach (string series in seriesList)
                {
                    cbtt = series.Split('_')[0];
                    comboBoxCbtt.Text  = cbtt;
                    pcode              = series.Split('_')[1];
                    comboBoxPcode.Text = pcode;
                    var server = HydrometInfoUtility.HydrometServerFromPreferences();
                    var range  = monthRangePicker1.MonthDayRange;

                    Series s;
                    if (this.checkBoxUseInstant.Checked)
                    {
                        s = new HydrometInstantSeries(cbtt, pcode, server);
                    }
                    else
                    {
                        s = new HydrometDailySeries(cbtt, pcode, server);
                    }
                    var sl = new SeriesList();
                    sl.Add(s);

                    // get wy data
                    var wyList = new SeriesList();
                    if (cySelected)
                    {
                        wyList = PiscesAnalysis.WaterYears(sl, waterYears, false, 1, true);
                    }
                    else
                    {
                        wyList = PiscesAnalysis.WaterYears(sl, waterYears, false, 10, true);
                    }

                    foreach (Series item in wyList)
                    {
                        item.Name = cbtt + " " + pcode;
                        // remove missing data points
                        var missingItems = item.Table.Select("value = 998877");
                        foreach (var row in missingItems)
                        {
                            item.RemoveAt(item.IndexOf(Convert.ToDateTime(row.ItemArray[0])));
                        }
                    }

                    // apply deltas and add stats if toggled
                    wyList = ApplyDeltas(wyList, waterYears);
                    AddStatistics(wyList);

                    if (checkBoxGP.Checked)
                    {
                        GPAverage(cbtt, server, range, wyList);
                    }

                    // remove months outside selected range
                    var list = FilterBySelectedRange(range, wyList);
                    finalSeriesCollection.Add(list);
                }

                // Set series line colors
                var uniqueSeriesNames  = new List <string>();
                var uniqueSeriesColors = new List <string>();
                int colorCounter       = 0;
                foreach (var item in finalSeriesCollection)
                {
                    // set line color by year which is identified in the legendtext field
                    if (!uniqueSeriesNames.Contains(item.Appearance.LegendText) && !item.Appearance.LegendText.Contains("%") &&
                        !item.Appearance.LegendText.Contains("avg") && !item.Appearance.LegendText.Contains("max") && !item.Appearance.LegendText.Contains("min"))
                    {
                        uniqueSeriesNames.Add(item.Appearance.LegendText);//.Name);
                        uniqueSeriesColors.Add(snowGgColors[colorCounter]);
                        colorCounter = (colorCounter + 1) % snowGgColors.Count;
                    }
                }
                foreach (var item in finalSeriesCollection)
                {
                    try
                    {
                        int colIdx = uniqueSeriesNames.IndexOf(item.Appearance.LegendText);//.Name);
                        item.Appearance.Color = uniqueSeriesColors[colIdx];
                    }
                    catch
                    {
                        item.Appearance.Color = "SlateGray"; //System.Drawing.KnownColor.SlateGray
                    }
                }

                this.timeSeriesGraph1.AnalysisType = AnalysisType.WaterYears;
                this.timeSeriesGraph1.Series       = finalSeriesCollection;
                if (seriesList.Count == 1)
                {
                    this.timeSeriesGraph1.Title = HydrometInfoUtility.LookupSiteDescription(cbtt) + "  Elevation:" + HydrometInfoUtility.LookupElevation(cbtt);
                }
                //timeSeriesGraph1.GraphSettings = GetGraphSettings();

                this.timeSeriesGraph1.Draw(true);

                comboBoxCbtt.Text  = cbttOrig;
                comboBoxPcode.Text = pcodeOrig;

                timeSeriesGraph1.GraphSettings = GetGraphSettings();
                this.dataGridView1.DataSource  = this.timeSeriesGraph1.Series.ToDataTable(true);
                this.dataGridView1.Columns[0].DefaultCellStyle.Format = "MMM-d";
                this.linkLabelReport.Visible = true;
            }
            finally
            {
                Cursor      = Cursors.Default;
                dataQueried = true;
            }
        }