Exemple #1
0
 private void DeviceEventListener_PropertyChanged()
 {
     if (this.InvokeRequired)
     {
         try
         {
             // call method with delegate
             var d = new Callbacks.UpdateCallback(this.UpdateView);
             this.Invoke(d);
         }
         catch
         {
             this.Log.Error("Cihazdaki deger guncellemesi gosterilemedi");
         }
     }
     else
     {
         this.UpdateView();
     }
 }
        public void HandleFailure()
        {
            if (this.InvokeRequired)
            {
                try
                {
                    // call method with delegate
                    var d = new Callbacks.UpdateCallback(this.HandleFailure);
                    if (!this.IsDisposed && !this.Disposing && !this.DisposeStarted.Value)
                    {
                        this.Invoke(d);
                    }
                }
                catch
                {
                    // do nothing
                }
            }
            else
            {
                if (this.DeviceProxy != null)
                {
                    if (this.DeviceProxy.IsConnected)
                    {
                        this.timer.Stop();
                        this.DeviceProxy.Disconnect();
                    }
                }

                this.retryTimer.Start();

                if (this.readFailureCount >= 3)
                {
                    this.SetConnectionError();
                }
            }
        }
Exemple #3
0
        private void UpdateView()
        {
            if (this.InvokeRequired)
            {
                try
                {
                    // call method with delegate
                    var d = new Callbacks.UpdateCallback(this.UpdateView);
                    if (!this.IsDisposed && !this.Disposing && !this.DisposeStarted.Value)
                    {
                        this.Invoke(d);
                    }
                }
                catch
                {
                    // do nothing
                }
            }
            else
            {
                if (this.DeviceProxy.Model != null && this.DeviceProxy.IsConnected)
                {
                    this.ledConnection.TurnOn();
                }

                // Update other properties
                this.HandleViewUpdateForZone(this.GetSelectedZone());

                List<DailyProgram> dailyProgramList = null;
                if (this.InEditMode)
                {
                    dailyProgramList = this.ModelSnapshot.DailyProgramList;
                }
                else
                {
                    dailyProgramList = this.DeviceProxy.Model.DailyProgramList;
                }

                this.dailyProgram1.SetValues(dailyProgramList[0]);
                this.dailyProgram2.SetValues(dailyProgramList[1]);
                this.dailyProgram3.SetValues(dailyProgramList[2]);
                this.dailyProgram4.SetValues(dailyProgramList[3]);
                this.dailyProgram5.SetValues(dailyProgramList[4]);
                this.dailyProgram6.SetValues(dailyProgramList[5]);
                this.dailyProgram7.SetValues(dailyProgramList[6]);
            }
        }
        private void UpdateView()
        {
            if (this.InvokeRequired)
            {
                try
                {
                    // call method with delegate
                    var d = new Callbacks.UpdateCallback(this.UpdateView);
                    if (!this.IsDisposed && !this.Disposing && !this.DisposeStarted.Value)
                    {
                        this.Invoke(d);
                    }
                }
                catch
                {
                    // do nothing
                }
            }
            else
            {
                if (this.DeviceProxy.Model != null && this.DeviceProxy.IsConnected)
                {
                    this.bigLedConnection.TurnOn();
                    this.bigLedPower.TurnOn();
                    this.bigLedBreakdown.Set(this.DeviceProxy.Model.IsFailure.Value);

                    this.lblDateTime.Text = this.DeviceProxy.Model.DeviceTime.ToString("dd.MM.yyyy - HH:mm");
                    this.lblDayOfWeek.Text = this.DeviceProxy.Model.DeviceDay.ToString();

                    var zone1Model = this.DeviceProxy.Model.ZoneList.Count > 0 ? this.DeviceProxy.Model.ZoneList[0] : null;
                    var zone2Model = this.DeviceProxy.Model.ZoneList.Count > 1 ? this.DeviceProxy.Model.ZoneList[1] : null;
                    var zone3Model = this.DeviceProxy.Model.ZoneList.Count > 2 ? this.DeviceProxy.Model.ZoneList[2] : null;
                    var zone4Model = this.DeviceProxy.Model.ZoneList.Count > 3 ? this.DeviceProxy.Model.ZoneList[3] : null;
                    var zone5Model = this.DeviceProxy.Model.ZoneList.Count > 4 ? this.DeviceProxy.Model.ZoneList[4] : null;
                    var zone6Model = this.DeviceProxy.Model.ZoneList.Count > 5 ? this.DeviceProxy.Model.ZoneList[5] : null;
                    var zone7Model = this.DeviceProxy.Model.ZoneList.Count > 6 ? this.DeviceProxy.Model.ZoneList[6] : null;
                    var zone8Model = this.DeviceProxy.Model.ZoneList.Count > 7 ? this.DeviceProxy.Model.ZoneList[7] : null;
                    var zone9Model = this.DeviceProxy.Model.ZoneList.Count > 8 ? this.DeviceProxy.Model.ZoneList[8] : null;
                    var zone10Model = this.DeviceProxy.Model.ZoneList.Count > 9 ? this.DeviceProxy.Model.ZoneList[9] : null;
                    var zone11Model = this.DeviceProxy.Model.ZoneList.Count > 10 ? this.DeviceProxy.Model.ZoneList[10] : null;

                    this.zone1.Set(zone1Model);
                    this.zone2.Set(zone2Model);
                    this.zone3.Set(zone3Model);
                    this.zone4.Set(zone4Model);
                    this.zone5.Set(zone5Model);
                    this.zone6.Set(zone6Model);
                    this.zone7.Set(zone7Model);
                    this.zone8.Set(zone8Model);
                    this.zone9.Set(zone9Model);
                    this.zone10.Set(zone10Model);
                    this.zone11.Set(zone11Model);
                }
                else
                {
                    this.SetConnectionError();
                }
            }
        }
Exemple #5
0
        private void UpdateView()
        {
            if (this.InvokeRequired)
            {
                try
                {
                    // call method with delegate
                    var d = new Callbacks.UpdateCallback(this.UpdateView);
                    if (!this.IsDisposed && !this.Disposing && !this.DisposeStarted.Value)
                    {
                        this.Invoke(d);
                    }
                }
                catch
                {
                    // do nothing
                }
            }
            else
            {
                if (this.DeviceProxy.Model != null && this.DeviceProxy.IsConnected)
                {
                    this.ledConnection.TurnOn();

                    var model = this.DeviceProxy.Model as OledDeviceModel;
                    if (model != null)
                    {
                        this.txtLedVoltage.Text = model.LedVoltage.ToString("N1");
                        this.txtLedCurrent.Text = model.LedCurrent.ToString("N1");
                        this.txtPixelRowCurrent.Text = model.PixelRowCurrent.ToString("N1");
                    }
                }
                else
                {
                    this.SetConnectionError();
                }
            }
        }