示例#1
0
 private void AddCommandIfNeeded(CommandCollection commands, CommonCommand commonCommand)
 {
     if (this.HasCommonCommand(commonCommand))
     {
         this.AddCommand(commands, commonCommand);
     }
 }
示例#2
0
    private void OnApplicationPause(bool pause)
    {
        BattleManager mgr = BattleManager.GetInst();

        if (mgr != null && mgr.IsBattleRun && pause)
        {
            BattleManager.GetInst().DisableHero(PlayerData.PlayerId);
            CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_HERO_FAILED, new ArrayList()
            {
                PlayerData.PlayerId
            });
        }
    }
示例#3
0
        private void HandleCommandClicked(object sender, CommandEventArgs e)
        {
            // what...
            CommonCommand command = ((Command)sender).CommonCommand;

            // get...
            CommandEventHandler handler = (CommandEventHandler)this.Handlers[command];

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#4
0
        private void AddCommand(CommandCollection commands, CommonCommand commonCommand)
        {
            if (commands == null)
            {
                throw new ArgumentNullException("commands	");
            }

            // create...
            Command command = new Command(commonCommand);

            command.Click += new CommandEventHandler(HandleCommandClicked);
            commands.Add(command);
        }
示例#5
0
        static void Main(string[] args)
        {
            Student student = new Student {
                Id = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString()
            };
            List <object> list = new List <object> {
                student
            };
            CommonCommand command = new CommonCommand(list, true, CommandEnum.Insert);

            Console.WriteLine(command.CommandId);
            //Console.WriteLine(command.Obj.GetType());
            Console.WriteLine(command.Sql);
        }
示例#6
0
        void ComboBox_commonSelectedIndexChanged(object sender, EventArgs e)
        {
            CommonCommand cc = allCC[comboBox_common.SelectedIndex];

            tb_common_cmd.Text = cc.cli;

            if (comboBox_common.SelectedIndex == 0)
            {
                tb_common_cmd.ReadOnly = false;
            }
            else
            {
                tb_common_cmd.ReadOnly = true;
            }
        }
示例#7
0
    public void OnPlatformLogin()
    {
        _loginParam = new ArrayList()
        {
            ApplicationConst.PlatformID,
            ApplicationConst.ChannelID,
            DeviceInfo.GetDeviceInfo(),
            System.Guid.NewGuid().ToString(),
            SystemInfo.deviceUniqueIdentifier,
            PlayerData.Account,
            PlayerData.Token
        };

        CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_LOGIN_LONG, _loginParam);
    }
示例#8
0
        void ComboBox_commonInit()
        {
            CommonCommand cc = new CommonCommand("Custom", "");

            allCC.Add(cc);
            cc = new CommonCommand("alarm", " journalctl -o short-precise -f | grep \" flexalarm\\[\"");
            allCC.Add(cc);
            cc = new CommonCommand("top all", " top -b");
            allCC.Add(cc);
//			cc = new CommonCommand("demo for loop","for((i=0; i<1;))do time;sleep 1;done;");
//			allCC.Add(cc);
//
            comboBox_common.DataSource    = allCC;
            comboBox_common.DisplayMember = "Name";
            comboBox_common.SelectedIndex = 0;
        }
示例#9
0
        public override void InitContextMenu()
        {
            base.InitContextMenu();

            PredicateMenuList.Clear();
            MainViewModel.Resource.ConditionPrototypeList.ForEach(v =>
            {
                var command = new CommonCommand((obj) =>
                {
                    var o = v.CreateInstance() as ICondition;
                    o.GetInstrumentList = () => {
                        var l = new List <IInstrument>();
                        foreach (var inst in InstrumentList)
                        {
                            l.Add(inst);
                        }
                        return(l);
                    };
                    o.AnalyseDataSource = CurrentDataSource;
                    var vm = new ConditionViewModel()
                    {
                        TargetObject = o
                    };
                    PredicateList.Add(vm);
                    TargetProject.PredicateList.Add(o);
                });
                command.Name            = "New " + v.Name;
                command.Memo            = v.Memo;
                command.ForegroundBrush = new SolidColorBrush(Colors.Blue);
                PredicateMenuList.Add(command);
            });

            var pcommand = new CommonCommand((obj) =>
            {
                if (CurrentPredicate != null && PredicateList.Contains(CurrentPredicate))
                {
                    PredicateList.Remove(CurrentPredicate);
                }
            });

            pcommand.Name            = "Delete Predicate";
            pcommand.Memo            = "Delete Current Predicate";
            pcommand.ForegroundBrush = new SolidColorBrush(Colors.Orange);
            PredicateMenuList.Add(pcommand);
        }
示例#10
0
        public virtual void InitContextMenu()
        {
            ConditionMenuList.Clear();
            MainViewModel.Resource.ConditionPrototypeList.ForEach(v =>
            {
                var command = new CommonCommand((obj) =>
                {
                    var o = v.CreateInstance() as ICondition;
                    o.GetInstrumentList = () => {
                        var l = new List <IInstrument>();
                        foreach (var inst in InstrumentList)
                        {
                            l.Add(inst);
                        }
                        return(l);
                    };

                    o.AnalyseDataSource = CurrentDataSource;
                    var vm = new ConditionViewModel()
                    {
                        TargetObject = o
                    };
                    ConditionList.Add(vm);
                    GetTargetProject().ConditionList.Add(o);
                });
                command.Name            = "New " + v.Name;
                command.Memo            = v.Memo;
                command.ForegroundBrush = new SolidColorBrush(Colors.Blue);
                ConditionMenuList.Add(command);
            });
            var dcommand = new CommonCommand((obj) =>
            {
                if (CurrentCondition != null && ConditionList.Contains(CurrentCondition))
                {
                    ConditionList.Remove(CurrentCondition);
                }
            });

            dcommand.Name            = "Delete Condition";
            dcommand.Memo            = "Delete Current Condition";
            dcommand.ForegroundBrush = new SolidColorBrush(Colors.Orange);
            ConditionMenuList.Add(dcommand);
        }
示例#11
0
        /// <summary>
        /// Initialises a new instance of the <see cref="MainWindowViewModel"/> class.
        /// </summary>
        /// <param name="unitsIoController"><
        /// Unit input output controller
        /// /param>
        /// <param name="unitsXmlIoController">
        /// Unit (xml) input output controller
        /// </param>
        /// <param name="firstExamples">
        /// First examples manager
        /// </param>
        public MainWindowViewModel(
            UnitsIOController unitsIoController,
            UnitsXmlIOController unitsXmlIoController,
            FirstExampleManager firstExamples)
        {
            this.unitsIoController            = unitsIoController;
            this.unitsXmlIoController         = unitsXmlIoController;
            this.firstExamples                = firstExamples;
            this.groupsAndClassesIoController = new GroupsAndClassesIOController();

            AddEditJnyDetailsCommand = new CommonCommand(this.ShowAddEditJnyDetailsWindow);
            AnalysisCommand          = new CommonCommand(this.ShowAnalysisWindow);
            ConfigurationCommand     = new CommonCommand(this.ShowConfigurationWindow);
            ExitCommand           = new CommonCommand(this.ExitProgram);
            OpenLogCommand        = new CommonCommand(this.ShowLog);
            OpenLogFolderCommand  = new CommonCommand(this.ShowLogFolder);
            ShowClassIndexCommand = new CommonCommand(this.ShowClassIndexWindow);
            ShowJnyDetailsCommand = new CommonCommand(this.ShowJnyDetailsWindow);
            ShowInputDataCommand  = new CommonCommand(this.ShowInputWindow);

            this.inputWindow = null;
        }
示例#12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 internal Command(CommonCommand commonCommand)
 {
     _commonCommand = commonCommand;
 }
示例#13
0
 internal CommonCommandEventArgs(CommonCommand command)
 {
     _command = command;
 }
示例#14
0
        private void AddHandler(CommonCommand command, CommandEventHandler handler)
        {
            CommandEventHandler existing = (CommandEventHandler)this.Handlers[command];

            this.Handlers[command] = (CommandEventHandler)Delegate.Combine(existing, handler);
        }
示例#15
0
        private void RemoveHandler(CommonCommand command, CommandEventHandler handler)
        {
            CommandEventHandler existing = (CommandEventHandler)this.Handlers[command];

            this.Handlers[command] = (CommandEventHandler)Delegate.Remove(existing, handler);
        }
示例#16
0
        private string GetCommonCommandName(bool shortName)
        {
            switch (CommonCommand)
            {
            case CommonCommand.Delete:
                if (shortName)
                {
                    return("Delete");
                }
                else
                {
                    return(@"Edit\Delete");
                }

            case CommonCommand.Open:
                if (shortName)
                {
                    return("Open");
                }
                else
                {
                    return(@"File\Open");
                }

            case CommonCommand.Properties:
                if (shortName)
                {
                    return("Properties");
                }
                else
                {
                    return(@"View\Properties");
                }

            default:
                throw new NotSupportedException(string.Format("Cannot handle '{0}' ({1}).", CommonCommand, CommonCommand.GetType()));
            }
        }
示例#17
0
 public void CommonCommandConstructorTest()
 {
     CommonCommand target = new CommonCommand();
     //Assert.Inconclusive("TODO: Implement code to verify target");
 }
示例#18
0
 private bool HasCommonCommand(CommonCommand command)
 {
     return(this.Handlers.Contains(command));
 }