Exemplo n.º 1
0
        public override void Perform()
        {
            if (ControlService.SignCombo.Current == null)
            {
                MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.AddNewSignFirst));
                return;
            }

            SignInfo  sign      = ControlService.SignCombo.Current;
            BlankSign blankSign = new BlankSign();

            blankSign.Mode = 0;
            blankSign.Flag = 0;
            Cursor.Current = Cursors.WaitCursor;
            DataGate.Log.Info("Start Play.Content:blankSign.Mode=0,blankSign.Flag=1");
            sign.Controller.SendAsync(
                Id,
                p =>
            {
                Cursor.Current = Cursors.Default;
                if (!p.IsSuccessed)
                {
                    DataGate.Log.Error("Play failed.");
                    if (p.Packet.HasError)
                    {
                        log.Error(p.Packet.ActionError.Message);
                    }
                    if (p.Exception != null)
                    {
                        log.Error(p.Exception.Message, p.Exception);
                    }

                    // MsgBox.Error(Resources.Resource.GetString(Resources.Resource.Strings.SetUnBlankSignFailed));//"Unblank sign failed.");
                }
                else
                {
                    DataGate.Log.Info("Play successed.");
                    sign.IsBlankSign = true;
                    // MsgBox.Information(Resources.Resource.GetString(Resources.Resource.Strings.SetUnBlankSignSuccessed));//"Unblank sign successed.");
                    ActionHelper.OnBlankSign();    //true);
                }
            },
                blankSign);

            //sign.Controller.SendAsync(Id, p =>
            //{
            //    Cursor.Current = Cursors.Default;
            //    if (!p.IsSuccessed)
            //    {
            //        if (p.Packet.HasError)
            //            log.Error(p.Packet.ActionError.Message);
            //        if (p.Exception != null)
            //            log.Error(p.Exception.Message, p.Exception);

            //        MsgBox.Error("Blank sign failed.");
            //    }
            //});
        }
Exemplo n.º 2
0
        public override void Perform()
        {
            if (ControlService.SignCombo.Current == null)
            {
                MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.AddNewSignFirst));
                return;
            }

            SignInfo  sign      = ControlService.SignCombo.Current;
            BlankSign blankSign = new BlankSign();

            blankSign.Mode = 0;
            blankSign.Flag = 1;
            Cursor.Current = Cursors.WaitCursor;
            //Send BlankSign Command for Start stop
            DataGate.Log.Info("Start Stop.Content:blankSign.Mode=0,blankSign.Flag=0");
            sign.Controller.SendAsync(
                Id,
                p =>
            {
                Cursor.Current = Cursors.Default;
                if (!p.IsSuccessed)
                {
                    DataGate.Log.Error("Stop failed.");
                    if (p.Packet.HasError)
                    {
                        log.Error(p.Packet.ActionError.Message);
                    }
                    if (p.Exception != null)
                    {
                        log.Error(p.Exception.Message, p.Exception);
                    }

                    //MsgBox.Error(Resources.Resource.GetString(Resources.Resource.Strings.SetBlankSignFailed));//"Blank sign failed.");
                }
                else
                {
                    if (!ServiceManager.Get <bool>())
                    {
                        ServiceManager.Remove <bool>();
                        ServiceManager.Add <bool>(true);
                    }
                    //ControlService.CurrentClip.SetPicImageNull();

                    DataGate.Log.Info("Stop successed.");
                    sign.IsBlankSign = false;
                    //MsgBox.Information(Resources.Resource.GetString(Resources.Resource.Strings.SetBlankSignSuccessed));//"Blank sign successed");
                    ActionHelper.OnBlankSign();    //false);
                }
            },
                blankSign);
        }
Exemplo n.º 3
0
        public static void OnBlankSign()
        {
            SignInfo  sign      = ControlService.SignCombo.Current;
            BlankSign blankSign = new BlankSign();

            blankSign.Mode = 1;
            blankSign.Flag = -1;
            int flag = 0;

            LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] {
                new MenuCommand {
                    Command = MenuCommands.UnBlankSign, Caption = "Play", Enabled = false
                }
                , new MenuCommand {
                    Command = MenuCommands.BlankSign, Caption = "Stop", Enabled = false
                }
            }));
            DataGate.Log.Info("Start get the  Sign state.Content:blankSign.Mode=1,blankSign.Flag=-1");
            if (sign.Controller.Connection.State == System.Communication.ConnectionState.Opened ||
                sign.Controller.Connection.User.Status == UserStatus.Online)
            {
                //Cursor.Current = Cursors.WaitCursor;

                sign.Controller.SendAsync(
                    Commands.BlankSign,
                    p =>
                {
                    //Cursor.Current = Cursors.Default;
                    if (!p.IsSuccessed)
                    {
                        DataGate.Log.Error("Get sign state failed");
                        //if (p.Packet.HasError)
                        //    log.Error(p.Packet.ActionError.Message);
                        //if (p.Exception != null)
                        //    log.Error(p.Exception.Message, p.Exception);
                        string caption       = "Stop";
                        MenuCommands command = MenuCommands.BlankSign;

                        LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] {
                            new MenuCommand {
                                Command = command, Caption = caption, Enabled = true
                            }
                        }));
                        //MsgBox.Error(Resources.Resource.GetString(Resources.Resource.Strings.SetBlankSignFailed));//"Blank sign failed.");
                    }
                    else
                    {
                        flag = p.Packet.Content.GetProperty <int>("Mode");
                        DataGate.Log.Info("Get sign state successed.Content:flag=" + flag);
                        string caption       = "Stop";
                        MenuCommands command = MenuCommands.BlankSign;
                        if (flag == 3 || flag == 4 || flag == 5)
                        {
                            sign.MessageStatus = "Stopped";
                            ControlService.CurrentClip.SetPicImageNull();
                            if (!ServiceManager.Get <bool>())
                            {
                                ServiceManager.Remove <bool>();
                                ServiceManager.Add <bool>(true);
                            }
                            caption = "Play";
                            command = MenuCommands.UnBlankSign;
                            LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] {
                                new MenuCommand {
                                    Command = command, Caption = caption, Enabled = true
                                }
                                , new MenuCommand {
                                    Command = MenuCommands.BlankSign, Caption = "Stop", Enabled = false
                                }
                            }));
                        }
                        else
                        {
                            if (ServiceManager.Get <bool>())
                            {
                                ServiceManager.Remove <bool>();
                                ServiceManager.Add <bool>(false);
                            }
                            switch (flag)
                            {
                            case 0:
                                sign.MessageStatus = "Playing";
                                break;

                            case 1:
                                sign.MessageStatus = "Live mode";
                                break;

                            case 2:
                                sign.MessageStatus = "Test Pattern";
                                break;
                            }
                            LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] {
                                new MenuCommand {
                                    Command = command, Caption = caption, Enabled = true
                                }
                                , new MenuCommand {
                                    Command = MenuCommands.UnBlankSign, Caption = "Play", Enabled = false
                                }
                            }));
                        }
                        ControlService.DashboardTree.PopulateTree();
                        //sign.IsBlankSign = false;
                        //MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.SetBlankSignSuccessed));//"Blank sign successed");
                        //ActionHelper.OnBlankSign(false);
                    }
                },
                    blankSign);
            }
        }