public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj ) { if ( command.ObjectTypes == ObjectTypes.Items ) return; // sanity check obj = from; }
public override void Process( Mobile from, BaseCommand command, string[] args ) { RangeCommandImplementor impl = RangeCommandImplementor.Instance; if ( impl == null ) return; impl.Process( 18, from, command, args ); }
public static void ElseWriteWarning(this Version version, BaseCommand command, string parameter, bool parameterScope) { if (version != null) { string unit = parameterScope ? "parameter" : "command"; command.WriteWarning( $"The \"{parameter}\" {unit} is not supported on this version of Sitecore due to platform limitations. This parameter is supported starting from Sitecore Version {version.Major}.{version.Minor}"); } }
public void GoToAnotherLevel(Transform startPoint) { FlushPreviousCommand(); BaseCommand command = _moveToLevelCommand; command.enabled = true; command.Init(_animator, startPoint.position, test); _currentCommand = command; LookAt(startPoint.position); }
public TemplateSelectorPageModel() { ItemTappedCommand = new BaseCommand((param) => { var item = LastTappedItem as SimpleItem; if (item != null) System.Diagnostics.Debug.WriteLine("Tapped {0}", item.Title); }); }
public override void Process( Mobile from, BaseCommand command, string[] args ) { AreaCommandImplementor impl = AreaCommandImplementor.Instance; if ( impl == null ) return; Map map = from.Map; if ( map == null || map == Map.Internal ) return; impl.OnTarget( from, map, Point3D.Zero, new Point3D( map.Width - 1, map.Height - 1, 0 ), new object[] { command, args } ); }
/// <summary> /// Are about to send a new message /// </summary> /// <param name="message">Message to send</param> /// <remarks> /// Can be used to prepare the next message. for instance serialize it etc. /// </remarks> /// <exception cref="NotSupportedException">Message is of a type that the encoder cannot handle.</exception> public void Prepare(object message) { if (!(message is BaseCommand)) { // throw new InvalidOperationException("This encoder only supports messages deriving from 'BaseCommand'"); return; } _message = (BaseCommand) message; string command = _message.ToString(); if (string.IsNullOrEmpty(command)) throw new InvalidOperationException("The encoder cannot encode the message. Nothing to encode."); string trimmed = command.Trim(); if (!trimmed.EndsWith(MESSAGE_END_STRING)) trimmed += MESSAGE_END_STRING; var len = Encoding.UTF8.GetByteCount(trimmed); Encoding.UTF8.GetBytes(trimmed, 0, trimmed.Length, _buffer, 0); _bytesToSend = len; _offset = 0; }
public void Process( int range, Mobile from, BaseCommand command, string[] args ) { AreaCommandImplementor impl = AreaCommandImplementor.Instance; if ( impl == null ) return; Map map = from.Map; if ( map == null || map == Map.Internal ) return; Point3D start = new Point3D( from.X - range, from.Y - range, from.Z ); Point3D end = new Point3D( from.X + range, from.Y + range, from.Z ); impl.OnTarget( from, map, start, end, new object[] { command, args } ); }
public override bool MayTrigger(CmdTrigger<ToolCmdArgs> trigger, BaseCommand<ToolCmdArgs> cmd, bool silent) { if (cmd is VersionSubCmd) { var versionCmd = (VersionSubCmd) cmd; if (versionCmd.RequiresClient) { if (!Directory.Exists(ToolConfig.WoWDir)) { if (!silent) { trigger.Reply("Invalid Client directory. Please use the Client-command to change it: {0}", ToolConfig.WoWDir); } return false; } } } return base.MayTrigger(trigger, cmd, silent); }
/// <summary> /// Constructor. /// </summary> public MainViewmodel() { #region Bindable properties //TODO: Assign default values to the bindable properties defined above SampleProperty = 1; #endregion #region Bindable commands //TODO: Assign local methods to the bindable commands defined above SampleCommand = new BaseCommand(SampleMethod); #endregion //dynamic obj = new SampleModel(); //obj.member1 = 20; }
private static void Go_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; if (e.Length == 0) { GoGump.DisplayTo(from); return; } if (e.Length == 1) { try { int ser = e.GetInt32(0); IEntity ent = World.FindEntity(ser); if (ent is Item) { Item item = (Item)ent; Map map = item.Map; Point3D loc = item.GetWorldLocation(); Mobile owner = item.RootParent as Mobile; if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible(from, owner) /* !from.CanSee( owner )*/) { from.SendMessage("You can not go to what you can not see."); return; } else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel) { from.SendMessage("You can not go to what you can not see."); return; } else if (!FixMap(ref map, ref loc, item)) { from.SendMessage("That is an internal item and you cannot go to it."); return; } from.MoveToWorld(loc, map); return; } else if (ent is Mobile) { Mobile m = (Mobile)ent; Map map = m.Map; Point3D loc = m.Location; Mobile owner = m; if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible(from, owner) /* !from.CanSee( owner )*/) { from.SendMessage("You can not go to what you can not see."); return; } else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel) { from.SendMessage("You can not go to what you can not see."); return; } else if (!FixMap(ref map, ref loc, m)) { from.SendMessage("That is an internal mobile and you cannot go to it."); return; } from.MoveToWorld(loc, map); return; } else { string name = e.GetString(0); Map map; for (int i = 0; i < Map.AllMaps.Count; ++i) { map = Map.AllMaps[i]; if (map.MapIndex == 0x7F || map.MapIndex == 0xFF) { continue; } if (Insensitive.Equals(name, map.Name)) { from.Map = map; return; } } Dictionary <string, Region> list = from.Map.Regions; foreach (KeyValuePair <string, Region> kvp in list) { Region r = kvp.Value; if (Insensitive.Equals(r.Name, name)) { from.Location = new Point3D(r.GoLocation); return; } } for (int i = 0; i < Map.AllMaps.Count; ++i) { Map m = Map.AllMaps[i]; if (m.MapIndex == 0x7F || m.MapIndex == 0xFF || from.Map == m) { continue; } foreach (Region r in m.Regions.Values) { if (Insensitive.Equals(r.Name, name)) { from.MoveToWorld(r.GoLocation, m); return; } } } if (ser != 0) { from.SendMessage("No object with that serial was found."); } else { from.SendMessage("No region with that name was found."); } return; } } catch { } from.SendMessage("Region name not found"); } else if (e.Length == 2 || e.Length == 3) { Map map = from.Map; if (map != null) { try { /* * This to avoid being teleported to (0,0) if trying to teleport * to a region with spaces in its name. */ int x = int.Parse(e.GetString(0)); int y = int.Parse(e.GetString(1)); int z = (e.Length == 3) ? int.Parse(e.GetString(2)) : map.GetAverageZ(x, y); from.Location = new Point3D(x, y, z); } catch { from.SendMessage("Region name not found."); } } } else if (e.Length == 6) { Map map = from.Map; if (map != null) { Point3D p = Sextant.ReverseLookup(map, e.GetInt32(3), e.GetInt32(0), e.GetInt32(4), e.GetInt32(1), Insensitive.Equals(e.GetString(5), "E"), Insensitive.Equals(e.GetString(2), "S")); if (p != Point3D.Zero) { from.Location = p; } else { from.SendMessage("Sextant reverse lookup failed."); } } } else { from.SendMessage("Format: Go [name | serial | (x y [z]) | (deg min (N | S) deg min (E | W)]"); } }
private void InitializeCommands() { OKCommand = new BaseCommand(AddTaskMethod); }
/// <summary> /// Task that keeps pushing model updates to the client /// </summary> /// <returns>Task that represents the lifecycle of a connection</returns> public override async Task Process() { try { // First send over the full machine model JObject currentObject, lastObject, patch = null; lock (_model) { currentObject = lastObject = JObject.FromObject(_model, JsonHelper.DefaultSerializer); _model.Messages.Clear(); } await Connection.Send(currentObject.ToString(Formatting.None) + "\n"); do { // Wait for an acknowledgement from the client if anything was sent before if (patch == null || patch.HasValues) { BaseCommand command = await Connection.ReceiveCommand(); if (command == null) { return; } if (!SupportedCommands.Contains(command.GetType())) { throw new ArgumentException($"Invalid command {command.Command} (wrong mode?)"); } } // Wait for another update if (_mode == SubscriptionMode.Patch) { lastObject = currentObject; } await _updateAvailableEvent.WaitAsync(Program.CancelSource.Token); // Get the updated object model lock (_model) { using (Model.Provider.AccessReadOnly()) { // NB: This could be further improved so that all the JSON tokens are written via the INotifyPropertyChanged events _model.Assign(Model.Provider.Get); } lock (_messages) { ListHelpers.AssignList(_model.Messages, _messages); _messages.Clear(); } currentObject = JObject.FromObject(_model, JsonHelper.DefaultSerializer); } // Provide the model update if (_mode == SubscriptionMode.Full) { // Send the entire object model in Full mode await Connection.Send(currentObject.ToString(Formatting.None) + "\n"); } else { // Only create a diff in Patch mode patch = JsonHelper.DiffObject(lastObject, currentObject); // Compact the job layers. There is no point in sending them all every time an update occurs if (patch.ContainsKey("job") && patch.Value <JObject>("job").ContainsKey("layers")) { JArray layersArray = patch["job"].Value <JArray>("layers"); while (layersArray.Count > 0 && !layersArray[0].HasValues) { layersArray.RemoveAt(0); } } // Send the patch unless it is empty if (patch.HasValues) { await Connection.Send(patch.ToString(Formatting.None) + "\n"); } } } while (!Program.CancelSource.IsCancellationRequested); } finally { lock (_subscriptions) { _subscriptions.Remove(this); } } }
/// <summary> /// Creates a new instance of an System.Data.IDbDataParameter object. /// </summary> public IDbDataParameter CreateParameter() { return(BaseCommand.CreateParameter()); }
/// <summary>会议TabItem点击事件</summary> /// <param name="sender"></param> /// <param name="e"></param> public void MeetingTabItem_Click(object sender, EventArgs e) { GetCurrentMeetingModel(); if (_currentSelectedMeetingModel.MeetingType == MeetingGroupModel.EnumMeetingType.Lemc) { // Pub._talkControl.CurrentNormalCMD = PublicEnums.EnumNormalCmd.MakeLemcMeeting; _baseCommand = new MakeMeetingCommand(); _baseCommand.talkControl = Pub._talkControl; Pub._meetingManage.SetControlIsCanSelect(true); } else { Pub._meetingManage.SetControlIsCanSelect(false); } Pub._talkControl.CurrentMeetingID = _currentSelectedMeetingModel.MeetingID; switch (_currentSelectedMeetingModel.MeetingState) { case MeetingGroupModel.EnumMeetingState.Running: _meetingCommand.btnMeetingBeginEnd.Text = "结束会议"; break; case MeetingGroupModel.EnumMeetingState.Off: _meetingCommand.btnMeetingBeginEnd.Text = "开始会议"; break; case MeetingGroupModel.EnumMeetingState.Ready: _meetingCommand.btnMeetingBeginEnd.Text = "结束会议"; break; default: break; } switch (_currentSelectedMeetingModel.MeetingType) { case MeetingGroupModel.EnumMeetingType.Formal: _meetingCommand.btnDeleteMeetingMember.Text = "挂断"; break; case MeetingGroupModel.EnumMeetingType.Temp: _meetingCommand.btnMeetingBeginEnd.Text = "结束会议"; break; case MeetingGroupModel.EnumMeetingType.Lemc: //if (_currentSelectedMeetingModel.MeetingState == MeetingGroupModel.EnumMeetingState.Running) //{ // _meetingCommand.btnDeleteMeetingMember.Text = "挂断"; //} _meetingCommand.btnDeleteMeetingMember.Text = "踢出"; break; default: break; } }
private BaseCommand CreateCommand(List <byte> CommandBuffer) { byte[] cmdBytes = null; lock (CommandBuffer) { if (CommandBuffer.Count < 9) { Logger.Instance().Error("CreateCommand() Error! CommandBuffer.Count<10"); return(null); } cmdBytes = new byte[CommandBuffer.Count]; CommandBuffer.CopyTo(cmdBytes); } byte msgID = cmdBytes[1]; BaseCommand cmd = CommandFactory.CreateCommand(msgID); if (cmd == null) { string msg = string.Format("CreateCommand() Error! MessageID={0}", msgID); Logger.Instance().Error(msg); return(null); } cmd.Direction = cmdBytes[0]; cmd.Channel = cmdBytes[2]; //分析命令数据长度 cmd.PayloadLength = cmdBytes[3]; cmd.PayloadLengthReverse = cmdBytes[4]; //分离出最后4字节的Checksum cmd.Checksum = (uint)(cmdBytes[cmdBytes.Length - 1] << 24); cmd.Checksum += (uint)(cmdBytes[cmdBytes.Length - 2] << 16); cmd.Checksum += (uint)(cmdBytes[cmdBytes.Length - 3] << 8); cmd.Checksum += (uint)(cmdBytes[cmdBytes.Length - 4]); //重新计算泵端传入的数据checksum,如果对应不上,记录日志,由上层应用酌情处理,但不能作超时处理 uint checksum = CRC32.CalcCRC32Partial(cmdBytes, cmdBytes.Length - 4, CRC32.CRC32_SEED); checksum ^= CRC32.CRC32_SEED; //在DUBUG状态下就不要去检查checksum #if !DEBUG if ((cmd.Checksum ^ checksum) != 0) { cmd.ErrorMsg = "Checksum Error"; string buffer2String = BytesToString(cmdBytes, 0, cmdBytes.Length); Logger.Instance().ErrorFormat("ProtocolEngine::CreateCommand() Checksum error, buffer={0}", buffer2String); } #endif //将PayloadData提取出来,方便生成字段 byte[] arrFieldsBuf = new byte[cmd.PayloadLength]; int index = cmdBytes.Length - arrFieldsBuf.Length - 4; if (index <= 0) { string msg = string.Format("CreateCommand() Error! index<=0 cmdBytes.Length={0} arrFieldsBuf.Length={1}", cmdBytes.Length, arrFieldsBuf.Length); Logger.Instance().Error(msg); return(null); } Array.Copy(cmdBytes, index, arrFieldsBuf, 0, arrFieldsBuf.Length); //将字段填进命令 cmd.SetBytes(arrFieldsBuf); return(cmd); }
public bool SendNewCommand(BaseCommand newCommand) { SendBuffer.Clear(); string newXmlMessage = newCommand.Serialize(); SendBuffer.Append((char)newCommand.ID); SendBuffer.Append((char)newXmlMessage.Length); SendBuffer.Append(newXmlMessage); counterOfSentCommand++; return Send(SendBuffer.ToString()); }
/// <summary> /// /// </summary> /// <param name="p_cmd"></param> /// <param name="p_args"></param> public CmdAction(BaseCommand p_cmd, object p_args) { _cmd = p_cmd; _args = p_args; }
/// <summary> /// 发送队列线程函数 /// </summary> private void SendCommandProc() { //线程开始时,设置有信号状态 //m_EventSendCommand.Reset(); long ip = 0; while (m_Keeping && m_SemCommand != null) { if (!m_SemCommand.WaitOne(m_SemWaitSeconds * 1000)) //队列中有新命令加入时执行 { continue; } if (m_Queue.Count > 0) { BaseCommand currentCommand = null; lock (m_Queue) { currentCommand = m_Queue.Peek(ref ip); } if (currentCommand == null) { continue; } bool succeed = false; List <byte> cmdByteList = currentCommand.GetBytes(); byte[] commandBytes = new byte[cmdByteList.Count]; cmdByteList.CopyTo(commandBytes); byte[] charCommandBytes = Hex2Char(commandBytes); if (m_Device != null && m_Device.IsStart()) { if (currentCommand.RemoteSocket == null) { Logger.Instance().Error("SendCommandProc() currentCommand.RemoteSocket is null"); } else { succeed = m_Device.SendAsyncEvent(currentCommand.RemoteSocket, charCommandBytes, 0, charCommandBytes.Length); } if (null != ShowBytesOnUI) { ShowBytesOnUI(this, new SendOrReceiveBytesArgs(charCommandBytes)); } } else { succeed = false; Logger.Instance().Error("Device is closed"); } lock (m_Queue) { m_Queue.Dequeue(ip, currentCommand); //不管发送是否成功,都要移除 } if (succeed && currentCommand.Direction == 0) //如果只是对WIFI模块的命令响应,就不用加入等待回应队列了 { lock (m_WaitQueue) { m_WaitQueue.Enqueue(ip, currentCommand); } } //bool bRet = m_EventSendCommand.WaitOne(m_Timeout); //这里不用等待泵端回应,直接发送命令 } } }
public override void OnResponse(NetState sender, RelayInfo info) { object toSet; bool shouldSet, shouldSend = true; object viewProps = null; switch (info.ButtonID) { case 0: // closed { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); toSet = null; shouldSet = false; shouldSend = false; break; } case 1: // Change by Target { m_Mobile.Target = new SetObjectTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List); toSet = null; shouldSet = false; shouldSend = false; break; } case 2: // Change by Serial { toSet = null; shouldSet = false; shouldSend = false; m_Mobile.SendMessage("Enter the serial you wish to find:"); m_Mobile.Prompt = new InternalPrompt(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List); break; } case 3: // Nullify { toSet = null; shouldSet = true; break; } case 4: // View Properties { toSet = null; shouldSet = false; object obj = m_Property.GetValue(m_Object, null); if (obj == null) { m_Mobile.SendMessage("The property is null and so you cannot view its properties."); } else if (!BaseCommand.IsAccessible(m_Mobile, obj)) { m_Mobile.SendMessage("You may not view their properties."); } else { viewProps = obj; } break; } default: { toSet = null; shouldSet = false; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet == null?"(null)":toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List)); } if (viewProps != null) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, viewProps)); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!BaseCommand.IsAccessible(from, m_Object)) { from.SendMessage("You may no longer access their properties."); return; } switch (info.ButtonID) { case 0: // Closed { if (m_Stack != null && m_Stack.Count > 0) { StackEntry entry = (StackEntry)m_Stack.Pop(); from.SendGump(new PropertiesGump(from, entry.m_Object, m_Stack, null)); } } break; case 1: // Previous { if (m_Page > 0) { from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1)); } } break; case 2: // Next { if ((m_Page + 1) * EntryCount < m_List.Count) { from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1)); } } break; default: { int index = (m_Page * EntryCount) + (info.ButtonID - 3); if (index >= 0 && index < m_List.Count) { PropertyInfo prop = m_List[index] as PropertyInfo; if (prop == null) { return; } CPA attr = GetCPA(prop); if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly) { return; } Type type = prop.PropertyType; if (IsType(type, _TypeOfMobile) || IsType(type, _TypeOfItem) || type.IsAssignableFrom(typeof(IDamageable))) { from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List)); } else if (IsType(type, _TypeOfType)) { from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List); } else if (IsType(type, _TypeOfPoint3D)) { from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, _TypeOfPoint2D)) { from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, _TypeOfTimeSpan)) { from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsCustomEnum(type)) { from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type))); } else if (_TypeOfIDynamicEnum.IsAssignableFrom(type)) { from.SendGump( new SetCustomEnumGump( prop, from, m_Object, m_Stack, m_Page, m_List, ((IDynamicEnum)prop.GetValue(m_Object, null)).Values)); } else if (IsType(type, _TypeOfEnum)) { from.SendGump( new SetListOptionGump( prop, from, m_Object, m_Stack, m_Page, m_List, Enum.GetNames(type), GetObjects(Enum.GetValues(type)))); } else if (IsType(type, _TypeOfBool)) { from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues)); } else if (IsType(type, _TypeOfString) || IsType(type, _TypeOfReal) || IsType(type, _TypeOfNumeric) || IsType(type, _TypeOfText)) { from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, _TypeOfPoison)) { from.SendGump( new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues)); } else if (IsType(type, _TypeofDateTime)) { from.SendGump(new SetDateTimeGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, _TypeOfMap)) { //Must explicitly cast collection to avoid potential covariant cast runtime exception object[] values = Map.GetMapValues().Cast <object>().ToArray(); from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), values)); } else if (IsType(type, _TypeOfSkills) && m_Object is Mobile mobile) { from.SendGump(new PropertiesGump(from, mobile, m_Stack, m_List, m_Page)); from.SendGump(new SkillsGump(from, mobile)); } else if (IsType(type, _TypeofColor)) { from.SendGump(new SetColorGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, _TypeofAccount)) { from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page)); } else if (HasAttribute(type, _TypeOfPropertyObject, true)) { object obj = prop.GetValue(m_Object, null); from.SendGump( obj != null ? new PropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop)) : new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page)); } } } break; } }
public void SetNextAction(BaseCommand action) { }
private void InitializeCommands() { OKCommand = new BaseCommand(GetCropMethod); }
private Task <CommandResult <string> > Execute(BaseCommand <string> command) { CommandExecutionContext context = new CommandExecutionContext(); return(context.Execute(command)); }
private void test() { FlushPreviousCommand(); _idleCommand.enabled = true; _currentCommand = _idleCommand; }
static void Main(string[] args) { var assembly = Assembly.GetExecutingAssembly(); var attr = assembly.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false); var fvi = FileVersionInfo.GetVersionInfo(assembly.Location); _version = fvi.ProductVersion; if (attr.Length > 0) { var aca = (AssemblyConfigurationAttribute)attr[0]; _sha = aca.Configuration; _fullVersion = $"{_version} ({_sha})"; } else { _fullVersion = fvi.ProductVersion; _sha = ""; } CultureUtil.NormalizeUICulture(); _commandLineArgs = args; // setup logger var assemblyPath = Path.GetDirectoryName(new Uri(assembly.CodeBase).LocalPath); var logConfigPath = Path.Combine(assemblyPath, "dmdext.log.config"); if (File.Exists(logConfigPath)) { LogManager.Configuration = new XmlLoggingConfiguration(logConfigPath, true); #if !DEBUG LogManager.Configuration.AddTarget("memory", MemLogger); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, MemLogger)); LogManager.ReconfigExistingLoggers(); #endif } #if !DEBUG else { SimpleConfigurator.ConfigureForTargetLogging(MemLogger, LogLevel.Debug); } #endif AssertDotNetVersion(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // enable exit handler _handler += ExitHandler; SetConsoleCtrlHandler(_handler, true); var invokedVerb = ""; object invokedVerbInstance = null; var options = new Options(); if (!CommandLine.Parser.Default.ParseArgumentsStrict(args, options, (verb, subOptions) => { // if parsing succeeds the verb name and correct instance // will be passed to onVerbCommand delegate (string,object) invokedVerb = verb; invokedVerbInstance = subOptions; })) { Environment.Exit(CommandLine.Parser.DefaultExitCodeFail); } try { Logger.Info("Launching console tool v{0}", _fullVersion); options.Validate(); var cmdLineOptions = (BaseOptions)invokedVerbInstance; var config = cmdLineOptions.DmdDeviceIni == null ? (IConfiguration)cmdLineOptions : new Configuration(cmdLineOptions.DmdDeviceIni); //BaseOptions baseOptions; switch (invokedVerb) { case "mirror": _command = new MirrorCommand(config, (MirrorOptions)cmdLineOptions); break; case "play": _command = new PlayCommand(config, (PlayOptions)cmdLineOptions); break; case "test": _command = new TestCommand(config); break; default: throw new ArgumentOutOfRangeException(); } var renderer = _command.GetRenderGraph(); if (config.Bitmap.Enabled) { (renderer as RenderGraph)?.Destinations.Add(new BitmapOutput(config.Bitmap.Path)); } if (config.PinUp.Enabled) { (renderer as RenderGraph)?.Destinations.Add(new PinUpOutput(config.PinUp.GameName)); } _command.Execute(() => { if (config != null && config.Global.QuitWhenDone) { Logger.Info("Exiting."); _command?.Dispose(); Environment.Exit(0); } }, ex => { Logger.Error("Error: {0}", ex.Message); _command?.Dispose(); Environment.Exit(0); }); if (config.Global.QuitAfter > -1) { Logger.Info("Quitting in {0}ms...", config.Global.QuitAfter); Observable .Return(Unit.Default) .Delay(TimeSpan.FromMilliseconds(config.Global.QuitAfter)) .Subscribe(_ => WinApp.Dispatcher.Invoke(() => WinApp.Shutdown())); } else { Logger.Info("Press CTRL+C to close."); } WinApp.Run(); } catch (DeviceNotAvailableException e) { Logger.Error("Device {0} is not available.", e.Message); } catch (NoRenderersAvailableException) { Logger.Error("No output devices available."); } catch (InvalidOptionException e) { Logger.Error("Invalid option: {0}", e.Message); } catch (FileNotFoundException e) { Logger.Error(e.Message); Logger.Info("Try installing the Visual C++ Redistributable for Visual Studio 2015 if you haven't so already:"); Logger.Info(" https://www.microsoft.com/en-us/download/details.aspx?id=48145"); } catch (UnknownFormatException e) { Logger.Error(e.Message); } catch (WrongFormatException e) { Logger.Error(e.Message); } catch (UnsupportedResolutionException e) { Logger.Error(e.Message); } catch (InvalidFolderException e) { Logger.Error(e.Message); } catch (RenderException e) { Logger.Error(e.Message); } catch (NoRawDestinationException e) { Logger.Error(e.Message); } catch (MultipleRawSourcesException e) { Logger.Error(e.Message); } catch (ProPinballSlaveException e) { Logger.Error(e.Message); } catch (IncompatibleRenderer e) { Logger.Error(e.Message); } catch (IncompatibleSourceException e) { Logger.Error(e.Message); } catch (IniNotFoundException e) { Logger.Error(e.Message); } catch (CropRectangleOutOfRangeException e) { Logger.Error(e.Message); Logger.Error("Are you running PinballFX2 in cabinet mode with the DMD at 1040x272?"); } finally { Process.GetCurrentProcess().Kill(); } }
/// <summary>命令条 点击按钮处理事件</summary> /// <param name="sender"></param> /// <param name="cmd"></param> void command_OnButtonClick(object sender, CommControl.PublicEnums.EnumNormalCmd cmd) { Pub._meetingManage.SetControlIsCanSelect(false); //if (cmd!= PublicEnums.EnumNormalCmd.MeetingGroupOperate) //{ // Pub._talkControl.NumberList.Clear(); //} Pub._talkControl.CurrentNormalCMD = cmd; if (_isDispatchTabPage == false)//为会议页 { GetCurrentMeetingModel(); } switch (cmd) { case CommControl.PublicEnums.EnumNormalCmd.None: Pub._memberManage.ShowAllMember(); break; case PublicEnums.EnumNormalCmd.GroupCall: if (_dispatchCommand.btnGroupCall.Image != null) { bc_OnMsg("组呼失败"); } else { #region 开始组呼 _baseCommand = new GroupCallCommand(); Pub._talkControl.NumberList.Clear(); //自动获取类型设置不同的个数 TalkControl.EnumEquipmentType et = Pub._talkControl.GetEquipmentType(); int count = 16; switch (et) { case TalkControl.EnumEquipmentType.T_HT8000B: count = 32; break; case TalkControl.EnumEquipmentType.T_HT8000C: count = 16; break; case TalkControl.EnumEquipmentType.T_HT8000D: count = 16; break; case TalkControl.EnumEquipmentType.T_HT8000E: count = 16; break; default: break; } int i = 0; foreach (SingleUserControl item in Pub._memberManage._lstGroup[_memberGroupIndex].lstControl) { if (item.UserLineStatus == TalkControl.EnumUserLineStatus.Idle) { i++; if (i > count) { break; } Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = item.Number, vc_Name = item.MemberName }); } } _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _currentSelectedMeetingModel.DispatchNumber = Pub._talkControl.CurrentDispatchNumber; _currentSelectedMeetingModel.MeetingID = 0; if (_baseCommand.Begin() == false) { } else { } Pub._talkControl.NumberList.Clear(); Pub._talkControl.CurrentNormalCMD = PublicEnums.EnumNormalCmd.None; #endregion } break; case CommControl.PublicEnums.EnumNormalCmd.Call: Pub._memberManage.SetFilterType(EnumFilterType.CanMakeCall); break; case CommControl.PublicEnums.EnumNormalCmd.MakeLemcMeeting: break; case CommControl.PublicEnums.EnumNormalCmd.Handup: Pub._memberManage.SetFilterType(EnumFilterType.CanHandup); break; case CommControl.PublicEnums.EnumNormalCmd.Insert: Pub._memberManage.SetFilterType(EnumFilterType.CanInsert); break; case CommControl.PublicEnums.EnumNormalCmd.InsteadAnswer: Pub._memberManage.SetFilterType(EnumFilterType.CanInsteadAnswer); break; case CommControl.PublicEnums.EnumNormalCmd.Keep: Pub._memberManage.SetFilterType(EnumFilterType.CanHolding); if (_dispatchCommand.btnKeep.Image != null) { superTabControlDispatch.SelectedTab = stiAllMember; } break; case CommControl.PublicEnums.EnumNormalCmd.SelectAnser: break; case CommControl.PublicEnums.EnumNormalCmd.Transfer: Pub._memberManage.SetFilterType(EnumFilterType.CanTranfer); break; case CommControl.PublicEnums.EnumNormalCmd.SnatchCall: Pub._memberManage.SetFilterType(EnumFilterType.CanSnatch); break; case CommControl.PublicEnums.EnumNormalCmd.Listen: Pub._memberManage.SetFilterType(EnumFilterType.CanListen); if (_dispatchCommand.btnListen.Image != null) { superTabControlDispatch.SelectedTab = stiAllMember; } break; case CommControl.PublicEnums.EnumNormalCmd.AddMeetingMember://邀请会议成员 Pub.CanDestroyControl = false; this._isCanAddMember = false; Pub._pageControl._columnCount = 4; Pub._pageControl._rowCount = 5; Pub._pageControl.GetSingleControlSize(); _selectMemberForm = new FormSelectMeetingMember(this, _currentSelectedMeetingModel.MeetingState == MeetingGroupModel.EnumMeetingState.Running); _selectMemberForm.AddPageControl(Pub._pageControl); Pub._pageControl.LoadData(); Pub._talkControl.NumberList.Clear(); foreach (SingleUserControl item in _currentSelectedMeetingModel.lstControl) { if (item.UserLineStatus == TalkControl.EnumUserLineStatus.Idle) { Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = item.Number, vc_Name = item.MemberName }); } } if (_currentSelectedMeetingModel.MeetingState == MeetingGroupModel.EnumMeetingState.Running) { Pub._talkControl.NumberList.Clear(); } Pub._meetingManage.SetControlIsCanSelect(true); Pub._currentSelectMeetingMemberCount = _currentSelectedMeetingModel.lstControl.Count; if (Pub._currentSelectMeetingMemberCount >= Pub._maxMeetingMemberCount) { CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("当前会议内成员数已达到上限{0}个", Pub._maxMeetingMemberCount), "会议提示"); } else { if (_selectMemberForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (DB_Talk.Model.m_Member item in Pub._talkControl.NumberList) { #region 手动增加空闲的手柄进待选的成员里 if (cLeft.Number != item.i_Number && cRight.Number != item.i_Number) { Pub._meetingManage.AddMeetingMember(0, _currentSelectedMeetingModel.MeetingID, item.i_Number.Value, _currentSelectedMeetingModel.GroupName); } #endregion } //会议开始的进行邀请命令 if (_currentSelectedMeetingModel.MeetingState == MeetingGroupModel.EnumMeetingState.Running) { //foreach (DB_Talk.Model.m_Member item in Pub._talkControl.NumberList) //{ // SingleUserControl sc = Pub._memberManage.GetSingleControl(item.i_Number.Value); // if (sc != null) // { // _baseCommand = new AddMeetingMemberCommand(); // _baseCommand.MemberControl = sc; // _baseCommand.talkControl = Pub._talkControl; // _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); // _baseCommand.Begin(); // } //} //////////////////// _baseCommand = new AddMeetingMemberCommand(); _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); } } } Pub._pageControl.ShowAllMember(); Pub._meetingManage.SetControlIsCanSelect(false); Pub._meetingManage.SetControlChecked(false); this._isCanAddMember = true; Pub.CanDestroyControl = true; break; case CommControl.PublicEnums.EnumNormalCmd.NoSpeekMeeting: break; case CommControl.PublicEnums.EnumNormalCmd.OkSpeekMeeting: break; case CommControl.PublicEnums.EnumNormalCmd.IsolateMeeting: break; case CommControl.PublicEnums.EnumNormalCmd.UnIsolateMeeting: break; case CommControl.PublicEnums.EnumNormalCmd.DeleteMeetingMember: break; case CommControl.PublicEnums.EnumNormalCmd.EndMeeting: break; case CommControl.PublicEnums.EnumNormalCmd.BeginRecord: if (_dispatchCommand.btnRecord.Image != null) { superTabControlDispatch.SelectedTab = stiAllMember; } break; case CommControl.PublicEnums.EnumNormalCmd.EndRecord: break; case CommControl.PublicEnums.EnumNormalCmd.MeetingGroupOperate: #region 会议操作 #region 初始操作 _meetingCommand.btnMeetingBeginEnd.Checked = false; if (_currentSelectedMeetingModel == null) { bc_OnMsg("当前没有可用的会议分组"); return; } Pub._talkControl.CurrentMeetingID = _currentSelectedMeetingModel.MeetingID; #endregion if (_meetingCommand.btnMeetingBeginEnd.Text == "开始会议") { if (Pub.CurrentDispatchControl.UserLineStatus != TalkControl.EnumUserLineStatus.Idle && Pub.CurrentDispatchControl.UserLineStatus != TalkControl.EnumUserLineStatus.HookOn) { bc_OnMsg(string.Format("创建会议失败,手柄为非空闲", cLeft.Number)); return; } if (_currentSelectedMeetingModel.MeetingType == MeetingGroupModel.EnumMeetingType.Formal) { #region 开始正式会议 _baseCommand = new MakeMeetingCommand(); Pub._talkControl.NumberList.Clear(); foreach (SingleUserControl item in _currentSelectedMeetingModel.lstControl) { if (item.UserLineStatus == TalkControl.EnumUserLineStatus.Idle) { Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = item.Number, vc_Name = item.MemberName }); } } _createMeetingType = MeetingGroupModel.EnumMeetingType.Formal; Pub._talkControl.CurrentNormalCMD = CommControl.PublicEnums.EnumNormalCmd.MakeLemcMeeting; _currentSelectedMeetingModel.MeetingState = MeetingGroupModel.EnumMeetingState.Ready; // bc_OnMsg("正在创建会议"); _meetingCommand.btnMeetingBeginEnd.Text = "结束会议"; _meetingCommand.btnAddMeetingMember.Enabled = false; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _currentSelectedMeetingModel.DispatchNumber = Pub._talkControl.CurrentDispatchNumber; _currentSelectedMeetingModel.MeetingID = 0; if (_baseCommand.Begin() == false) { _currentSelectedMeetingModel.MeetingState = MeetingGroupModel.EnumMeetingState.Off; _meetingCommand.btnMeetingBeginEnd.Text = "开始会议"; _meetingCommand.btnMeetingBeginEnd.Enabled = true; _dispatchCommand.btnMeeting.Enabled = true; _meetingCommand.btnAddMeetingMember.Enabled = true; } else { _meetingCommand.btnMeetingBeginEnd.Enabled = false; _dispatchCommand.btnMeeting.Enabled = false; } Pub._talkControl.NumberList.Clear(); Pub._talkControl.CurrentNormalCMD = PublicEnums.EnumNormalCmd.None; #endregion } if (_currentSelectedMeetingModel.MeetingType == MeetingGroupModel.EnumMeetingType.Lemc) { #region 开始紧急会议 Pub._talkControl.NumberList.Clear(); foreach (SingleUserControl item in _currentSelectedMeetingModel.lstControl) { if (item.UserLineStatus == TalkControl.EnumUserLineStatus.Idle) { Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = item.Number, vc_Name = item.MemberName }); } } if (Pub._talkControl.NumberList.Count > 0) { _createMeetingType = MeetingGroupModel.EnumMeetingType.Temp; _baseCommand.OnMsg += new Command.BaseCommand.MsgDelegate(bc_OnMsg); Pub._talkControl.CurrentNormalCMD = PublicEnums.EnumNormalCmd.None; _meetingCommand.btnMeetingBeginEnd.Enabled = false; _meetingCommand.btnMeetingBeginEnd.Text = "结束会议"; _meetingCommand.btnAddMeetingMember.Enabled = false; _currentSelectedMeetingModel.MeetingState = MeetingGroupModel.EnumMeetingState.Ready; _currentSelectedMeetingModel.DispatchNumber = Pub._talkControl.CurrentDispatchNumber; _currentSelectedMeetingModel.MeetingID = 0; _baseCommand.Begin(); // Pub._meetingManage.AddMeetingGroup(MeetingGroupModel.EnumMeetingState.Ready, MeetingGroupModel.EnumMeetingType.Temp, -1, Pub._talkControl.CurrentMeetingID, GetTempMeetingName(), Pub._talkControl.NumberList, Pub._talkControl.CurrentDispatchNumber, true); Pub._talkControl.NumberList.Clear(); Pub._memberManage.SetControlChecked(false); Pub._meetingManage.SetControlChecked(false); } else { bc_OnMsg("请先选择会议的成员"); } return; #endregion } } else { #region 结束会议 AutoSelectDispatchNumber(); if (CommControl.MessageBoxEx.MessageBoxEx.Show("请确认是否要结束此会议?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { return; } _baseCommand = new EndMeetingCommand(); Pub._talkControl.CurrentNormalCMD = CommControl.PublicEnums.EnumNormalCmd.EndMeeting; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); if (_baseCommand.Begin() == false) { // _currentSelectedMeetingModel.MeetingState = MeetingGroupModel.EnumMeetingState.Off; } Pub._talkControl.NumberList.Clear(); Pub._meetingManage.DeleteMeeting(_currentSelectedMeetingModel.GroupName); _meetingCommand.btnMeetingBeginEnd.Text = "开始会议"; _meetingCommand.btnAddMeetingMember.Enabled = true; Pub._meetingManage.DeleteMeeting(_currentSelectedMeetingModel.MeetingID); _currentSelectedMeetingModel.MeetingState = MeetingGroupModel.EnumMeetingState.Off; _currentSelectedMeetingModel.MeetingID = 0; // superTabControlMeeting.SelectedTab = (SuperTabItem)superTabControlMeeting.Tabs[0]; // ((SuperTabItem)superTabControlMeeting.Tabs[0]).RaiseClick(); bc_OnMsg("结束会议成功"); #endregion } #endregion break; case PublicEnums.EnumNormalCmd.RecordOperate: Pub._memberManage.SetFilterType(EnumFilterType.CanRecord); break; default: break; } }
public void Unregister(BaseCommand command) { _registeredCommands.Remove(command); }
public void SendCommand(BaseCommand command) { this.Channel.SendCommand(command); }
public StencilsVisibleCommand(BaseCommand parent = null) : base(parent) { m_StencilsStartDisabled = WidgetManager.m_Instance.StencilsDisabled; }
/// <summary> /// Executes command and returns result back. /// </summary> /// <param name="commandCallParams">Command to execute</param> public void ProcessCommand(PhoneGapCommandCall commandCallParams) { if (commandCallParams == null) { throw new ArgumentNullException("commandCallParams"); } try { BaseCommand bc = CommandFactory.CreateByServiceName(commandCallParams.Service); if (bc == null) { this.OnCommandResult(commandCallParams.CallbackId, new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION)); return; } EventHandler <PluginResult> OnCommandResultHandler = delegate(object o, PluginResult res) { this.OnCommandResult(commandCallParams.CallbackId, res); }; bc.OnCommandResult += OnCommandResultHandler; EventHandler <ScriptCallback> OnCustomScriptHandler = delegate(object o, ScriptCallback script) { this.InvokeScriptCallback(script); }; bc.OnCustomScript += OnCustomScriptHandler; // TODO: alternative way is using thread pool (ThreadPool.QueueUserWorkItem) instead of // new thread for every command call; but num threads are not sufficient - 2 threads per CPU core Thread thread = new Thread(func => { try { bc.InvokeMethodNamed(commandCallParams.Action, commandCallParams.Args); } catch (Exception) { bc.OnCommandResult -= OnCommandResultHandler; bc.OnCustomScript -= OnCustomScriptHandler; Debug.WriteLine("failed to InvokeMethodNamed :: " + commandCallParams.Action + " on Object :: " + commandCallParams.Service); this.OnCommandResult(commandCallParams.CallbackId, new PluginResult(PluginResult.Status.INVALID_ACTION)); return; } }); thread.Start(); } catch (Exception ex) { // ERROR Debug.WriteLine(String.Format("Unable to execute command :: {0}:{1}:{3} ", commandCallParams.Service, commandCallParams.Action, ex.Message)); this.OnCommandResult(commandCallParams.CallbackId, new PluginResult(PluginResult.Status.ERROR)); return; } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!BaseCommand.IsAccessible(from, m_Object)) { from.SendMessage("You may no longer access their properties."); return; } switch (info.ButtonID) { case 0: // Closed { if (m_Stack != null && m_Stack.Count > 0) { StackEntry entry = (StackEntry)m_Stack.Pop(); from.SendGump(new EventPropertiesGump(from, entry.m_Object, m_Stack, null)); } break; } case 1: // Previous { if (m_Page > 0) { from.SendGump(new EventPropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1)); } break; } case 2: // Next { if ((m_Page + 1) * EntryCount < m_List.Count) { from.SendGump(new EventPropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1)); } break; } default: { int index = (m_Page * EntryCount) + (info.ButtonID - 3); if (index >= 0 && index < m_List.Count) { PropertyInfo prop = m_List[index] as PropertyInfo; if (prop == null) { return; } CPA attr = GetCPA(prop); if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly) { return; } Type type = prop.PropertyType; if (IsType(type, typeofMobile) || IsType(type, typeofItem)) { from.SendGump(new EventSetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List)); } else if (IsType(type, typeofType)) { from.Target = new EventSetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List); } else if (IsType(type, typeofPoint3D)) { from.SendGump(new EventSetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofPoint2D)) { from.SendGump(new EventSetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofTimeSpan)) { from.SendGump(new EventSetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsCustomEnum(type)) { from.SendGump(new EventSetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type))); } else if (IsType(type, typeofEnum)) { from.SendGump(new EventSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Enum.GetNames(type), GetObjects(Enum.GetValues(type)))); } else if (IsType(type, typeofBool)) { from.SendGump(new EventSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues)); } else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric)) { from.SendGump(new EventSetGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofPoison)) { from.SendGump(new EventSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues)); } else if (IsType(type, typeofMap)) { from.SendGump(new EventSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues())); } else if (IsType(type, typeofSkills) && m_Object is Mobile) { from.SendGump(new EventPropertiesGump(from, m_Object, m_Stack, m_List, m_Page)); from.SendGump(new SkillsGump(from, (Mobile)m_Object)); } else if (HasAttribute(type, typeofPropertyObject, true)) { object obj = prop.GetValue(m_Object, null); if (obj != null) { from.SendGump(new EventPropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop))); } else { from.SendGump(new EventPropertiesGump(from, m_Object, m_Stack, m_List, m_Page)); } } } break; } } }
/// <summary> /// Creates a prepared (or compiled) version of the command on the data source. /// </summary> public void Prepare() { BaseCommand.Prepare(); }
private static void onReportReceived(BaseCommand command, CommandReportArgs args) { Console.WriteLine($"{args.ReportType}: {args.Message}"); }
private void CommandsRunner_OnReportSent(BaseCommand command, CommandReportArgs args) { _reportReceiver(command, args); }
private void OnUploadAlarm(object sender, BaseCommand e) { this.Dispatcher.Invoke(new OnUploadAlarmDelegate(UploadAlarm), new object[] { e }); }
public MenuPageModel() { ItemSelectedCommand = new BaseCommand <SelectedItemChangedEventArgs>((arg) => { SelectedItem = null; }); var menuItems = new List <MenuItem>() { new MenuItem() { Section = "Basic", Title = "Basic example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <BasicPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Basic", Title = "Placeholders examples", Command = BaseCommand.FromAction(async(param) => { await this.PushPageFromCacheAsync <PlaceholdersPageModel>(); }) }, new MenuItem() { Section = "Lists", Title = "List example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <ListPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Lists", Title = "List transformations example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <ListTransformationsPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Lists", Title = "Heavy List example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <ListHeavyPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Lists", Title = "ByteArray / custom cache key example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <ByteArrayListPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Advanced", Title = "Custom CacheKey example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <CustomKeyPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Advanced", Title = "Stream from base64 data", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <StreamListPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Advanced", Title = "Data url examples", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <DataUrlPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Advanced", Title = "CachedImage sizing test", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <CachedImageSizingTestPageModel>(); }) }, //new MenuItem() { // Section = "Advanced", // Title = "Stream with custom cache key example", // Command = new BaseCommand((param) => // { // //TODO // }) //}, new MenuItem() { Section = "Transformations", Title = "ColorFillTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <ColorFillTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "CropTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <CropTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "RotateTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <RotateTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "CircleTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <CircleTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "RoundedTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <RoundedTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "CornersTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <CornersTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "GrayscaleTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <GrayscaleTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "BlurredTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <BlurredTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "SepiaTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <SepiaTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "ColorSpaceTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <ColorSpaceTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "TintTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <TintTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "FlipTransformation", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <FlipTransformationPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "Multiple transformations example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <MultipleTransformationsPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "Transformations", Title = "Transformations selector example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <TransformationsSelectorPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "File formats", Title = "Simple SVG example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <SvgSamplePageModel>(); }) }, new MenuItem() { Section = "File formats", Title = "Heavy SVG List example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <SvgListHeavyPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "File formats", Title = "SVG replace map example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <SvgReplacePageModel>(); }) }, new MenuItem() { Section = "File formats", Title = "Simple Gif example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <SimpleGifPageModel>(pm => pm.Reload()); }) }, new MenuItem() { Section = "File formats", Title = "Simple WebP example", Command = new BaseCommand(async(param) => { await this.PushPageFromCacheAsync <SimpleWebpPageModel>(pm => pm.Reload()); }) }, }; var sorted = menuItems .GroupBy(item => item.Section) .Select(itemGroup => new Grouping <string, MenuItem>(itemGroup.Key, itemGroup)); Items = new ObservableCollection <Grouping <string, MenuItem> >(sorted); }
// Start is called before the first frame update void Start() { sceneManager = GameObject.Find("SceneManager").GetComponent <LoadSceneManager>(); baseCommand = GetComponent <BaseCommand>(); }
public void command_inheritance_test() { var command = new BaseCommand { AggregateRootId = ObjectId.GenerateNewStringId() }; var asyncResult = _commandService.ExecuteAsync(command).Result; Assert.IsNotNull(asyncResult); Assert.AreEqual(AsyncTaskStatus.Success, asyncResult.Status); var commandResult = asyncResult.Data; Assert.IsNotNull(commandResult); Assert.AreEqual(CommandStatus.NothingChanged, commandResult.Status); Assert.AreEqual("ResultFromBaseCommand", commandResult.Result); command = new ChildCommand { AggregateRootId = ObjectId.GenerateNewStringId() }; asyncResult = _commandService.ExecuteAsync(command).Result; Assert.IsNotNull(asyncResult); Assert.AreEqual(AsyncTaskStatus.Success, asyncResult.Status); commandResult = asyncResult.Data; Assert.IsNotNull(commandResult); Assert.AreEqual(CommandStatus.NothingChanged, commandResult.Status); Assert.AreEqual("ResultFromChildCommand", commandResult.Result); }
public void SendCommand(BaseCommand command) { Send(sessionState.Socket, command); }
// Use this for initialization void Start() { t = transform; _walkableTerrain = new string[] { "Terrain", "ActiveEnemy","HitBox" }; _currentState = PlayerState.IDLE; _idleCommand = gameObject.AddComponent<IdleCommand>(); _moveCommand = gameObject.AddComponent<MoveCommand>(); _moveAttackCommand = gameObject.AddComponent<MoveAttackCommand>(); _moveToLevelCommand = gameObject.AddComponent<MoveToAnotherLevelCommand>(); _currentCommand = _idleCommand; _dashingTrail.enabled = false; _weaponTrail.Deactivate(); FlushPreviousCommand(); }
public MainPageModel() { ItemSelectedCommand = new BaseCommand<SelectedItemChangedEventArgs>((arg) => { var item = arg?.SelectedItem as MenuItem; if (item != null) { SelectedItem = null; item.Command?.Execute(null); } }); var menuItems = new List<MenuItem>() { new MenuItem() { Section = "FlowListView", Title = "Simple example", Detail = "Simplest fixed column number example", Command = new BaseCommand(async (param) => { var page = this.GetPageFromCache<SimplePageModel>(); await this.PushPageAsync(page, (model) => model.ReloadData()); }), }, new MenuItem() { Section = "FlowListView", Title = "Simple gallery example", Detail = "Simplest auto column number example", Command = new BaseCommand(async (param) => { var page = this.GetPageFromCache<SimpleGalleryPageModel>(); await this.PushPageAsync(page, (model) => model.ReloadData()); }), }, new MenuItem() { Section = "FlowListView", Title = "Template selector example", Detail = "Custom FlowDataTemplateSelector example", Command = new BaseCommand(async (param) => { var page = this.GetPageFromCache<TemplateSelectorPageModel>(); await this.PushPageAsync(page, (model) => model.ReloadData()); }), }, new MenuItem() { Section = "FlowListView", Title = "Grouping example", Detail = "Grouping example", Command = new BaseCommand(async (param) => { var page = this.GetPageFromCache<GroupingPageModel>(); await this.PushPageAsync(page, (model) => model.ReloadData()); }), }, }; var sorted = menuItems .OrderBy(item => item.Section) .GroupBy(item => item.Section) .Select(itemGroup => new Grouping<string, MenuItem>(itemGroup.Key, itemGroup)); Items = new ObservableCollection<Grouping<string, MenuItem>>(sorted); }
//This is called when a non-interrupable command has been completed private void Unlock() { FlushPreviousCommand(); if(_cacheCommand != null) { _cacheCommand.enabled = true; if(_storedEnemy != null) //As a rule, if stored enemy is not null, means the cache command need to be init with a enemy { _cacheCommand.Init(_animator, _storedEnemy, Unlock); _storedEnemy = null; } _currentCommand = _cacheCommand; _cacheCommand = null; } else { _currentCommand = _idleCommand; } _dashingTrail.enabled = false; }
public void AddCommand(BaseCommand command) { this.Commands.Add(command.Name , command); }
void ChangeState(PlayerState state) { FlushPreviousCommand(); BaseCommand command = _idleCommand; switch (state) { case PlayerState.DASH: _weaponTrail.Deactivate(); _dashingTrail.enabled = true; command = _moveCommand; command.Init(_animator, rayHit.point, Unlock); LookAt(rayHit.point); break; case PlayerState.MOVE_ATTACK: _weaponTrail.Activate(); command = _moveAttackCommand; if (!_currentCommand._isInteruptable) { _storedEnemy = _enemyFound; } else { command.Init(_animator, _enemyFound, Unlock); } LookAt(_enemyFound.transform.position); break; } if (!_currentCommand._isInteruptable) { _cacheCommand = command; } else { command.enabled = true; _currentCommand = command; } }
/// <summary> /// Send(). /// It sends a command to FreeSwitch and awaist for a CommandReply response /// </summary> /// <param name="command">The command to send</param> /// <returns>CommandReply response</returns> public async Task<CommandReply> Send(BaseCommand command) { if (!Connected || !Authenticated) return null; // Send command var event2 = EnqueueCommand(command); if (_log.IsDebugEnabled) _log.Debug("command to be sent <<{0}>>", command.ToString()); await SendAsync(command); return await event2.Task as CommandReply; }
private void cRight_Click(object sender, EventArgs e) { SingleUserControl ss = (SingleUserControl)sender; if (Pub._talkControl.CurrentNormalCMD == PublicEnums.EnumNormalCmd.Handup || Pub._talkControl.CurrentNormalCMD == PublicEnums.EnumNormalCmd.DeleteMeetingMember) { _dispatchCommand.ClearSelect(); _meetingCommand.ClearSelect(); _baseCommand = new HandupCommand(); _baseCommand.MemberControl = ss; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); if (Pub._talkControl.CurrentNormalCMD != CommControl.PublicEnums.EnumNormalCmd.MakeLemcMeeting) { Pub._talkControl.CurrentNormalCMD = CommControl.PublicEnums.EnumNormalCmd.None; } Pub._memberManage.ShowAllMember(); } else { if (cRight.UserLineStatus != TalkControl.EnumUserLineStatus.Offline) { Pub._talkControl.CurrentDispatchNumber = ss.Number; cLeft.Checked = false; cRight.Checked = true; } Pub.CurrentDispatchControl = ss; } }
/// <summary> /// Valiates every response received seeing that we can send commands to FreeSwitch asynchronously and wait for /// responses. /// However some responses may be for another command previously sent. In that regard, every command has a sequence /// number /// attached to it that helps differentiate between them and easily map their responses. /// </summary> /// <param name="command">The original command send</param> /// <param name="response">The actual response received</param> /// <returns>EslMessage</returns> protected async Task<EslMessage> ValidateResponse(BaseCommand command, EslMessage response) { if (response == null) return null; if (_requestsQueue.Count <= 0) return null; CommandAsyncEvent event2; if (!_requestsQueue.TryDequeue(out event2)) return null; if (event2 == null) return null; if (!event2.Command.Equals(command)) return null; event2.Complete(response); return await event2.Task; }
public override bool Equals(BaseCommand other) { bool equal = base.Equals(other); return equal && ((RasterizerStateChangeCommand) other).Description == Description; }
protected override bool Execute(TBot bot, TMessage message, object arg = null) { BotConsole.Write(_logText); return(BaseCommand.ExecuteCommand(bot, message, arg)); }
private void ProccessCommandCustom(BaseCommand command, Socket socket) { RenewSessionState(); if (OnCustomCommand != null) { OnCustomCommand(this, new CustomCommandEventArgs { Command = command }); } }
public ClientGump(Mobile from, NetState state) : base(30, 20) { if (state == null) { return; } m_State = state; AddPage(0); AddBackground(0, 0, 400, 274, 5054); AddImageTiled(10, 10, 380, 19, 0xA40); AddAlphaRegion(10, 10, 380, 19); AddImageTiled(10, 32, 380, 232, 0xA40); AddAlphaRegion(10, 32, 380, 232); AddHtml(10, 10, 380, 20, Color(Center("User Information"), LabelColor32), false, false); int line = 0; AddHtml(14, 36 + (line * 20), 200, 20, Color("Address:", LabelColor32), false, false); AddHtml(70, 36 + (line++ *20), 200, 20, Color(state.ToString(), LabelColor32), false, false); AddHtml(14, 36 + (line * 20), 200, 20, Color("Client:", LabelColor32), false, false); AddHtml(70, 36 + (line++ *20), 200, 20, Color(state.Version == null ? "(null)" : state.Version.ToString(), LabelColor32), false, false); AddHtml(14, 36 + (line * 20), 200, 20, Color("Version:", LabelColor32), false, false); ExpansionInfo info = state.ExpansionInfo; string expansionName = info.Name; AddHtml(70, 36 + (line++ *20), 200, 20, Color(expansionName, LabelColor32), false, false); Account a = state.Account as Account; Mobile m = state.Mobile; if (from.AccessLevel >= AccessLevel.GameMaster && a != null) { AddHtml(14, 36 + (line * 20), 200, 20, Color("Account:", LabelColor32), false, false); AddHtml(70, 36 + (line++ *20), 200, 20, Color(a.Username, LabelColor32), false, false); } if (m != null) { AddHtml(14, 36 + (line * 20), 200, 20, Color("Mobile:", LabelColor32), false, false); AddHtml(70, 36 + (line++ *20), 200, 20, Color(String.Format("{0} (0x{1:X})", m.Name, m.Serial.Value), LabelColor32), false, false); AddHtml(14, 36 + (line * 20), 200, 20, Color("Location:", LabelColor32), false, false); AddHtml(70, 36 + (line++ *20), 200, 20, Color(String.Format("{0} [{1}]", m.Location, m.Map), LabelColor32), false, false); AddButton(13, 157, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0); AddHtml(48, 158, 200, 20, Color("Send Message", LabelColor32), false, false); AddImageTiled(12, 182, 376, 80, 0xA40); AddImageTiled(13, 183, 374, 78, 0xBBC); AddTextEntry(15, 183, 372, 78, 0x480, 0, ""); AddImageTiled(245, 35, 142, 144, 5058); AddImageTiled(246, 36, 140, 142, 0xA40); AddAlphaRegion(246, 36, 140, 142); line = 0; if (BaseCommand.IsAccessible(from, m)) { AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Properties", LabelColor32), false, false); } if (from != m) { AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Go to them", LabelColor32), false, false); AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Bring them here", LabelColor32), false, false); } AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 7, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Move to target", LabelColor32), false, false); if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel) { AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 8, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Disconnect", LabelColor32), false, false); if (m.Alive) { AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 9, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Kill", LabelColor32), false, false); } else { AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 10, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Resurrect", LabelColor32), false, false); } } if (from.AccessLevel >= AccessLevel.Counselor && from.AccessLevel > m.AccessLevel) { AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 11, GumpButtonType.Reply, 0); AddHtml(280, 38 + (line++ *20), 100, 20, Color("Skills browser", LabelColor32), false, false); } } }
public override bool MayTrigger(CmdTrigger<RealmServerCmdArgs> trigger, BaseCommand<RealmServerCmdArgs> command, bool silent) { if (command is TicketSubCmd) { var cmd = (TicketSubCmd)command; if ((cmd.RequiresTicketHandler || cmd.RequiresActiveTicket) && trigger.Args.TicketHandler == null) { if (!silent) { trigger.Reply("Cannot use Command in this Context (TicketHandler required)"); RealmCommandHandler.Instance.DisplayCmd(trigger, this, false, false); } return false; } if (cmd.RequiresActiveTicket && trigger.Args.TicketHandler.HandlingTicket == null) { if (!silent) { trigger.Reply("You do not have a Ticket selected. Use the \"Next\" command first:"); var nextCmd = RealmCommandHandler.Instance.Get<SelectNextTicketCommand>(); RealmCommandHandler.Instance.DisplayCmd(trigger, nextCmd, false, true); } return false; } } return true; }
public override void OnResponse(NetState state, RelayInfo info) { if (m_State == null) { return; } Mobile focus = m_State.Mobile; Mobile from = state.Mobile; if (focus == null) { from.SendMessage("That character is no longer online."); return; } else if (focus.Deleted) { from.SendMessage("That character no longer exists."); return; } else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from))) { from.SendMessage("That character is no longer visible."); return; } switch (info.ButtonID) { case 1: // Tell { TextRelay text = info.GetTextEntry(0); if (text != null) { focus.SendMessage(0x482, "{0} tells you:", from.Name); focus.SendMessage(0x482, text.Text); CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text); } from.SendGump(new ClientGump(from, m_State)); break; } case 4: // Props { Resend(from, info); if (!BaseCommand.IsAccessible(from, focus)) { from.SendMessage("That is not accessible."); } else { from.SendGump(new PropertiesGump(from, focus)); CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 5: // Go to { if (focus.Map == null || focus.Map == Map.Internal) { from.SendMessage("That character is not in the world."); } else { from.MoveToWorld(focus.Location, focus.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map); } break; } case 6: // Get { if (from.Map == null || from.Map == Map.Internal) { from.SendMessage("You cannot bring that person here."); } else { focus.MoveToWorld(from.Location, from.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map); } break; } case 7: // Move { from.Target = new MoveTarget(focus); Resend(from, info); break; } case 8: // Kick { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Say("I've been kicked!"); m_State.Dispose(); CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 9: // Kill { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Kill(); CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 10: //Res { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.PlaySound(0x214); focus.FixedEffect(0x376A, 10, 16); focus.Resurrect(); CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 11: // Skills { Resend(from, info); if (from.AccessLevel > focus.AccessLevel) { from.SendGump(new SkillsGump(from, (Mobile)focus)); CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } } }
public DatabaseManager(BaseCommand plugin) { this.plugin = plugin; }
public AnalysisOptionsViewModel(MultiAlignAnalysisOptions options) { m_options = options; ClusteringAlgorithms = new ObservableCollection <LcmsFeatureClusteringAlgorithmType>(); AlignmentAlgorithms = new ObservableCollection <FeatureAlignmentType>(); FeatureFindingAlgorithms = new ObservableCollection <FeatureFinderType>(); UpdateOptions(); InstrumentPresets = new ObservableCollection <InstrumentPresetViewModel>(); ExperimentPresets = new ObservableCollection <ExperimentPresetViewModel>(); TimeOptions = new ObservableCollection <string>(); var presets = new Dictionary <string, bool>(); foreach (var preset in ExperimentPresetFactory.Create()) { ExperimentPresets.Add(preset); if (!presets.ContainsKey(preset.InstrumentPreset.Name)) { presets.Add(preset.InstrumentPreset.Name, false); InstrumentPresets.Add(preset.InstrumentPreset); } } foreach (var preset in InstrumentPresetFactory.Create()) { if (!presets.ContainsKey(preset.Name)) { InstrumentPresets.Add(preset); } } TimeOptions.Add("Minutes"); TimeOptions.Add("Scans"); SelectedPreset = InstrumentPresets[0]; SelectedExperimentPreset = ExperimentPresets[0]; TreatAsTimeOrScan = TimeOptions[0]; m_saveDialog = new SaveFileDialog(); m_dialog = new OpenFileDialog { Filter = Resources.MultiAlignParameterFileFilter }; m_saveDialog.Filter = Resources.MultiAlignParameterFileFilter; ShowAdvancedWindowCommand = new BaseCommand(ShowAdvancedWindow); SaveOptionsCommand = new BaseCommand(SaveCurrentParameters); LoadExistingCommand = new BaseCommand(LoadExistingParameters); Enum.GetValues(typeof(LcmsFeatureClusteringAlgorithmType)) .Cast <LcmsFeatureClusteringAlgorithmType>() .ToList() .ForEach(x => ClusteringAlgorithms.Add(x)); Enum.GetValues(typeof(FeatureAlignmentType)) .Cast <FeatureAlignmentType>() .ToList() .ForEach(x => AlignmentAlgorithms.Add(x)); Enum.GetValues(typeof(FeatureFinderType)) .Cast <FeatureFinderType>() .ToList() .ForEach(x => FeatureFindingAlgorithms.Add(x)); }
/// <summary> /// Add the command request to the waiting list. /// </summary> /// <param name="command">The command to send</param> /// <returns></returns> protected CommandAsyncEvent EnqueueCommand(BaseCommand command) { var event2 = new CommandAsyncEvent(command); _requestsQueue.Enqueue(event2); return event2; }
public async Task Transaction(BaseCommand command, Func <Task> action) { await Transaction(action : action); }
/// <summary> /// Initializes a new instance of the <see cref="ToolsController"/> class. /// </summary> /// <param name="getInventorySummary"> /// The get inventory summary. /// </param> /// <param name="getBirthdaysCommand"> /// The get Birthdays Command. /// </param> public ToolsController(BaseCommand<GetAccountInventoryRequest, List<ItemSummary>> getInventorySummary, BaseCommand<GetBirthdaysRequest, List<CharacterInformation>> getBirthdaysCommand) { this.getAccountInventoryCommand = getInventorySummary; this.getBirthdaysCommand = getBirthdaysCommand; }
/// <summary>点击号码事件,重要</summary> /// <param name="sender"></param> /// <param name="e"></param> public void single_Click(object sender, EventArgs e) { if (_isBoxOnline == false) { bc_OnMsg("连接设备失败"); return; } _dispatchCommand.ClearSelect(); _meetingCommand.ClearSelect(); //if (Pub._talkControl.CurrentNormalCMD == CommControl.PublicEnums.EnumNormalCmd.None) //{ // bc_OnMsg("请先选择命令"); //} if (Pub._talkControl.CurrentDispatchNumber == 0) { bc_OnMsg("请选择调度号码"); } SingleUserControl control = (SingleUserControl)sender; if (control.UserLineStatus == TalkControl.EnumUserLineStatus.Holding && Pub._talkControl.CurrentNormalCMD == PublicEnums.EnumNormalCmd.None )//如果当前为保持状态,就执行应答 { Pub._talkControl.CurrentNormalCMD = PublicEnums.EnumNormalCmd.SelectAnser; } if (control.UserLineStatus == TalkControl.EnumUserLineStatus.Idle && Pub._talkControl.CurrentNormalCMD == PublicEnums.EnumNormalCmd.None && _isDispatchTabPage == false)//如果当前为会议,默认为邀请用户 { Pub._talkControl.CurrentNormalCMD = PublicEnums.EnumNormalCmd.AddMeetingMember; } switch (Pub._talkControl.CurrentNormalCMD) { case PublicEnums.EnumNormalCmd.None: case CommControl.PublicEnums.EnumNormalCmd.Call: if (_isDispatchTabPage == true) { if (control.UserLineStatus == TalkControl.EnumUserLineStatus.Idle) { _baseCommand = new MakeCallCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); if (_baseCommand.Begin() == true && Pub.CurrentDispatchControl.UserLineStatus == TalkControl.EnumUserLineStatus.Idle) { Pub._memberManage.SetMemberState(control.Number, "连接中"); } } } break; case CommControl.PublicEnums.EnumNormalCmd.MakeLemcMeeting: //if (control.Checked == true) //{ // if (Pub._talkControl.NumberList.Exists(delegate(DB_Talk.Model.m_Member s) { return s.i_Number == control.Number; }) == false) // { // if (Pub._talkControl.NumberList.Count >= Pub._configModel.MaxMeetingMember) // { // CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("选择会议成员失败,成员最大数为:{0}", Pub._configModel.MaxMeetingMember),"紧急会议提示"); // control.Checked = false; // } // else // { // Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = control.Number, vc_Name = control.MemberName }); // } // } //} //else //{ // DB_Talk.Model.m_Member m = Pub._talkControl.NumberList.Find(delegate(DB_Talk.Model.m_Member s) { return s.i_Number == control.Number; }); // if (m != null) // { // Pub._talkControl.NumberList.Remove(m); // } //} break; case CommControl.PublicEnums.EnumNormalCmd.Handup: _baseCommand = new HandupCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.Insert: _baseCommand = new InsertCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); if (_baseCommand.Begin()) { int number = 0; try { number = int.Parse(control.PeerNumber); if (number != 0) { Pub.WriteMemberState(Pub._talkControl.CurrentDispatchNumber, control.Number, number, TalkControl.EnumUserLineStatus.Insert); } } catch (Exception) { } } break; case CommControl.PublicEnums.EnumNormalCmd.InsteadAnswer: _baseCommand = new InsteadAnswerCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.Keep: _baseCommand = new KeepCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.Transfer: _baseCommand = new TransferCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.SnatchCall: _baseCommand = new SnatchCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.Listen: _baseCommand = new ListenCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); try { if (_baseCommand.Begin() == true) { Pub.WriteMemberState(Pub._talkControl.CurrentDispatchNumber, control.Number, int.Parse(control.PeerNumber), TalkControl.EnumUserLineStatus.Listen); } } catch (Exception) { } break; case CommControl.PublicEnums.EnumNormalCmd.AddMeetingMember: if (_currentSelectedMeetingModel.MeetingState == MeetingGroupModel.EnumMeetingState.Running && this._isCanAddMember == true) { _baseCommand = new AddMeetingMemberCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); //GetCurrentMeetingModel(); Pub._talkControl.NumberList.Clear(); Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = control.Number, vc_Name = control.MemberName }); if (_currentSelectedMeetingModel != null) { if (_baseCommand.Begin() == true) { Pub._meetingManage.AddMeetingMember(_currentSelectedMeetingModel.GroupID, Pub._talkControl.CurrentMeetingID, control.Number, _currentSelectedMeetingModel.GroupName); } imgBtnMeeting_Click(null, null); } else { bc_OnMsg("邀请失败"); } } else { if (control.Checked == true) { if (Pub._talkControl.NumberList.Exists(delegate(DB_Talk.Model.m_Member s) { return s.i_Number == control.Number; }) == false) { if (Pub._talkControl.NumberList.Count + Pub._currentSelectMeetingMemberCount >= Pub._maxMeetingMemberCount) { CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("选择会议成员失败,成员最大数为:{0}", Pub._maxMeetingMemberCount), "会议提示"); control.Checked = false; } else { Pub._talkControl.NumberList.Add(new DB_Talk.Model.m_Member() { i_Number = control.Number, vc_Name = control.MemberName }); } } } else { DB_Talk.Model.m_Member m = Pub._talkControl.NumberList.Find(delegate(DB_Talk.Model.m_Member s) { return s.i_Number == control.Number; }); if (m != null) { Pub._talkControl.NumberList.Remove(m); } } } break; case CommControl.PublicEnums.EnumNormalCmd.DeleteMeetingMember: if (control.UserLineStatus != TalkControl.EnumUserLineStatus.Busy && control.UserLineStatus != TalkControl.EnumUserLineStatus.Forbid && control.UserLineStatus != TalkControl.EnumUserLineStatus.Isolate && control.UserLineStatus != TalkControl.EnumUserLineStatus.Ring && control.UserLineStatus != TalkControl.EnumUserLineStatus.Record ) { Pub._meetingManage.DeleteMeetingMemberByName(_currentSelectedMeetingModel.GroupName, control.Number); } else { if (_currentSelectedMeetingModel.MeetingState == MeetingGroupModel.EnumMeetingState.Running) { _baseCommand = new DeleteMeetingMemberCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); } if (control.UserLineStatus == TalkControl.EnumUserLineStatus.Ring) { _baseCommand = new HandupCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); } if (control.PeerNumber == "会议中") { control.IsMeeting = false; _baseCommand = new HandupCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); } Pub._meetingManage.DeleteMeetingMemberByName(_currentSelectedMeetingModel.GroupName, control.Number); } superTabControlMeeting.SelectedTab.RaiseClick(); Pub._memberManage.SetControlIsCanSelect(false); break; case CommControl.PublicEnums.EnumNormalCmd.NoSpeekMeeting: AutoSelectDispatchNumber(); _baseCommand = new NoSpeekMeetingMemberCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.OkSpeekMeeting: AutoSelectDispatchNumber(); _baseCommand = new OkSpeekMeetingMemberCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.IsolateMeeting: AutoSelectDispatchNumber(); _baseCommand = new IsolateMeetingMemberCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.UnIsolateMeeting: AutoSelectDispatchNumber(); _baseCommand = new UnIsolateMeetingMemberCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case CommControl.PublicEnums.EnumNormalCmd.EndMeeting: _baseCommand = new EndMeetingCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case PublicEnums.EnumNormalCmd.SelectAnser: _baseCommand = new SelectAnswerCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); break; case PublicEnums.EnumNormalCmd.RecordOperate: if (control.UserLineStatus != TalkControl.EnumUserLineStatus.Record) { _baseCommand = new BeginRecordCommand(); _baseCommand.MemberControl = control; _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); _baseCommand.Begin(); } if (control.UserLineStatus == TalkControl.EnumUserLineStatus.Record) { if (CommControl.MessageBoxEx.MessageBoxEx.Show("请确认是否要停止录音?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { return; } _baseCommand = new EndRecordCommand(); _baseCommand.talkControl = Pub._talkControl; _baseCommand.OnMsg += new BaseCommand.MsgDelegate(bc_OnMsg); try { _baseCommand.MemberControl = new SingleUserControl() { Number = int.Parse(control.PeerNumber)//停止对方的 }; SingleUserControl sc = Pub._memberManage.GetSingleControl(int.Parse(control.PeerNumber)); if (sc.UserLineStatus == TalkControl.EnumUserLineStatus.Record) { _baseCommand.Begin(); } } catch (Exception) { } _baseCommand.MemberControl = control; _baseCommand.Begin(); } break; default: break; } if (Pub._talkControl.CurrentNormalCMD != CommControl.PublicEnums.EnumNormalCmd.MakeLemcMeeting) { Pub._talkControl.CurrentNormalCMD = CommControl.PublicEnums.EnumNormalCmd.None; } if (Pub._talkControl.CurrentNormalCMD != CommControl.PublicEnums.EnumNormalCmd.AddMeetingMember) { Pub._memberManage.ShowAllMember(); } }