Esempio n. 1
0
        public Page_DataGrid(ComViewModel vm)
        {
            InitializeComponent();

            this.DataContext = vm;
            this.vm          = vm;

            save_path = txt_path.Text;

            _Page_Ref_Grid = new Page_Ref_Grid(vm, txt_path.Text);

            Calculate_Ref_Chart_DataPoint();

            _Page_Ref_Chart = new Page_Ref_Chart(vm, list_datapoint);

            pageTransitionControl.ShowPage(_Page_Ref_Grid);

            if (vm.isConnected == false)
            {
                if (vm.Ini_Read("Connection", "Band") == "C Band")
                {
                    vm.Double_Laser_Wavelength = 1523;  //Set wavelength to setup ref value
                }
                else
                {
                    vm.Double_Laser_Wavelength = 1571;
                }
            }
        }
        public Window_Board_Comport_Setting(ComViewModel vm)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = this.vm;
        }
Esempio n. 3
0
        public Window_Password(ComViewModel vm)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = vm;
        }
Esempio n. 4
0
        private async Task <bool> Cmd_Write_RecieveData(string cmd)
        {
            try
            {
                if (vm.port_PD.IsOpen)
                {
                    vm.port_PD.Write(vm.Str_comment + "\r");

                    await AccessDelayAsync(vm.Int_Read_Delay);

                    int    size       = vm.port_PD.BytesToRead;
                    byte[] dataBuffer = new byte[size];
                    int    length     = vm.port_PD.Read(dataBuffer, 0, size);

                    //Show read back message
                    vm = _read_analysis(vm.Str_comment, dataBuffer);

                    vm.port_PD.DiscardInBuffer();       // RX
                    vm.port_PD.DiscardOutBuffer();      // TX

                    vm.port_PD.Close();
                }
            }
            catch { }

            return(vm.IsGoOn);
        }
Esempio n. 5
0
        public Page_Ref_Grid(ComViewModel vm, string path)
        {
            InitializeComponent();

            DataContext = vm;
            this.vm     = vm;

            dataGrid.DataContext = memberData;

            Read_Ref(path);
        }
Esempio n. 6
0
        public Page_Board_Grid(ComViewModel vm)
        {
            InitializeComponent();

            DataContext = vm;
            this.vm     = vm;

            dataGrid.DataContext = memberData;

            Read_Ref(vm.txt_ref_path);
        }
        public Window_Switch_Box(ComViewModel vm, Point point_to_screen, double btn_width)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = vm;
            anly             = new Analysis(vm);

            this.point_to_screen = point_to_screen;
            this.btn_width       = btn_width;
        }
Esempio n. 8
0
        public Page_Setting(ComViewModel vm)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = this.vm;

            try { if (File.Exists(ini_path))
                  {
                      vm.selected_band = vm.Ini_Read("Connection", "Band");
                  }
            }
            catch { }

            if (!string.IsNullOrEmpty(vm.Ini_Read("Connection", "Switch_Comport")))
            {
                vm.Comport_Switch = Convert.ToInt16(vm.Ini_Read("Connection", "Switch_Comport"));
            }

            if (!string.IsNullOrEmpty(vm.Ini_Read("Productions", "V3_Scan_Gap")))
            {
                vm.int_V3_scan_gap = int.Parse(vm.Ini_Read("Productions", "V3_Scan_Gap"));
            }
            if (!string.IsNullOrEmpty(vm.Ini_Read("Productions", "V3_scan_start")))
            {
                vm.int_V3_scan_start = int.Parse(vm.Ini_Read("Productions", "V3_scan_start"));
            }

            if (!string.IsNullOrEmpty(vm.Ini_Read("Connection", "Station")))
            {
                vm.station_type = vm.Ini_Read("Connection", "Station");
            }

            if (!string.IsNullOrEmpty(vm.Ini_Read("Connection", "Control_Board_Type")))
            {
                string a = vm.Ini_Read("Connection", "Control_Board_Type");
                ComBox_Control_Board_Type.SelectedItem = vm.Ini_Read("Connection", "Control_Board_Type");

                try
                {
                    string control_board_type = ComBox_Control_Board_Type.SelectedItem.ToString();
                    switch (control_board_type)
                    {
                    case "UFV":
                        vm.Control_board_type = 0;
                        break;

                    case "V":
                        vm.Control_board_type = 1;
                        break;
                    }
                } catch { }
            }
        }
Esempio n. 9
0
        //public IList<DataPoint> Points { get; private set; }

        public Page_Chart(ComViewModel vm)
        {
            InitializeComponent();

            this.DataContext = vm;
            this.vm          = vm;

            vm.IsCheck = new List <bool>()
            {
                true, false, false, false, false, false, false, false
            };
        }
Esempio n. 10
0
        //ObservableCollection<Member> memberData = new ObservableCollection<Member>();

        public Page_Log(ComViewModel vm)
        {
            InitializeComponent();

            this.vm = vm;

            //dataGrid.DataContext = memberData;
            dataGrid.DataContext = vm.LogMembers;

            AddMsgItem(vm.LogMembers, "K WL", "IL too high", DateTime.Now.Date.ToShortDateString(), DateTime.Now.ToShortTimeString());

            //AddMsgItem("K WL", "IL too high", DateTime.Now.Date.ToShortDateString(), DateTime.Now.ToShortTimeString());
        }
Esempio n. 11
0
        public Window_Bear(ComViewModel vm, bool _is_txt_reshow, string type)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = vm;
            this.type        = type;

            is_txt_reshow = _is_txt_reshow;

            cmd = new ControlCmd(vm);

            //InitializeBackgroundWorker();  //Define progress bar
        }
Esempio n. 12
0
        public async Task <bool> Get_PD_Value()  //PD Value save in vm.Float_PD
        {
            vm.Str_comment = "P0?";
            try
            {
                vm.port_PD.Write(vm.Str_comment + "\r");
                await AccessDelayAsync(vm.Int_Read_Delay);
            }
            catch { return(false); }

            int size = vm.port_PD.BytesToRead;

            byte[] dataBuffer = new byte[size];
            int    length     = vm.port_PD.Read(dataBuffer, 0, size);

            if (dataBuffer.Length > 0)
            {
                vm = anly._K_WL_analysis(dataBuffer);
            }

            return(true);
        }
Esempio n. 13
0
 public ControlCmd(ComViewModel vm)
 {
     this.vm = vm;
     anly    = new Analysis(vm);
 }
Esempio n. 14
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     this.vm = (ComViewModel)this.DataContext;
 }
Esempio n. 15
0
        public Analysis(ComViewModel vm)
        {
            this.vm = vm;

            //List<List<string>> ls = ListDefault<List<string>>(3);
        }
Esempio n. 16
0
        public Page_Ref_Chart(ComViewModel vm, List <DataPoint> list_datapoint)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = vm;

            int count_ch = vm.list_WL_Ref.Count;

            for (int ch = 0; ch < count_ch; ch++)
            {
                if (vm.list_WL_Ref[ch].Count == 0)
                {
                    continue;
                }

                LinearAxis linearAxis = new LinearAxis();
                linearAxis.MajorGridlineStyle = LineStyle.Solid;
                linearAxis.MinorGridlineStyle = LineStyle.Dot;
                linearAxis.Position           = OxyPlot.Axes.AxisPosition.Left;
                linearAxis.Minimum            = -8.5;
                linearAxis.Maximum            = 0.1;
                linearAxis.Minimum            = vm.list_WL_Ref[ch].Min() - 0.1;
                linearAxis.Maximum            = vm.list_WL_Ref[ch].Max() + 0.1;

                LinearAxis linearAxis2 = new LinearAxis();
                linearAxis2.MajorGridlineStyle = LineStyle.Solid;
                linearAxis2.MinorGridlineStyle = LineStyle.Dot;
                linearAxis2.Position           = OxyPlot.Axes.AxisPosition.Bottom;
                linearAxis2.Minimum            = vm.list_wl.Min();
                linearAxis2.Maximum            = vm.list_wl.Max();

                switch (ch)
                {
                case 0:
                    Plot_Ref1.Axes.Add(linearAxis);
                    Plot_Ref1.Axes.Add(linearAxis2);
                    break;

                case 1:
                    Plot_Ref2.Axes.Add(linearAxis);
                    Plot_Ref2.Axes.Add(linearAxis2);
                    break;

                case 2:
                    Plot_Ref3.Axes.Add(linearAxis);
                    Plot_Ref3.Axes.Add(linearAxis2);
                    break;

                case 3:
                    Plot_Ref4.Axes.Add(linearAxis);
                    Plot_Ref4.Axes.Add(linearAxis2);
                    break;

                case 4:
                    Plot_Ref5.Axes.Add(linearAxis);
                    Plot_Ref5.Axes.Add(linearAxis2);
                    break;

                case 5:
                    Plot_Ref6.Axes.Add(linearAxis);
                    Plot_Ref6.Axes.Add(linearAxis2);
                    break;

                case 6:
                    Plot_Ref7.Axes.Add(linearAxis);
                    Plot_Ref7.Axes.Add(linearAxis2);
                    break;

                case 7:
                    Plot_Ref8.Axes.Add(linearAxis);
                    Plot_Ref8.Axes.Add(linearAxis2);
                    break;
                }
            }
        }
Esempio n. 17
0
        public Page_Laser(ComViewModel vm)
        {
            InitializeComponent();

            this.vm          = vm;
            this.DataContext = this.vm;

            bool.TryParse(vm.Ini_Read("Connection", "Auto_Connect_TLS"), out auto_connect);
            vm.Auto_Connect_TLS = auto_connect;

            if (auto_connect)
            {
                #region Tunable Laser setting
                vm.tls             = new HPTLS();
                vm.tls.BoardNumber = vm.tls_BoardNumber;
                vm.tls.Addr        = vm.tls_Addr;

                try
                {
                    if (vm.tls.Open() == false)
                    {
                        vm.Str_cmd_read = "GPIB Setting Error. Check Address.";
                        return;
                    }
                    else
                    {
                        double d = vm.tls.ReadWL();
                        if (string.IsNullOrWhiteSpace(d.ToString()) || d < 0)
                        {
                            vm.Str_cmd_read = "Laser Connection Error.";
                            vm.LogMembers.Add(new Models.LogMember()
                            {
                                Status = "Connection", Message = "Laser Connection Error.", Date = DateTime.Now.ToShortDateString(), Time = DateTime.Now.ToLongTimeString()
                            });
                            return;
                        }
                    }
                    vm.tls.init();

                    vm.Double_Laser_Wavelength = vm.tls.ReadWL();
                    slider_WL.Value            = vm.Double_Laser_Wavelength;

                    vm.isConnected = true;

                    btn_Laser_Status.Background = Brushes.Green;
                }
                catch
                {
                    vm.Str_cmd_read = "TLS GPIB Setting Error.";

                    btn_Laser_Status.Background = Brushes.Red;
                }
                #endregion

                #region PowerMeter Setting
                //Power Meter setting
                vm.pm             = new HPPM();
                vm.pm.Addr        = vm.tls_Addr;
                vm.pm.Slot        = vm.PM_slot;
                vm.pm.BoardNumber = vm.tls_BoardNumber;
                if (vm.pm.Open() == false)
                {
                    vm.Str_cmd_read = "PM GPIB Setting Error.  Check  Address.";
                    return;
                }
                vm.pm.init();
                vm.pm.setUnit(1);
                vm.pm.AutoRange(true);
                vm.pm.aveTime(20);
                #endregion

                #region PDL controller setting
                pdl             = new HPPDL();
                pdl.BoardNumber = Convert.ToInt32("0");
                pdl.Addr        = 11;
                pdl.Open();
                pdl.init();
                pdl.scanRate(8);
                #endregion
            }
        }
Esempio n. 18
0
 public Setting(ComViewModel vm)
 {
     this.vm = vm;
 }