コード例 #1
0
ファイル: ServerForm.cs プロジェクト: culturespy/ZapU
        public void ZapStateUpdatedCallback(DeviceBase device, int address, int data)
        {
            if (this.InvokeRequired)
            {
                var d = new DeviceBase.DeviceStateUpdatedCallback(ZapStateUpdatedCallback);
                this.BeginInvoke(d, new object[] { device, address, data });
            }
            else
            {
                TrackBar target = null;
                if (address == (int)AddressByte.Pot_A)
                {
                    target = FeedbackA;
                }
                if (address == (int)AddressByte.Pot_B)
                {
                    target = FeedbackB;
                }
                if (address == (int)AddressByte.Pot_MA)
                {
                    target = FeedbackM;
                }
                if (target != null)
                {
                    try
                    {
                        target.Value = data;
                    }
                    catch (Exception) { } // Ignore values out of range
                }
                if (address == (int)AddressByte.ModeOverride)
                {
                    _last_mode = (ModeSelect)data;
                    try
                    {
                        ErosTekModeData mode = ZapUcommon.ErosTek.Constants.Modes[(ModeSelect)data];
                        ModeText.Text       = mode.Name;
                        client_needs_resync = true;
                    }
                    catch (Exception) { }
                }

                Proxy.RawWrite(new RawCommand()
                {
                    Address = address, Data = data
                });
            }
        }
コード例 #2
0
ファイル: ServerForm.cs プロジェクト: culturespy/ZapU
 public void ProxyStateUpdatedCallback(DeviceBase device, int address, int data)
 {
     if (this.InvokeRequired)
     {
         var d = new DeviceBase.DeviceStateUpdatedCallback(ProxyStateUpdatedCallback);
         this.BeginInvoke(d, new object[] { device, address, data });
     }
     else
     {
         if (RemoteInputRadio.Checked && Device != null && Device.IsReady)
         {
             Device.RawWrite(new RawCommand()
             {
                 Address = address, Data = data
             });
         }
     }
 }
コード例 #3
0
ファイル: ClientForm.cs プロジェクト: culturespy/ZapU
 void ProxyStateUpdatedCallback(DeviceBase device, int address, int data)
 {
     if (this.InvokeRequired)
     {
         var d = new DeviceBase.DeviceStateUpdatedCallback(ProxyStateUpdatedCallback);
         this.BeginInvoke(d, new object[] { device, address, data });
     }
     else
     {
         TrackBar target = null;
         if (address == (int)AddressByte.Pot_A)
         {
             target = FeedbackA;
         }
         if (address == (int)AddressByte.Pot_B)
         {
             target = FeedbackB;
         }
         if (address == (int)AddressByte.Pot_MA)
         {
             target = FeedbackM;
         }
         if (target != null)
         {
             try
             {
                 target.Value = data;
             }
             catch (Exception) { } // Ignore values out of range
         }
         if (address == (int)AddressByte.ModeOverride)
         {
             try
             {
                 ErosTekModeData mode = ZapUcommon.ErosTek.Constants.Modes[(ModeSelect)data];
                 ModeText.Text = mode.Name;
             }
             catch (Exception) { } // Ignore unknown modes
         }
     }
 }