コード例 #1
0
        public new void Show()
        {
            if (!double.IsNaN(FlowRate) && FlowRate > 0)
            {
                txt_FlowRate.Text = FlowRate.ToString("f2");
            }

            base.Show();
        }
        public static SamplingItem CreateSamplingItem(string SamplingItemType)
        {
            SamplingItem item;

            if (SamplingItemType == "Opacity")
            {
                return(item = new Opacity());
            }
            else if (SamplingItemType == "SulfurDioxide")
            {
                return(item = new SulfurDioxide());
            }
            else if (SamplingItemType == "NitrogenOxides")
            {
                return(item = new NitrogenOxides());
            }
            else if (SamplingItemType == "CarbonMonoxide")
            {
                return(item = new CarbonMonoxide());
            }
            else if (SamplingItemType == "TotalReducedSulfur")
            {
                return(item = new TotalReducedSulfur());
            }
            else if (SamplingItemType == "HydrogenChloride")
            {
                return(item = new HydrogenChloride());
            }
            else if (SamplingItemType == "VolatileOrganicLiquid")
            {
                return(item = new VolatileOrganicLiquid());
            }
            else if (SamplingItemType == "Oxygen")
            {
                return(item = new Oxygen());
            }
            else if (SamplingItemType == "FlowRate")
            {
                return(item = new FlowRate());
            }
            else if (SamplingItemType == "Temperature")
            {
                return(item = new Temperature());
            }
            else
            {
                return(null);
            }

            // TODO: Fatory Pattern by C# Reflection with .NET Standard 2.0
        }
コード例 #3
0
        private void ButtonExportFileTimeRange_Click(object sender, RoutedEventArgs e)
        {
            if (DataGridFlowRates.SelectedItem is FlowRate)
            {
                FlowRate      flowRate = DataGridFlowRates.SelectedItem as FlowRate;
                StreamSession session  = (StreamSession)DataContext;


                OpenFileDialog openFile = new OpenFileDialog();
                openFile.Title           = "Select Target Export File";
                openFile.CheckFileExists = false;
                openFile.CheckPathExists = true;
                openFile.DefaultExt      = ".txt";
                openFile.FileName        = System.IO.Path.GetFileNameWithoutExtension(MainWindow.Analyzer.LastFilePath) + "_part_" + flowRate.Time.ToString("hhmmss") + ".txt";

                var result = openFile.ShowDialog();

                if (result.HasValue && result.Value)
                {
                    string targetPath = openFile.FileName;

                    this.ButtonExportFileTimeRange.IsEnabled = false;
                    MainWindow.Instance.ShowPleaseWait();
                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            MainWindow.Analyzer.ExportFlowRateRows(session, flowRate, targetPath);
                        }
                        catch (Exception ex)
                        {
                            MainWindow.Instance.ShowError(ex.ToString());
                        }
                    }).ContinueWith(new Action <Task>((Task t) =>
                    {
                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            MainWindow.Instance.HidePleaseWait();
                            this.ButtonExportFileTimeRange.IsEnabled = true;
                            MessageBox.Show("File part successfully exported to: " + targetPath, "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                        }));
                    }));
                }
            }
            else
            {
                MessageBox.Show("Please select a flow rate!");
            }
        }
コード例 #4
0
        public void LayerRateCalculator_GetFlowRateDataByName()
        {
            using (new LifeTimeScope())
            {
                WFloInterface WFInt = new WFloInterface();
                WFInt.AddRef();

                FlowRate pVal = new FlowRate();
                pVal.AddRef();

                string sfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer\\get-one layer.wflx");

                WFInt.OpenFile(sfile);

                double dRate = 37178.3;

                WFInt.GetLayerRateCalculator().AddRef().Calculate(dRate);

                WFInt.GetLayerRateCalculator().AddRef().LayerRates.AddRef().GetFlowRateDataByName("Layer 1", pVal);

                double WaterRate = pVal.WaterRate;
                double OilRate = pVal.OilRate;

                Assert.AreEqual(9294.6, WaterRate, DeltaFraction.Default(9294.6));
                Assert.AreEqual(27883.8, OilRate, DeltaFraction.Default(27883.8));
            }
        }