private void AddCommandIfNeeded(CommandCollection commands, CommonCommand commonCommand) { if (this.HasCommonCommand(commonCommand)) { this.AddCommand(commands, commonCommand); } }
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 }); } }
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); } }
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); }
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); }
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; } }
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); }
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; }
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); }
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); }
/// <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; }
/// <summary> /// Constructor. /// </summary> internal Command(CommonCommand commonCommand) { _commonCommand = commonCommand; }
internal CommonCommandEventArgs(CommonCommand command) { _command = command; }
private void AddHandler(CommonCommand command, CommandEventHandler handler) { CommandEventHandler existing = (CommandEventHandler)this.Handlers[command]; this.Handlers[command] = (CommandEventHandler)Delegate.Combine(existing, handler); }
private void RemoveHandler(CommonCommand command, CommandEventHandler handler) { CommandEventHandler existing = (CommandEventHandler)this.Handlers[command]; this.Handlers[command] = (CommandEventHandler)Delegate.Remove(existing, handler); }
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())); } }
public void CommonCommandConstructorTest() { CommonCommand target = new CommonCommand(); //Assert.Inconclusive("TODO: Implement code to verify target"); }
private bool HasCommonCommand(CommonCommand command) { return(this.Handlers.Contains(command)); }