示例#1
0
文件: PanelY.cs 项目: bia24/SFrame
    void Awake()
    {
        //控件获取
        button1 = transform.Find("Button1").GetComponent <Button>();
        button2 = transform.Find("Button2").GetComponent <Button>();

        //监听绑定
        MsgCenter.AddMsgListener(MoudleType.UI, UICode.OPEN_PANEL_Y, ShowPanel);

        //按钮事件绑定
        button1.onClick.AddListener(() =>
        {
            MsgCenter.SendMsg(MoudleType.UI, UICode.SHOW_TEXT, new MsgArg("加油啊兄弟", gameObject));
        }
                                    );

        button2.onClick.AddListener(() =>
        {
            MsgCenter.SendMsg(MoudleType.UI, UICode.OPEN_PANEL_R, new MsgArg("", gameObject));
            gameObject.SetActive(false);
        }
                                    );

        //初始状态赋值
        gameObject.SetActive(true);
    }
示例#2
0
文件: MainForm.cs 项目: SetCode/Fluid
        private void OnLoadProgram(string programPath)
        {
            if (FluidProgram.Current != null && FluidProgram.CurrentFilePath == programPath)
            {
                AlarmServer.Instance.Fire(FluidProgram.Current, AlarmInfoFlu.WarnProgramAlreadyLoaded);
                return;
            }
            this.ProgramCtl.Enabled = false;
            FluidProgram.Load(programPath,
                              program =>
            {
                if (program == null)
                {
                    AlarmServer.Instance.Fire(program, AlarmInfoFlu.WarnProgramNull);
                    return;
                }
                FluidProgram.CurrentFilePath = programPath;
                program.HasChanged           = false;
                //加载程序,切换程序相关硬件参数
                Log.Dprint("Loading program: writing hardware...");
                program.InitHardware();
                Log.Dprint("Loading program: writing hardware done!");
                //语法检查
                if (Executor.Instance.CurrProgramState != Executor.ProgramOuterState.IDLE &&
                    Executor.Instance.CurrProgramState != Executor.ProgramOuterState.ABORTED)
                {
                    return;
                }
                Log.Dprint("Loading program: grammar parsing...");
                FluidProgram.Current.Parse();
                Log.Dprint("Loading program: grammar parse done!");
                //加载飞拍Mark校准值,只能在程序解析后赋值
                if (FluidProgram.Current.RuntimeSettings.FlyOffsetIsValid)
                {
                    bool result = FluidProgram.Current.ModuleStructure.SetAllMarkFlyOffset(FluidProgram.Current.RuntimeSettings.FlyOffsetList);
                    if (!result)
                    {
                        FluidProgram.Current.RuntimeSettings.FlyOffsetIsValid = false;
                    }
                }

                MsgCenter.SendMsg(MsgType.RUNINFO_PROGRAM, this, this.RunInfoCtl, program.Name);
            },
                              (errCode, errMsg) =>
            {
                AlarmServer.Instance.Fire(FluidProgram.Current, AlarmInfoFlu.ErrorLoadingProgram.AppendMsg(errMsg));
            });
            this.ProgramCtl.Enabled = true;

            DrawingMsgCenter.Instance.SendMsg(DrawingMessage.需要更新绘图程序, FluidProgram.CurrentOrDefault());
            DrawingMsgCenter.Instance.SendMsg(DrawingMessage.进入了Workpiece界面);
        }
        /// <summary>
        /// 添加后台任务,并且通过消息通知用户
        /// </summary>
        /// <param name="dfTaskId"></param>
        /// <param name="actionDesc"></param>
        /// <param name="action"></param>
        /// <param name="receiveUserId"></param>
        /// <param name="currentUser"></param>
        public static string AddTask(string dfTaskId, string actionDesc, Action action, string receiveUserId, string currentUser)
        {
            TaskHelper.StartNew(string.Empty, dfTaskId, () =>
            {
                try
                {
                    action();
                }
                catch (Exception ex)
                {
                    SendMsg(dfTaskId, ex.Message);
                }
            }, null);
            var msgLink = string.Format("DFIndex.aspx?DF_FORMNAME=Sample_realtime_interaction&dfTaskId={0}", dfTaskId);

            MsgCenter.SendMsg(receiveUserId, actionDesc, msgLink, null, dfTaskId, currentUser, "NewTask");
            return(msgLink);
        }
示例#4
0
    void Awake()
    {
        //面板属性指定
        //组件获取
        btn1 = transform.Find("Button1").GetComponent <Button>();
        btn2 = transform.Find("Button2").GetComponent <Button>();
        btn3 = transform.Find("Button3").GetComponent <Button>();
        btn4 = transform.Find("Button4").GetComponent <Button>();
        //事件绑定
        head1 = () =>
        {
            UIManager.Instance.ShowUIPanel("MsgPanel_SelectCharacterPanel");
            MsgCenter.SendMsg(MoudleType.UI, UICode.SHOW_TEXT, new MsgArg("角色1:威整天"));
        };
        btn1.onClick.AddListener(head1);

        head2 = () =>
        {
            UIManager.Instance.ShowUIPanel("MsgPanel_SelectCharacterPanel");
            MsgCenter.SendMsg(MoudleType.UI, UICode.SHOW_TEXT, new MsgArg("角色2:神秘人物"));
        };
        btn2.onClick.AddListener(head2);

        head3 = () =>
        {
            UIManager.Instance.ShowUIPanel("MsgPanel_SelectCharacterPanel");
            MsgCenter.SendMsg(MoudleType.UI, UICode.SHOW_TEXT, new MsgArg("角色3:威整天"));
        };
        btn3.onClick.AddListener(head3);

        enterGame = () =>
        {
            if (!UIManager.Instance.IsShowingDicAndStackEmpty())
            {
                UIManager.Instance.ClearShowingDic();
                UIManager.Instance.ClearStack();
            }
            UIManager.Instance.ShowUIPanel("HeadPanel");
            UIManager.Instance.ShowUIPanel("MainPanel");
        };
        btn4.onClick.AddListener(enterGame);
    }
示例#5
0
文件: PanelR.cs 项目: bia24/SFrame
    void Awake()
    {
        //组件绑定
        text    = transform.Find("showtext").GetComponent <Text>();
        button3 = transform.Find("Button3").GetComponent <Button>();

        //按钮事件绑定
        button3.onClick.AddListener(() =>
        {
            MsgCenter.SendMsg(MoudleType.UI, UICode.OPEN_PANEL_Y, new MsgArg("", gameObject));
            gameObject.SetActive(false);
        }
                                    );


        //监听消息中心
        MsgCenter.AddMsgListener(MoudleType.UI, UICode.OPEN_PANEL_R, ShowPanel);
        MsgCenter.AddMsgListener(MoudleType.UI, UICode.SHOW_TEXT, ShowText);

        //初始状态
        gameObject.SetActive(false);
    }
示例#6
0
        private void BtnMain_Click(object sender, EventArgs e)
        {
            MsgCenter.SendMsg(MsgType.ENTER_MAIN, this, MainForm.Ins, null);

            DrawingMsgCenter.Instance.SendMsg(DrawingMessage.进入了Workpiece界面);
        }
示例#7
0
 private void BtnEditPgm_Click(object sender, EventArgs e)
 {
     MsgCenter.SendMsg(MsgType.ENTER_EDIT, this, MainForm.Ins, null);
 }
示例#8
0
 private void BtnExit_Click(object sender, EventArgs e)
 {
     MsgCenter.SendMsg(MsgType.EXIT, this, MainForm.Ins, null);
 }
示例#9
0
文件: MainForm.cs 项目: SetCode/Fluid
        private void InitFluProgram()
        {
            this.ProgramCtl.LoadLastProgram();

            Executor.Instance.OnWorkStateChanged += workState =>
            {
                switch (workState)
                {
                case Executor.WorkState.Idle:
                    BeginBroadcastIdle();
                    break;

                case Executor.WorkState.Preparing:
                    BeginBroadcastRunning();
                    break;

                case Executor.WorkState.WaitingForBoard:
                    BeginBroadcastRunning();
                    break;

                case Executor.WorkState.Programing:
                    BeginBroadcastRunning();
                    break;

                case Executor.WorkState.Stopping:
                    BeginBroadcastRunning();
                    break;
                }
            };
            Executor.Instance.OnWorkRunning += () =>
            {
                BeginBroadcastRunning();
                this.BeginInvoke(new MethodInvoker(() =>
                {
                    MsgCenter.SendMsg(MsgType.RUNINFO_START_DATETIME, this, this.RunInfoCtl, Executor.Instance.StartDateTime);
                }));
            };
            Executor.Instance.OnWorkDone += () =>
            {
                BeginBroadcastIdle();
            };
            Executor.Instance.OnWorkStop += () =>
            {
                BeginBroadcastIdle();
            };
            Executor.Instance.OnProgramRunning += () =>
            {
                BeginBroadcastRunning();
            };
            Executor.Instance.OnProgramDone += () =>
            {
                if (!this.IsHandleCreated)
                {
                    return;
                }
                this.BeginInvoke(new MethodInvoker(() =>
                {
                    MsgCenter.SendMsg(MsgType.RUNINFO_RESULT, this, this.RunInfoCtl,
                                      Executor.Instance.FinishedBoardCount,
                                      Executor.Instance.FailedCount,
                                      Executor.Instance.CycleTime);
                }));
            };
            Executor.Instance.OnProgramPausing += () =>
            {
                BeginBroadcastRunning();
            };
            Executor.Instance.OnProgramPaused += () =>
            {
                BeginBroadcastPaused();
            };
            Executor.Instance.OnProgramAborting += () =>
            {
                BeginBroadcastRunning();
                this.BeginInvoke(new MethodInvoker(() =>
                {
                    MsgCenter.SendMsg(MsgType.RUNINFO_RESULT, this, this.RunInfoCtl,
                                      Executor.Instance.FinishedBoardCount,
                                      Executor.Instance.FailedCount,
                                      Executor.Instance.CycleTime);
                }));
            };
            Executor.Instance.OnProgramAborted += () =>
            {
                BeginBroadcastIdle();
            };
            Executor.Instance.OnTimerSleeping += (currMills, waitMills) =>
            {
                this.BeginInvoke(new MethodInvoker(() =>
                {
                    new ShowTimerForm(currMills, waitMills).ShowDialog();
                }));
            };
        }
示例#10
0
 /// <summary>
 /// 发送消息
 /// </summary>
 /// <param UIName="msgType"></param>
 /// <param UIName="data"></param>
 protected void SendMsg(Enum msgType, object data = null)
 {
     MsgCenter.SendMsg(msgType, data);
 }