コード例 #1
0
        public void DataShow()
        {
            OutPutSelectOption option = new OutPutSelectOption();

            option.IsSetStationRange = true;
            if (this.StationId != null)
            {
                option.AddStationId(this.StationId);
            }

            if (option.StationIdList.Count == 0)
            {
                return;
            }

            option.IsSetTimeRange = true;
            option.From           = this.timeFrom;
            option.To             = this.timeTo;

            if (this.StationType.Equals("河道站"))
            {
                ShowRiverData(option);
            }

            if (this.StationType.Equals("水库站"))
            {
                ShowReservoirData(option);
            }
        }
コード例 #2
0
ファイル: RiverOutputVm.cs プロジェクト: sbyujx/PmssWpfApp
        public void DataShow()
        {
            OutPutSelectOption option = new OutPutSelectOption();

            option.IsSetStationRange = true;
            foreach (HydroStationOutOption item in this.StationOption)
            {
                if (item.IsSelected == true)
                {
                    option.AddStationId(item.StationId);
                    break;
                }
            }

            if (option.StationIdList.Count == 0)
            {
                this.Hint = "请至少选择一个站点!";
                return;
            }

            option.IsSetTimeRange = true;
            option.From           = this.timeFrom;
            option.To             = this.timeTo;

            this.Hint = "正在河道水库水情曲线...";
            ShowReservoirData(option);

            //Thread thread = new Thread(unused => ShowReservoirData(option));
            //thread.Start();
        }
コード例 #3
0
ファイル: RiverOutputVm.cs プロジェクト: sbyujx/PmssWpfApp
        private void SaveRiverFile(string fileName, OutPutSelectOption option)
        {
            this.Hint = "保存中...";
            FetchRiverRecord frr = new FetchRiverRecord();

            if (option.IsSetTimeRange == true)
            {
                frr.SetDuration(option.From, option.To);
            }

            if (option.IsSetStationRange == true)
            {
                frr.SetStationId(option.StationIdList);
            }

            frr.FecthData();

            if (option.FileType == OutPutSelectOption.FILE_TYPE_EXCEL)
            {
                frr.SaveToExcelFile(fileName);
            }

            if (option.FileType == OutPutSelectOption.FILE_TYPE_TXT)
            {
                frr.SaveToTxTFile(fileName);
            }

            this.Hint = "保存完成!";
        }
コード例 #4
0
ファイル: RiverOutputVm.cs プロジェクト: sbyujx/PmssWpfApp
        public void DataOut()
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter     = "TXT文件 (*.txt)|*.txt|EXCEL文件 (*.xlsx)|*.xlsx";
            dlg.DefaultExt = "txt";
            dlg.Title      = "保存水库水情";
            dlg.ShowDialog();

            OutPutSelectOption option = new OutPutSelectOption();

            option.IsSetStationRange = true;
            foreach (HydroStationOutOption item in this.StationOption)
            {
                if (item.IsSelected == true)
                {
                    option.AddStationId(item.StationId);
                }
            }
            option.IsSetTimeRange = true;
            option.From           = this.timeFrom;
            option.To             = this.timeTo;

            if (dlg.FileName != "")
            {
                switch (dlg.FilterIndex)
                {
                case 1:      //TXT文件
                    option.FileType = OutPutSelectOption.FILE_TYPE_TXT;
                    break;

                case 2:     //EXECL文件
                    option.FileType = OutPutSelectOption.FILE_TYPE_EXCEL;
                    break;
                }

                Thread thread = new Thread(unused => SaveRiverFile(dlg.FileName, option));
                thread.Start();
            }
            else
            {
                this.Hint = "请选择一个文件名!";
            }
        }
コード例 #5
0
ファイル: RiverOutputVm.cs プロジェクト: sbyujx/PmssWpfApp
        private void ShowReservoirData(OutPutSelectOption option)
        {
            FetchRiverRecord frr = new FetchRiverRecord();

            if (option.IsSetTimeRange == true)
            {
                frr.SetDuration(option.From, option.To);
            }

            if (option.IsSetStationRange == true)
            {
                frr.SetStationId(option.StationIdList);
            }

            frr.FecthData();

            WindowShowRiverChart wd = new WindowShowRiverChart(frr.RiverList);

            wd.ShowDialog();

            this.Hint = "河道水情曲线生成完成!";
        }
コード例 #6
0
        private void ShowReservoirData(OutPutSelectOption option)
        {
            FetchReservoirRecord frr = new FetchReservoirRecord();

            if (option.IsSetTimeRange == true)
            {
                frr.SetDuration(option.From, option.To);
            }

            if (option.IsSetStationRange == true)
            {
                frr.SetStationId(option.StationIdList);
            }

            frr.FecthData();
            frr.ReservoirList.Sort(delegate(ReservoirHydrologyRecord x, ReservoirHydrologyRecord y)
            {
                return(x.Time.CompareTo(y.Time));
            });

            WindowShowReserviorChart wd = new WindowShowReserviorChart(frr.ReservoirList);

            wd.ShowDialog();
        }