コード例 #1
0
        /// <summary>
        /// 发送消息,必须实现接口IMsgSender
        /// </summary>
        public static void SendLogicMsg(this IMsgSender sender, int msgName, IMsgParam paramList)
        {
            if (msgName == 0)
            {
                return;
            }

            if (!mMsgHandlerDict.ContainsKey(msgName))
            {
                return;
            }

            List <LogicMsgHandler> handlers = mMsgHandlerDict[msgName];
            int handlerCount = handlers.Count;

            // 之所以是从后向前遍历,是因为从前向后遍历删除后索引值会不断变化
            for (int i = handlerCount - 1; i >= 0; i--)
            {
                LogicMsgHandler handler = handlers[i];

                if (handler.Receiver != null)
                {
                    handler.Callback(paramList);
                }
                else
                {
                    handlers.Remove(handler);
                }
            }
        }
コード例 #2
0
ファイル: MsgDispatcher.cs プロジェクト: tongwanming/DXG
    /// <summary>
    /// 发送消息
    /// 注意第一个参数
    /// </summary>
    public static void SendLogicMsg(this IMsgSender sender, string msgName, params object [] paramList)
    {
        if (string.IsNullOrEmpty(msgName))
        {
            Debug.Log("消息系统 【发送】:" + msgName + " is Null or Empty");
            return;
        }

        if (!mMsgHandlerDict.ContainsKey(msgName))
        {
            //QPrint.FrameworkWarn("SendMsg is UnRegister");
            Debug.Log("消息系统 【发送】:" + msgName + " 此消息没有注册!");
            return;
        }

        var handlers = mMsgHandlerDict [msgName];

        var handlerCount = handlers.Count;

        // 之所以是从后向前遍历,是因为  从前向后遍历删除后索引值会不断变化
        for (int index = handlerCount - 1; index >= 0; index--)
        {
            var handler = handlers [index];

            if (handler.receiver != null)
            {
                Debug.Log("消息系统 【发送】:" + msgName + " 开始发送!");
                handler.callback(paramList);
            }
            else
            {
                handlers.Remove(handler);
            }
        }
    }
コード例 #3
0
 public MsgInfo(string msgName, IMsgSender sender, IMsgReceiver receiver, object[] args)
 {
     this.MsgName  = msgName;
     this.Sender   = sender;
     this.Receiver = receiver;
     this.Args     = args;
 }
コード例 #4
0
ファイル: MsgDispatcher.cs プロジェクト: dtknowlove/DailyTest
    /// <summary>
    /// 发送消息
    /// </summary>
    /// <param name="self">Self.</param>
    /// <param name="msg">Message.</param>
    public static void SenderMsg(this IMsgSender self, string msg, params object[] param)
    {
        if (string.IsNullOrEmpty(msg))
        {
            Debug.LogError("消息不能为空");
            return;
        }
        if (false == mMsgTrapDict.ContainsKey(msg))
        {
            Debug.LogError("未注册消息:" + msg);
            return;
        }
        var handers      = mMsgTrapDict [msg];
        int handersCount = handers.Count;

        for (int i = handersCount - 1; i >= 0; i--)
        {
            var hander = handers [i];
            if (hander.receiver != null)
            {
                Debug.Log("SendMsg:" + msg);
                hander.callBack(param);
            }
            else
            {
                handers.Remove(hander);
            }
        }
    }
コード例 #5
0
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (msgName == Domain.MsgType.MSG_CURRENT_BARCODE)
     {
         if (args[0] != null)
         {
             this.txtBarcode.Text = args[0] as string;
         }
     }
     else if (msgName == MachineMsg.SINGLEDROPWEIGHT_UPDATE)
     {
         if (args[0] != null)
         {
             this.txtDotWeight.Text = ((double)args[0]).ToString();
         }
     }
     else if (msgName == Domain.MsgType.MSG_CURRENT_HEIGHT)
     {
         if (args[0] != null)
         {
             this.txtMeasureHeight.Text = ((double)args[0]).ToString();
         }
     }
     else
     {
     }
 }
コード例 #6
0
        public void Initialize()
        {
            NetworkNodeDecoder.Init();
            PrivateKey privateKey = new(TestPrivateKeyHex);

            _publicKey = privateKey.PublicKey;
            LimboLogs?logManager = LimboLogs.Instance;

            IDiscoveryConfig discoveryConfig = new DiscoveryConfig();

            discoveryConfig.PongTimeout = 100;

            _msgSender = Substitute.For <IMsgSender>();
            NodeDistanceCalculator calculator = new(discoveryConfig);

            _networkConfig.ExternalIp = "99.10.10.66";
            _networkConfig.LocalIp    = "10.0.0.5";

            _nodeTable = new NodeTable(calculator, discoveryConfig, _networkConfig, logManager);
            _nodeTable.Initialize(TestItem.PublicKeyA);

            EvictionManager             evictionManager  = new(_nodeTable, logManager);
            ITimerFactory               timerFactory     = Substitute.For <ITimerFactory>();
            NodeLifecycleManagerFactory lifecycleFactory = new(_nodeTable, evictionManager,
                                                               new NodeStatsManager(timerFactory, logManager), new NodeRecord(), discoveryConfig, Timestamper.Default, logManager);

            _nodes = new[] { new Node(TestItem.PublicKeyA, "192.168.1.18", 1), new Node(TestItem.PublicKeyB, "192.168.1.19", 2) };

            IFullDb nodeDb = new SimpleFilePublicKeyDb("Test", "test_db", logManager);

            _discoveryManager           = new DiscoveryManager(lifecycleFactory, _nodeTable, new NetworkStorage(nodeDb, logManager), discoveryConfig, logManager);
            _discoveryManager.MsgSender = _msgSender;
        }
コード例 #7
0
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (msgName == MsgType.IDLE)
     {
         this.status = msgName;
         OnIdle();
     }
     else if (msgName == MsgType.RUNNING || msgName == MsgType.BUSY)
     {
         this.status = msgName;
         OnRunning();
     }
     else if (msgName == MsgType.PAUSED)
     {
         this.status = msgName;
         OnPaused();
     }
     else if (msgName == MsgConstants.SWITCH_USER || msgName == MsgConstants.MODIFY_ACCESS || msgName == LngMsg.SWITCH_LNG)
     {
         this.HandleMsg(this.status, this, null);
         this.naviBtnAdvanced1.UpdateUI();
         this.naviBtnConfig1.UpdateUI();
         this.naviBtnTools1.UpdateUI();
     }
 }
コード例 #8
0
 public static void SendMsg(string msgName, IMsgSender sender, IMsgReceiver receiver, params object[] args)
 {
     lock (lockObj)
     {
         receiver.HandleMsg(msgName, sender, args);
     }
 }
コード例 #9
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="msgName"></param>
        /// <param name="paramList"></param>
        public static void SendLogicMsg(this IMsgSender sender, string msgName, params object[] paramList)
        {
            if (string.IsNullOrEmpty(msgName))
            {
                System.Console.WriteLine("SendMsg is Null or Empty");
                return;
            }

            if (!mMsgHandlerDict.ContainsKey(msgName))
            {
                System.Console.WriteLine("SendMsg is UnRegister");
                return;
            }

            var handlers     = mMsgHandlerDict[msgName];
            var handlerCount = handlers.Count;

            for (var index = handlerCount - 1; index >= 0; index--)
            {
                var handler = handlers[index];

                if (handler.Receiver != null)
                {
                    System.Console.WriteLine("SendLogicMsg:" + msgName + " Succeed");
                    handler.Callback(paramList);
                }
                else
                {
                    handlers.Remove(handler);
                }
            }
        }
コード例 #10
0
ファイル: RTVInfoCtl.cs プロジェクト: SetCode/Fluid
        public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
        {
            if (msgName.Equals(LngMsg.MSG_Barcode_Info))
            {
                this.BeginInvoke(new Action(() =>
                {
                    this.textBox1.Text = args[0].ToString();
                }));
            }
            else if (msgName.Equals(LngMsg.MSG_WidthAndHeight_Info))
            {
                this.BeginInvoke(new Action(() =>
                {
                    DataGridViewRow drRow = new DataGridViewRow();

                    //添加测宽值
                    DataGridViewTextBoxCell cell0 = new DataGridViewTextBoxCell();
                    cell0.Value = args[0].ToString();

                    //添加测宽上公差
                    DataGridViewTextBoxCell cell1 = new DataGridViewTextBoxCell();
                    cell1.Value = args[1].ToString();

                    //添加测宽下公差
                    DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell();
                    cell2.Value = args[2].ToString();

                    //添加测高值
                    DataGridViewTextBoxCell cell3 = new DataGridViewTextBoxCell();
                    cell3.Value = args[3].ToString();

                    //添加测高上公差
                    DataGridViewTextBoxCell cell4 = new DataGridViewTextBoxCell();
                    cell4.Value = args[4].ToString();

                    //添加测高下公差
                    DataGridViewTextBoxCell cell5 = new DataGridViewTextBoxCell();
                    cell5.Value = args[5].ToString();

                    //将所有行信息添加
                    drRow.Cells.Add(cell0);
                    drRow.Cells.Add(cell1);
                    drRow.Cells.Add(cell2);
                    drRow.Cells.Add(cell3);
                    drRow.Cells.Add(cell4);
                    drRow.Cells.Add(cell5);
                    this.dataGridView1.Rows.Add(drRow);
                    this.dataGridView1.FirstDisplayedScrollingRowIndex = this.dataGridView1.Rows.Count - 1;
                }));
            }
            else if (msgName.Equals(LngMsg.MSG_Clear_RtvInfo))
            {
                this.BeginInvoke(new Action(() =>
                {
                    this.textBox1.Text = "";
                    this.dataGridView1.Rows.Clear();
                }));
            }
        }
コード例 #11
0
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (msgName == MsgDef.MSG_PARAMPAGE_CLEAR)
     {
         this.clearPage();
         this.selectCmdButton(null);
     }
 }
コード例 #12
0
ファイル: PageJobsProduction.cs プロジェクト: SetCode/Fluid
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (msgName == MachineMsg.SETUP_INFO)
     {
         onSystemInfoChanged();
     }
     else if (msgName == MsgDef.IDLE)
     {
         this.txtProgramName.Enabled = true;
         this.txtBoardCount.Enabled  = true;
         this.txtPassCount.Enabled   = true;
         this.txtFailedCount.Enabled = true;
         this.txtStartTime.Enabled   = true;
         this.txtCycleTime.Enabled   = true;
         this.cmbRunMode.Enabled     = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
         this.txtSetNum.Enabled      = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
     }
     else if (msgName == MsgDef.RUNNING || msgName == MsgDef.BUSY || msgName == MsgDef.PAUSED)
     {
         this.txtProgramName.Enabled = false;
         this.txtBoardCount.Enabled  = false;
         this.txtPassCount.Enabled   = false;
         this.txtFailedCount.Enabled = false;
         this.txtStartTime.Enabled   = false;
         this.txtCycleTime.Enabled   = false;
         this.cmbRunMode.Enabled     = false;
         this.txtSetNum.Enabled      = false;
     }
     else if (msgName == MsgDef.RUNINFO_PROGRAM || msgName == Constants.MSG_NEW_PROGRAM)
     {
         string programName = args[0] as string;
         this.txtProgramName.Text = programName;
     }
     else if (msgName == MsgDef.RUNINFO_START_DATETIME)
     {
         DateTime dateTime = (DateTime)args[0];
         this.txtStartTime.Text = dateTime.ToString("yyyy/MM/dd HH:mm:ss");
     }
     else if (msgName == MsgDef.RUNINFO_RESULT)
     {
         int    boardCount  = (int)args[0];
         int    failedCount = (int)args[1];
         double cycleTime   = (double)args[2];
         this.updateCountInfo(boardCount, failedCount, cycleTime);
     }
     //else if (msgName == LngMsg.SWITCH_LNG)
     //{
     //    this.UpdateUI();
     //}
     else if (msgName == MsgConstants.MODIFY_ACCESS || msgName == MsgConstants.SWITCH_USER)
     {
         this.cmbRunMode.Enabled = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
         this.txtSetNum.Enabled  = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
     }
 }
コード例 #13
0
 /// <summary>
 /// 广播消息
 /// </summary>
 /// <param name="msgName">消息名字</param>
 /// <param name="sender">消息发送者</param>
 /// <param name="args">消息携带的参数</param>
 public static void Broadcast(string msgName, IMsgSender sender, params object[] args)
 {
     lock (lockObj)
     {
         if (msgReceiverMap.ContainsKey(msgName))
         {
             List <IMsgReceiver> msgReceiverList = msgReceiverMap[msgName];
             foreach (IMsgReceiver msgReceiver in msgReceiverList)
             {
                 msgReceiver.HandleMsg(msgName, sender, args);
             }
         }
     }
 }
コード例 #14
0
        public void OpenFile(IMsgSender sender)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect      = false;
            ofd.Title            = "";
            ofd.Filter           = "|*.flu";
            ofd.InitialDirectory = System.IO.Directory.GetCurrentDirectory() + "\\G";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                MsgCenter.Broadcast(Constants.MSG_LOAD_PROGRAM, sender, ofd.FileName);
                Properties.Settings.Default.ProgramName = ofd.FileName;
            }
        }
コード例 #15
0
        public void Setup()
        {
            _discoveryManagerMock = Substitute.For <IDiscoveryManager>();
            _discoveryConfigMock  = Substitute.For <IDiscoveryConfig>();

            NetworkNodeDecoder.Init();
            SetupNodeIds();

            LimboLogs?logManager = LimboLogs.Instance;

            _loggerMock = Substitute.For <ILogger>();
            //setting config to store 3 nodes in a bucket and for table to have one bucket//setting config to store 3 nodes in a bucket and for table to have one bucket

            IConfigProvider configurationProvider = new ConfigProvider();

            _networkConfig.ExternalIp = "99.10.10.66";
            _networkConfig.LocalIp    = "10.0.0.5";

            IDiscoveryConfig discoveryConfig = configurationProvider.GetConfig <IDiscoveryConfig>();

            discoveryConfig.PongTimeout  = 50;
            discoveryConfig.BucketSize   = 3;
            discoveryConfig.BucketsCount = 1;

            NodeDistanceCalculator calculator = new(discoveryConfig);

            _nodeTable = new NodeTable(calculator, discoveryConfig, _networkConfig, logManager);
            _nodeTable.Initialize(TestItem.PublicKeyA);
            _nodeStatsMock = Substitute.For <INodeStats>();

            EvictionManager evictionManager = new(_nodeTable, logManager);

            _evictionManagerMock = Substitute.For <IEvictionManager>();
            ITimerFactory timerFactory = Substitute.For <ITimerFactory>();
            NodeLifecycleManagerFactory lifecycleFactory = new(_nodeTable, evictionManager,
                                                               new NodeStatsManager(timerFactory, logManager), new NodeRecord(), discoveryConfig, Timestamper.Default, logManager);

            IMsgSender udpClient = Substitute.For <IMsgSender>();

            SimpleFilePublicKeyDb discoveryDb = new("Test", "test", logManager);

            _discoveryManager           = new DiscoveryManager(lifecycleFactory, _nodeTable, new NetworkStorage(discoveryDb, logManager), discoveryConfig, logManager);
            _discoveryManager.MsgSender = udpClient;

            _discoveryManagerMock = Substitute.For <IDiscoveryManager>();
        }
コード例 #16
0
ファイル: Global.asax.cs プロジェクト: 810912015/option
 void Init(IMailSender mailSender, IMsgSender msgSender, bool isSendToTestUsers = false)
 {
     try
     {
         this.IsSendToTestUsers = ConfigurationManager.AppSettings["IsSendToTestUsers"].ToLower() == "true";
         MaxTestUserId          = Convert.ToInt32(ConfigurationManager.AppSettings["MaxTestUserId"]);
     }
     catch (Exception ex)
     {
         Singleton <TextLog> .Instance.Error(ex);
     }
     this.mailSender = mailSender; this.msgSender = msgSender;
     tips            = new Dictionary <string, string>();
     tips.Add("txt-爆仓警告", "尊敬的{0},您好!您的保证金账户保证率已小于1.1,为防止账户发生爆仓,请您及时充值!【比权网】");
     tips.Add("txt-爆仓通知", "尊敬的{0},您好!您的保证金账户已发生爆仓,请您及时关注!【比权网】");
     tips.Add("mail-爆仓警告", "尊敬的用户{0},您好!您的保证金账户保证率已小于1.1,为防止账户发生爆仓,请您及时充值!【比权网】");
     tips.Add("mail-爆仓通知", "尊敬的用户{0},您好!您的保证金账户已发生爆仓,请您及时关注!【比权网】");
 }
コード例 #17
0
        /// <summary>
        /// 发送消息
        /// 注意第一个参数
        /// </summary>
        public static void SendGlobalMsg(this IMsgSender sender, string msgName, params object[] paramList)
        {
            if (CheckStrNullOrEmpty(msgName))
            {
                return;
            }

            if (!mMsgHandlerDict.ContainsKey(MoLiMsgChannel.Global))
            {
                Debug.LogError("Channel:" + MoLiMsgChannel.Global.ToString() + " doesn't exist");
                return;
            }

            // 略过,不用看
            if (!mMsgHandlerDict[MoLiMsgChannel.Global].ContainsKey(msgName))
            {
                Debug.LogError("SendMsg is UnRegister,and msgName is " + msgName);
                return;
            }

            // 开始看!!!!
            var handlers = mMsgHandlerDict[MoLiMsgChannel.Global][msgName];

            var handlerCount = handlers.Count;

            // 之所以是从后向前遍历,是因为  从前向后遍历删除后索引值会不断变化
            // 参考文章,http://www.2cto.com/kf/201312/266723.html
            for (int index = handlerCount - 1; index >= 0; index--)
            {
                var handler = handlers[index];


                //存在事件接收者则触发回调事件,不存在则移除该事件
                if (handler.receiver != null)
                {
                    Debug.Log("SendLogicMsg:" + msgName + " Succeed");
                    handler.callback(paramList);
                }
                else
                {
                    handlers.Remove(handler);
                }
            }
        }
コード例 #18
0
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (msgName == MsgType.IDLE)
     {
         this.Enabled            = true;
         this.cbxRunMode.Enabled = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
         this.nudSetNum.Enabled  = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
     }
     else if (msgName == MsgType.RUNNING || msgName == MsgType.BUSY || msgName == MsgType.PAUSED)
     {
         this.Enabled = false;
     }
     else if (msgName == MsgType.RUNINFO_PROGRAM || msgName == Constants.MSG_NEW_PROGRAM)
     {
         string programName = args[0] as string;
         this.txtProgram.Text = programName;
     }
     else if (msgName == MsgType.RUNINFO_START_DATETIME)
     {
         DateTime dateTime = (DateTime)args[0];
         this.txtStartDate.Text = dateTime.ToString("yyyy/MM/dd");
         this.txtStartTime.Text = dateTime.ToString("HH:mm:ss");
     }
     else if (msgName == MsgType.RUNINFO_RESULT)
     {
         int    boardCount  = (int)args[0];
         int    failedCount = (int)args[1];
         double cycleTime   = (double)args[2];
         this.SetInfo(boardCount, failedCount, cycleTime);
     }
     else if (msgName == LngMsg.SWITCH_LNG)
     {
         this.UpdateUI();
     }
     else if (msgName == MsgConstants.MODIFY_ACCESS || msgName == MsgConstants.SWITCH_USER)
     {
         this.cbxRunMode.Enabled = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
         this.nudSetNum.Enabled  = RoleMgr.Instance.CurrentRole.MainFormAccess.CanUseCbxRunMode;
     }
 }
コード例 #19
0
ファイル: QMsgDispatcher.cs プロジェクト: tankRJ55/QFramework
        /// <summary>
        /// 发送消息
        /// 注意第一个参数
        /// </summary>
        public static void SendLogicMsg(this IMsgSender sender, string msgName, params object[] paramList)
        {
            // 略过,不用看
            if (string.IsNullOrEmpty(msgName))
            {
                QPrint.FrameworkError("SendMsg is Null or Empty");
                return;
            }

            // 略过,不用看
            if (!mMsgHandlerDict.ContainsKey(msgName))
            {
                QPrint.FrameworkWarn("SendMsg is UnRegister");
                return;
            }

            // 开始看!!!!
            var handlers = mMsgHandlerDict[msgName];


            var handlerCount = handlers.Count;

            // 之所以是从后向前遍历,是因为  从前向后遍历删除后索引值会不断变化
            // 参考文章,http://www.2cto.com/kf/201312/266723.html
            for (int index = handlerCount - 1; index >= 0; index--)
            {
                var handler = handlers[index];

                if (handler.receiver != null)
                {
                    QPrint.FrameworkLog("SendLogicMsg:" + msgName + " Succeed");
                    handler.callback(paramList);
                }
                else
                {
                    handlers.Remove(handler);
                }
            }
        }
コード例 #20
0
ファイル: NavigateRun.cs プロジェクト: SetCode/Fluid
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (msgName == MsgType.IDLE)
     {
         btnStart.Enabled          = true;
         btnStep.Enabled           = true;
         btnPause.Enabled          = false;
         btnStop.Enabled           = false;
         btnAbort.Enabled          = false;
         naviBtnInitAll1.Enabled   = true;
         naviBtnInitItems1.Enabled = true;
     }
     else if (msgName == MsgType.BUSY)
     {
         btnStart.Enabled          = false;
         btnStep.Enabled           = false;
         btnPause.Enabled          = false;
         btnStop.Enabled           = false;
         btnAbort.Enabled          = false;
         naviBtnInitAll1.Enabled   = false;
         naviBtnInitItems1.Enabled = false;
     }
 }
コード例 #21
0
        /// <summary>
        /// 消息发送处理
        /// </summary>
        /// <param name="self">this扩展,this必须是 IMsgSender的实例</param>
        /// <param name="MsgType">要发送的消息类型</param>
        /// <param name="paramList">要发送的参数,支持任意类型,任意长度的参数</param>
        public static void DispatchMessage(this IMsgSender self, ECustomMessageType MsgType, params Object[] paramList)
        {
            if (MsgType == ECustomMessageType.NULL)
            {
                CLOG.E("error msg type is {0}", MsgType);
                return;
            }

            // 没有注册该消息时的处理
            if (!m_MsgHandlerList.ContainsKey(MsgType))
            {
                return;
            }

            // 得到所有注册的处理
            var Handlers = m_MsgHandlerList[MsgType];

            // 得到数量
            var HandlerCount = Handlers.Count;

            // 倒序遍历,防止删除引起的循环异常
            for (int i = HandlerCount - 1; i >= 0; i--)
            {
                var Handler = Handlers[i];

                // 存在处理对象才调用
                if (Handler.m_Receiver != null)
                {
                    Handler.m_Callback(paramList);
                }
                else
                {
                    Handlers.Remove(Handler);
                }
            }
        }
コード例 #22
0
 public Notificationer(IMsgSender msgSender)
 {
     this.msgSender = msgSender;
 }
コード例 #23
0
ファイル: ManualControl.cs プロジェクト: SetCode/Fluid
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     if (Machine.Instance.Setting.MachineSelect == MachineSelection.RTV)
     {
         this.btnDownConveyorStart.Visible = true;
         this.btnDownConveyorEnd.Visible   = true;
     }
     else
     {
         this.btnDownConveyorStart.Visible = false;
         this.btnDownConveyorEnd.Visible   = false;
         if (Machine.Instance.Setting.MachineSelect == MachineSelection.TSV300)
         {
             this.ConveyorIsEnable(false);
         }
     }
     if (msgName == MsgType.IDLE)
     {
         this.btnPurge.Enabled    = true;
         this.btnPrime.Enabled    = true;
         this.btnScale.Enabled    = true;
         this.btnHeatIO.Enabled   = true;
         this.btnScanner.Enabled  = true;
         this.btnLaser.Enabled    = true;
         this.btnConveyor.Enabled = true;
         if (Machine.Instance.Setting.MachineSelect == MachineSelection.TSV300)
         {
             this.ConveyorIsEnable(false);
         }
         else
         {
             this.ConveyorIsEnable(true);
         }
         if (Machine.Instance.Setting.MachineSelect == MachineSelection.RTV)
         {
             this.btnDownConveyorStart.Enabled = true;
             this.btnDownConveyorEnd.Enabled   = true;
         }
     }
     else if (msgName == MsgType.RUNNING || msgName == MsgType.PAUSED || msgName == MsgType.BUSY)
     {
         this.btnPurge.Enabled   = false;
         this.btnPrime.Enabled   = false;
         this.btnScale.Enabled   = false;
         this.btnHeatIO.Enabled  = false;
         this.btnScanner.Enabled = false;
         this.btnLaser.Enabled   = false;
         this.ConveyorIsEnable(false);
         if (msgName == MsgType.RUNNING || msgName == MsgType.PAUSED)
         {
             this.btnConveyor.Enabled = true;
             if (Machine.Instance.Setting.MachineSelect == MachineSelection.RTV)
             {
                 this.btnDownConveyorStart.Enabled = true;
                 this.btnDownConveyorEnd.Enabled   = true;
             }
         }
         else
         {
             this.btnConveyor.Enabled = false;
             if (Machine.Instance.Setting.MachineSelect == MachineSelection.RTV)
             {
                 this.btnDownConveyorStart.Enabled = false;
                 this.btnDownConveyorEnd.Enabled   = false;
             }
         }
     }
 }
コード例 #24
0
 public UrgencyNotificationer(IMsgSender msgSender) : base(msgSender)
 {
 }
コード例 #25
0
 public SevereNotificationer(IMsgSender msgSender) : base(msgSender)
 {
 }
コード例 #26
0
 public TrivialNotificationer(IMsgSender msgSender) : base(msgSender)
 {
 }
コード例 #27
0
ファイル: Global.asax.cs プロジェクト: 810912015/option
 public BlasterSendMsg(IMailSender mailSender, IMsgSender msgSender, bool isSendToTestUsers = false)
 {
     Init(mailSender, msgSender, isSendToTestUsers);
 }
コード例 #28
0
 public NormalNotificationer(IMsgSender msgSender) : base(msgSender)
 {
 }
コード例 #29
0
ファイル: MainForm.cs プロジェクト: SetCode/Fluid
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     // 更新硬件信息
     if (msgName == MachineMsg.SETUP_INFO)
     {
         OnSetupInfo();
     }
     // 加载程序
     else if (msgName == Constants.MSG_LOAD_PROGRAM)
     {
         string programPath = args[0] as string;
         OnLoadProgram(programPath);
     }
     // 退出AFM
     else if (msgName == MsgType.EXIT)
     {
         this.Close();
     }
     // 进入主界面
     else if (msgName == MsgType.ENTER_MAIN)
     {
         OnEnterMainPage();
     }
     // 进入编程界面
     else if (msgName == MsgType.ENTER_EDIT)
     {
         OnEnterEditPage();
     }
     // 初始化相机
     else if (msgName == MachineMsg.INIT_VISION)
     {
         //this.CameraCtl.SetupCamera(Machine.Instance.Camera);
         //this.CameraCtl.UpdateUI();
     }
     // 切换语言
     else if (msgName == LngMsg.SWITCH_LNG)
     {
         this.Config.Lang = (LanguageType)args[0];
         this.SwitchConfig();
         this.SaveConfig();
         //this.CameraCtl.UpdateUI();
         CameraForm cameraForm = FormMgr.GetForm <CameraForm>();
         JogForm    jogForm    = FormMgr.GetForm <JogForm>();
         cameraForm.UpdateUI();
         jogForm.UpdateUI();
         if (!cameraForm.Visible)
         {
             cameraForm.Close();
         }
         if (!jogForm.Visible)
         {
             jogForm.Close();
         }
         this.ReadLanguageResources();
     }
     //切换了用户或修改了权限表需要更新界面
     else if (msgName == MsgConstants.SWITCH_USER || msgName == MsgConstants.MODIFY_ACCESS)
     {
         //只有Jog和Camera2个非模态窗口,相机界面无运行时参数,所以只需要更新Jog界面。
         JogForm jogForm = FormMgr.GetForm <JogForm>();
         jogForm.UpdateUI();
         if (!jogForm.Visible)
         {
             jogForm.Close();
         }
     }
     else if (msgName == Domain.MsgType.MSG_FIND_MARK_FIALED)
     {
         this.onFindMarkFailed(args[0] as Pattern, args[1] as Mark);
     }
     else if (msgName == Domain.MsgType.MSG_BLOBS_FIALED)
     {
         this.onFindBlobsFailed(args[0] as Blobs);
     }
     else if (msgName == Domain.MsgType.MSG_FIND_BARCODE_FIALED)
     {
         if (args[1] is Barcode)
         {
             this.onFindBarcodeFailed(args[0] as Pattern, args[1] as Barcode);
         }
         else if (args[1] is ConveyorBarcode)
         {
             this.onFindBarcodeFailed(args[0] as Pattern, args[1] as ConveyorBarcode);
         }
     }
 }