public void ConsumeMessage(Messaging.Interfaces.IMessage msg) { if (msg.MessageId == (int) MessageId.Input) { var input = msg as InputMessage; if (application.Window.IsMouseCaptured()) return; m_Canvas.Input_MouseMoved( (int) input.MousePosition.X, (int) input.MousePosition.Y, (int) input.MouseMovement.X, (int) input.MouseMovement.Y); if (input.Mouse.Any(m => m.Action == KeyAction.Press && m.Button == MouseButton.LeftButton)) m_Canvas.Input_MouseButton(0, true); if (input.Mouse.Any(m => m.Action == KeyAction.Release && m.Button == MouseButton.LeftButton)) m_Canvas.Input_MouseButton(0, false); if (input.Mouse.Any(m => m.Action == KeyAction.Press && m.Button == MouseButton.MiddleButton)) m_Canvas.Input_MouseButton(1, true); if (input.Mouse.Any(m => m.Action == KeyAction.Release && m.Button == MouseButton.MiddleButton)) m_Canvas.Input_MouseButton(1, false); if (input.Mouse.Any(m => m.Action == KeyAction.Press && m.Button == MouseButton.RightButton)) m_Canvas.Input_MouseButton(2, true); if (input.Mouse.Any(m => m.Action == KeyAction.Release && m.Button == MouseButton.RightButton)) m_Canvas.Input_MouseButton(2, false); } }
public Context(IKernel kernel, IBridge bridge, IInstance instance, Messaging.Client.IEndpoint clientEndpoint, Settings.IProvider settingsProvider) { Kernel = kernel; Bridge = bridge; Instance = instance; Endpoint = clientEndpoint; SettingsProvider = settingsProvider; }
public Connector(Configuration.ISettings configurationSettings, Event.IProvider eventProvider, Messaging.Component.IEndpoint endpoint) { _configurationSettings = configurationSettings; _eventProvider = eventProvider; _endpoint = endpoint; _messages = new Subject<Message.IMessage>(); }
public NotificationsControllerImpl(IDataService dataService, Messaging.Data.IDataService messagingDataService) { Requires.NotNull("dataService", dataService); Requires.NotNull("messagingDataService", messagingDataService); _dataService = dataService; _messagingDataService = messagingDataService; }
internal bool ProcessMessage(Messaging.Message msg) { if (m_letterBox != null) { throw new InvalidOperationException("This method can only be invoked in sync mode."); } return DispatchMessage(msg); }
public CompositorColorCorrectionNode (RendererContext rc, Messaging.MessageProvider mp) : base ("NodeColorCorrection", rc, mp) { Hue = 0; Saturation = 0; Lightness = 0; Gamma = 1; Contrast = 1; Brightness = 0; }
private bool DispatchMessage(Messaging.Message message) { if (message != null) { // TODO: if there is no message other than IO messages, maybe we could use a better message id than // a text if (message.Text == MsgTacticalPhase) { return OnTacticalPhase(message.Attachment as TacticalPhase); } else if (message.Text == MsgSelectCards) { return OnSelectCards(message.Attachment as SelectCards); } else if (message.Text == MsgMessageBox) { return OnMessageBox(message.Attachment as MessageBox); } else if (message.Text == MsgSelectNumber) { return OnSelectNumber(message.Attachment as SelectNumber); } else if (message.Text == MsgSelectCardModel) { return OnSelectCardModel(message.Attachment as SelectCardModel); } else if (message.Text == MsgNotifyCardEvent) { return OnNotified(message.Attachment as NotifyCardEvent); } else if (message.Text == MsgNotifyGameEvent) { return OnNotified(message.Attachment as NotifyGameEvent); } else if (message.Text == MsgNotifyPlayerEvent) { return OnNotified(message.Attachment as NotifyPlayerEvent); } else if (message.Text == MsgNotifySpellEvent) { return OnNotified(message.Attachment as NotifySpellEvent); } else { throw new NotImplementedException(String.Format("Undefined message {0}", message.Text)); } } return false; }
private Messaging.FormUpdateResponse validateFormUpdateRequest (Messaging.FormUpdateRequest request) { Assert.AreEqual (7, request.Status); Assert.AreEqual (1324658438, request.ReceivedTimestamp); Assert.AreEqual ("4d2e8c4b-b23a-4b5b-86b3-368158aa64fe", request.MessageKey); Assert.IsNull (request.ParentMessageKey); Assert.AreEqual ("*****@*****.**", request.Member); Assert.AreEqual ("my message tag19347819", request.Tag); Assert.AreEqual (1324659262, request.AckedTimestamp); Assert.AreEqual ("positive", request.AnswerId); Assert.AreEqual ("+default+", request.ServiceIdentity); Assert.AreEqual ("*****@*****.**", request.UserDetails.Email); Assert.AreEqual ("John Doe", request.UserDetails.Name); Assert.AreEqual ("en", request.UserDetails.Language); Assert.AreEqual ("https://rogerth.at/unauthenticated/mobi/cached/avatar/4824964683268096", request.UserDetails.AvatarUrl); return new Messaging.FormUpdateResponse (); }
public void Consume(Messaging.Models.Media message) { if (message != null) { var bytes = _storage.GetFile(QueueConstants.MediaQueue, message.Id.ToString()); var format = GetFormat(message.Extension); using (ISession session = _sessionFactory.OpenSession()) { var momento = SaveMomento(message, session, bytes); var imageConfigurations = GetImageConfigurations(bytes, format, message, momento); ResizeAndSaveImages(imageConfigurations, session); _storage.DeleteFile(QueueConstants.MediaQueue, message.Id.ToString()); } } }
private void DisplayMessage(Messaging.Message message) { string header = string.Format("{0} [{1}]:\n", message.SenderAddress, message.Instant.ToShortTimeString()); string content = Sanitizer.Sanitize(Sanitizer.NeutralizeUrl(message.Content)); int headerStart = rtbConversation.TextLength; rtbConversation.AppendText(header); rtbConversation.Select(headerStart, header.Length); rtbConversation.SelectionColor = headerColor; rtbConversation.SelectionFont = headerFont; int contentStart = rtbConversation.TextLength; rtbConversation.AppendText(content); rtbConversation.Select(contentStart, content.Length); rtbConversation.SelectionColor = messageColor; rtbConversation.SelectionFont = messageFont; rtbConversation.AppendText("\n"); }
private Messaging.FlowMemberResultResponse onFlowMemberResult(Messaging.FlowMemberResultRequest request) { Messaging.FlowMemberResultResponse response = new Messaging.FlowMemberResultResponse(); switch (request.Tag) { case "static": case "mfr": foreach (MessageFlowStep step in request.Steps) { if ("message_gps_location".Equals(step.StepId)) { LocationWidgetResult formResult = (step as FormFlowStep).Result.Widget as LocationWidgetResult; MessageCallbackResult callback = new MessageCallbackResult(); callback.Flags = MessageFlag.ALLOW_DISMISS.Value | MessageFlag.AUTO_SEAL.Value; callback.Tag = "mfr2"; callback.Text = String.Format("Received locationResult:\n({0:F3}, {1:F3}) +/- {2:F2}m", formResult.Latitude, formResult.Longitude, formResult.HorizontalAccuracy); callback.DismissButtonUiFlags = UiFlag.WAIT_FOR_NEXT_MESSAGE.Value; response.Result = callback; break; } break; } break; case "mfr3": { MessageCallbackResult callback = new MessageCallbackResult (); callback.Flags = MessageFlag.ALLOW_DISMISS.Value | MessageFlag.AUTO_SEAL.Value; callback.Tag = null; callback.Text = "Congrats, you reached the end of the flow"; response.Result = callback; break; } default: break; } return response; }
public IContext CreateDeviceInContext(Settings.IProvider settingsProvider, Messaging.Client.IEndpoint clientEndpoint) { ChildKernel kernel = new ChildKernel(_kernel); kernel.Bind<Command.Response.IBuilder>().To<Command.Response.Builder.VersionResponse>().InSingletonScope(); kernel.Bind<Command.Response.IBuilder>().To<Command.Response.Builder.RostaResponse>().InSingletonScope(); kernel.Bind<Command.Response.IBuilder>().To<Command.Response.Builder.DeviceResponse>().InSingletonScope(); kernel.Bind<Command.Response.IBuilder>().To<Command.Response.Builder.UdpResponse>().InSingletonScope(); kernel.Bind<Command.Response.IBuilder>().To<Command.Response.Builder.SaveResponse>().InSingletonScope(); kernel.Bind<Command.Response.IParser>().To<Command.Response.Parser>().InSingletonScope(); kernel.Bind<Command.Endpoint.IFactory>().To<Command.Endpoint.Factory>().InSingletonScope(); kernel.Bind<Packet.IParser>().To<Packet.Parser>().InSingletonScope(); kernel.Bind<Packet.Endpoint.IFactory>().To<Packet.Endpoint.Factory>().InSingletonScope(); kernel.Bind<Event.IMediator>().To<Event.Mediator>().InSingletonScope(); kernel.Bind<State.Event.IFactory>().To<State.Event.Factory>().InSingletonScope(); kernel.Bind<State.Context.IFactory>().To<State.Context.Factory>().InSingletonScope(); kernel.Bind<State.ITransition>().To<State.Transition>().InSingletonScope(); kernel.Bind<State.IFactory>().To<State.Factory>().InSingletonScope(); kernel.Bind<State.IMachine>().To<State.Machine>().InSingletonScope(); kernel.Bind<Entity.IFactory>().To<Entity.Factory>().InSingletonScope(); kernel.Bind<Entity.Observable.IFactory>().To<Entity.Observable.CurrentElectricityConsumptionFactory>().InSingletonScope(); kernel.Bind<Entity.Observable.IAbstractFactory>().To<Entity.Observable.AbstractFactory>().InSingletonScope(); kernel.Bind<IBridge>().To<Bridge>().InSingletonScope(); kernel.Bind<IInstance>().To<Instance>().InSingletonScope(); kernel.Bind<IContext>().To<Context>().InSingletonScope(); kernel.Bind<Settings.IProvider>().ToConstant(settingsProvider); kernel.Bind<Messaging.Client.IEndpoint>().ToConstant(clientEndpoint); return kernel.Get<IContext>(); }
public MPMediaItem GetItem(xint index) { using (var array = new NSArray(Messaging.IntPtr_objc_msgSend(Handle, Selector.GetHandle("items")))) return(array.GetItem <MPMediaItem> (index)); }
public void copy <F>(Messaging <F> right) { this.Message = right.Message; this.retType = right.retType; }
public void Subscribe( string channelName, int pollingInterval, AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions, AsyncCallback<Subscription> subscriptionCallback ) { checkChannelName( channelName ); if( pollingInterval < 0 ) throw new ArgumentException( ExceptionMessage.WRONG_POLLING_INTERVAL ); var responder = new AsyncCallback<string>( r => { Messaging.Subscription subscription = new Messaging.Subscription(); subscription.ChannelName = channelName; subscription.SubscriptionId = r; if( pollingInterval != 0 ) subscription.PollingInterval = pollingInterval; subscription.OnSubscribe( callback ); if( subscriptionCallback != null ) subscriptionCallback.ResponseHandler.Invoke( subscription ); }, f => { if( subscriptionCallback != null ) subscriptionCallback.ErrorHandler.Invoke( f ); else throw new BackendlessException( f ); } ); subscribeForPollingAccess( channelName, subscriptionOptions, responder ); }
public Messaging.Subscription Subscribe( string channelName, AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions ) { return Subscribe( channelName, 0, callback, subscriptionOptions ); }
public void Publish( object message, string channelName, Messaging.DeliveryOptions deliveryOptions, AsyncCallback<MessageStatus> callback ) { Publish( message, channelName, null, deliveryOptions, callback ); }
public virtual bool ConformsToProtocol(IntPtr protocol) { bool does; bool is_wrapper = IsDirectBinding; bool is_third_party; if (is_wrapper) { is_third_party = this.GetType().Assembly != NSObject.PlatformAssembly; if (is_third_party) { // Third-party bindings might lie about IsDirectBinding (see bug #14772), // so don't trust any 'true' values unless we're in monotouch.dll. var attribs = this.GetType().GetCustomAttributes(typeof(RegisterAttribute), false); if (attribs != null && attribs.Length == 1) { is_wrapper = ((RegisterAttribute)attribs [0]).IsWrapper; } } } #if MONOMAC if (is_wrapper) { does = Messaging.bool_objc_msgSend_IntPtr(this.Handle, selConformsToProtocolHandle, protocol); } else { does = Messaging.bool_objc_msgSendSuper_IntPtr(this.SuperHandle, selConformsToProtocolHandle, protocol); } #else if (is_wrapper) { does = Messaging.bool_objc_msgSend_IntPtr(this.Handle, Selector.GetHandle(selConformsToProtocol), protocol); } else { does = Messaging.bool_objc_msgSendSuper_IntPtr(this.SuperHandle, Selector.GetHandle(selConformsToProtocol), protocol); } #endif if (does) { return(true); } if (!Runtime.DynamicRegistrationSupported) { return(false); } object [] adoptedProtocols = GetType().GetCustomAttributes(typeof(AdoptsAttribute), true); foreach (AdoptsAttribute adopts in adoptedProtocols) { if (adopts.ProtocolHandle == protocol) { return(true); } } // Check if this class or any of the interfaces // it implements are protocols. if (IsProtocol(GetType(), protocol)) { return(true); } var ifaces = GetType().GetInterfaces(); foreach (var iface in ifaces) { if (IsProtocol(iface, protocol)) { return(true); } } return(false); }
public bool Execute(string arguments, int SenderID) { if (!PhotonNetwork.isMasterClient) { Messaging.Notification("Must be Host to use commands"); return(false); } string[] Args = arguments.Split(' '); bool ArgConvertSuccess = false; bool FloatConvertSuccess = false; int CommandArg = 0; float CommandFloat = 0f; if (Args.Length > 1) { ArgConvertSuccess = int.TryParse(Args[1], out CommandArg); FloatConvertSuccess = float.TryParse(Args[1], out CommandFloat); } switch (Args[0].ToLower()) { case "limit": if (ArgConvertSuccess) { Global.SavedFireCap = CommandArg; Global.FireCap = CommandArg; Global.SaveSettings(); Messaging.Notification($"Set fire limit to {CommandArg}"); } else { Messaging.Notification("Couldn't set fire limit, try using a number. ex: /if limit 30"); } break; case "o2rate": case "o2r": if (FloatConvertSuccess) { Global.O2Consumption = CommandFloat * .0005f; Global.SavedO2Consumption = Global.O2Consumption; Global.SaveSettings(); ModMessage.SendRPC("Dragon.InsaneFire", "InsaneFire.O2Rate", PhotonTargets.Others, new object[] { Global.O2Consumption }); //players who join after last message do not know new o2consumptionrate string o2percent = (CommandFloat * 100).ToString("000") + "%"; Messaging.Notification($"Set O2 consumption to {o2percent}"); } else { Messaging.Notification("Couldn't set o2 comsumption rate, try using a number. ex: /if o2rate .5"); } break; case "toggle": Global.PluginIsOn = !Global.PluginIsOn; if (Global.PluginIsOn) { Global.FireCap = Global.SavedFireCap; Global.O2Consumption = Global.SavedO2Consumption; } else { Global.FireCap = 20; Global.O2Consumption = 0.0005f; } foreach (PhotonPlayer player in ModMessageHelper.Instance.PlayersWithMods.Keys) //players who join after last message do not know new o2consumptionrate { if (ModMessageHelper.Instance.GetPlayerMods(player).Contains(ModMessageHelper.Instance.GetModName("InsaneFire"))) { ModMessage.SendRPC("Dragon.InsaneFire", "InsaneFire.O2Rate", player, new object[] { Global.O2Consumption }); } } Global.SaveSettings(); string message = Global.PluginIsOn ? "On" : "Off"; Messaging.Notification($"Plugin is now {message}"); break; case "dbg": Global.GetSettings(out bool b, out int i, out float f); Messaging.Notification($"on: {b} Firecap: {i} O2Cons: {f}\nCached: {Global.SavedFireCap} {Global.SavedO2Consumption}\nCurrent: {Global.PluginIsOn} {Global.FireCap} {Global.O2Consumption}"); break; default: Messaging.Notification("no Subcommand Detected. Subcommands: limit, o2Rate, toggle, dbg. capitalized letters can be initialized"); break; } return(false); }
public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements) { Messaging.DebugMessage("FairDummyCommand.Execute"); return(Result.Succeeded); }
public override void Execute(string arguments, int SenderID) { if (PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer().IsMasterClient) { IOrderedEnumerable <Tuple <PublicCommand, PulsarMod> > publicCommands = ChatCommandRouter.Instance.GetPublicCommands(); if (publicCommands.Count() <= 1) { return; } PLPlayer sender = PLServer.Instance.GetPlayerFromPlayerID(SenderID); int page = 1; if (!string.IsNullOrWhiteSpace(arguments)) { if (!int.TryParse(arguments, out page)) { if (arguments[0] == '!') { arguments = arguments.Substring(1); } Tuple <PublicCommand, PulsarMod> t = ChatCommandRouter.Instance.GetPublicCommand(arguments); if (t != null) { PublicCommand cmd = t.Item1; string name = t.Item2 != null ? t.Item2.Name : "Pulsar Mod Loader"; Messaging.Echo(sender, $"[&%~[C3 !{cmd.CommandAliases()[0]} ]&%~] - {cmd.Description()} <color=#ff6600ff>[{name}]</color>"); Messaging.Echo(sender, $"Aliases: !{string.Join($", !", cmd.CommandAliases())}"); Messaging.Echo(sender, $"Usage: {cmd.UsageExamples()[0]}"); for (int i = 1; i < cmd.UsageExamples().Length; i++) { Messaging.Echo(sender, $" {cmd.UsageExamples()[i]}"); } } else { Messaging.Echo(sender, $"Command !{arguments} not found"); } return; } } int commandsPerPage = 13 /*(PLXMLOptionsIO.Instance.CurrentOptions.GetStringValueAsInt("ChatNumLines") * 5 + 10) - 2*/; //Minimum value int pages = Mathf.CeilToInt(publicCommands.Count() / (float)commandsPerPage); page--; //Pages start from 1 if (page < 0) { page = 0; } string header = pages == 1 && page == 0 ? $"[&%~[C3 Available Commands: ]&%~]" : $"[&%~[C3 Available Commands: ]&%~] Page {page + 1} : {pages}"; Messaging.Echo(sender, header); for (int i = 0; i < commandsPerPage; i++) { int index = i + page * commandsPerPage; if (i + page * commandsPerPage >= publicCommands.Count()) { break; } PublicCommand command = publicCommands.ElementAt(index).Item1; Messaging.Echo(sender, $"!{command.CommandAliases()[0]} - {command.Description()}"); } Messaging.Echo(sender, "Use [&%~[C2 !help <command> ]&%~] for details about a specific command"); } }
private static bool IsMainThread() { return(Messaging.bool_objc_msgSend(GetClassHandle("NSThread"), new Selector("isMainThread").Handle)); }
protected override void OnDisable() { base.OnDisable(); Messaging <GameMessage> .RemoveAll(this); }
public void MessagingApi() { Messaging.monotouch_IntPtr_objc_msgSend_IntPtr(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); }
private Messaging.MessageStatus PublishSync( object message, string channelName, Messaging.PublishOptions publishOptions, Messaging.DeliveryOptions deliveryOptions ) { checkChannelName( channelName ); if( message == null ) throw new ArgumentNullException( ExceptionMessage.NULL_MESSAGE ); return Invoker.InvokeSync<Messaging.MessageStatus>( MESSAGING_MANAGER_SERVER_ALIAS, "publish", new[] { Backendless.AppId, Backendless.VersionNum, channelName, message, publishOptions, deliveryOptions } ); }
public void handle(Messaging message) { try { long id = message.sender.id; PayloadData payload = new PayloadData(message.postback.payload); //Console.WriteLine(payload); switch (payload.Payload) { case "GET_STARTED_PAYLOAD": rmanager.SendWelcomeMessage(id, payload.Language); break; case "SEND_LOCATION_CHOICE": rmanager.SendLocationsChoice(id, payload.Language); break; // tijd keuze extra case "SEND_DATE_CHOICE": rmanager.SendDateChoice(message.sender.id, payload.Language); break; case "DEVELOPER_DEFINED_DATE_SPECIFIC": rmanager.SendDayOption(message.sender.id, payload.Language); break; case "SEND_LANGUAGE_OPTIONS": rmanager.ChangeLanguage(message.sender.id); break; case "GET_TOILET": string[] co = payload.Value.Split(':'); SearchableLocation location = DataConstants.GetClosestsToilet(double.Parse(co[0]), double.Parse(co[1])); // Console.WriteLine($"Closest location found: {location.PrettyName} "); rmanager.SendGenericMessage(LocationFactory.MakeLocationResponse(id, location.Lat, location.Lon, payload.Language)); break; case "SET_LANGUAGE": rmanager.SendWelcomeMessage(id, payload.Value); break; case "GET_USER_LOCATION": if (!string.IsNullOrWhiteSpace(payload.Value) && payload.Value == "true") { TempUserData.Instance.Add(id, payload.Language, true); } else { TempUserData.Instance.Add(id, payload.Language, false); } rmanager.SendGetLocationButton(message.sender.id, payload.Language); break; case "DEVELOPER_DEFINED_SEARCHFALSE": rmanager.SendInfoForEnding(message.sender.id, payload.Language); break; case "GET_EVENT_HERE_NOW": rmanager.SendLocationQuery(id, int.Parse(payload.Value), payload.Language); break; case "DEVELOPER_DEFINED_LOCATION": if (payload.Value != "ALL") { RemoteDataManager.GetInstance().GetEventsHereNow(id, DataConstants.GetLocation(payload.Value).Id, DataConstants.Now, payload.Language); } else { RemoteDataManager.GetInstance().GetEventsNow(id, payload.Language, DataConstants.Now); } break; case "DEVELOPER_DEFINED_DAY": rmanager.SendTimePeriod(id, payload.Value, payload.Language); break; case "DEVELOPER_DEFINED_COORDINATES": string[] data = payload.Value.Split(':'); List <SearchableLocation> locatio = DataConstants.GetClosestLocation(new Coordinates { lat = double.Parse(data[1]), lon = double.Parse(data[0]) }, 3); // Console.WriteLine($"Closest location found: {location.PrettyName} "); rmanager.SendLocationResult(id, locatio, payload.Language); break; case "DEVELOPER_DEFINED_DESCRIPTION": rmanager.SendTextMessage(id, payload.Value); break; case "DEVELOPER_DEFINED_HOURS": string[] dat = payload.Value.Split('|'); rmanager.SendHoursChoice(id, dat[0], dat[1], payload.Language); break; case "DEVELOPER_DEFINED_HOURS_COMP": string[] da = payload.Value.Split('|'); payload.Value = $"{da[1]}{da[0]}:00+02:00"; //rmanager.SendTextMessage(id, value); //Console.WriteLine("Datum: " + payload.Value); RemoteDataManager.GetInstance().GetEventsAtTime(id, payload.Value, payload.Language); break; case "DEVELOPER_DEFINED_NEXT": // moet nog normaal gezet worden maar voor test gevallen is het deze tijd int pos = payload.Value.IndexOf("-_-"); RemoteDataManager.GetInstance().GetNextEvents(payload.Value.Substring(0, pos), payload.Value.Substring(pos + 3), 3, id, payload.Language); break; default: //do nothing break; } } catch (Exception ex) { Console.WriteLine(ex); } }
public Messaging.Subscription Subscribe( AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions ) { return Subscribe( DEFAULT_CHANNEL_NAME, callback, subscriptionOptions ); }
/// <summary> /// Unloads the handlers /// </summary> protected override void UnloadData() { base.UnloadData(); Messaging.Unregister(); CloseLogs(); }
public void Subscribe( int pollingInterval, AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions, AsyncCallback<Subscription> subscriptionCallback ) { Subscribe( DEFAULT_CHANNEL_NAME, pollingInterval, callback, subscriptionOptions, subscriptionCallback ); }
private static string _(string id) { return(Messaging.getMessage(id)); }
private void subscribeForPollingAccess( string channelName, Messaging.SubscriptionOptions subscriptionOptions, AsyncCallback<string> callback ) { checkChannelName( channelName ); if( subscriptionOptions == null ) subscriptionOptions = new Messaging.SubscriptionOptions(); Invoker.InvokeAsync( MESSAGING_MANAGER_SERVER_ALIAS, "subscribeForPollingAccess", new Object[] { Backendless.AppId, Backendless.VersionNum, channelName, subscriptionOptions }, callback ); }
public static void Main(string[] args) { Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(Cadencii_UnhandledException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // 引数を解釈 parseArguments(args); if (mPrintVersion) { Console.Write(BAssemblyInfo.fileVersion); return; } string file = mPathVsq; Logger.setEnabled(false); string logfile = PortUtil.createTempFile() + ".txt"; Logger.setPath(logfile); #if DEBUG Logger.setEnabled(true); #endif #if !DEBUG try { #endif // 言語設定を読み込み try { Messaging.loadMessages(); // システムのデフォルトの言語を調べる. // EditorConfigのコンストラクタは,この判定を自動でやるのでそれを利用 EditorConfig ec = new EditorConfig(); Messaging.setLanguage(ec.Language); } catch (Exception ex) { Logger.write(typeof(FormMain) + ".ctor; ex=" + ex + "\n"); serr.println("FormMain#.ctor; ex=" + ex); } // 開発版の場合の警告ダイアログ string str_minor = BAssemblyInfo.fileVersionMinor; int minor = 0; try { minor = int.Parse(str_minor); } catch (Exception ex) { } /*if ((minor % 2) != 0) { * AppManager.showMessageBox( * PortUtil.formatMessage( * _("Info: This is test version of Cadencii version {0}"), * BAssemblyInfo.fileVersionMeasure + "." + (minor + 1)), * "Cadencii_UTAU", * cadencii.windows.forms.Utility.MSGBOX_DEFAULT_OPTION, * cadencii.windows.forms.Utility.MSGBOX_INFORMATION_MESSAGE); * }*/ // スプラッシュを表示するスレッドを開始 #if !MONO splashThread = new Thread(new ThreadStart(showSplash)); splashThread.TrySetApartmentState(ApartmentState.STA); splashThread.Start(); #endif // AppManagerの初期化 AppManager.init(); #if ENABLE_SCRIPT try { ScriptServer.reload(); PaletteToolServer.init(); } catch (Exception ex) { serr.println("Cadencii::Main; ex=" + ex); Logger.write(typeof(Cadencii) + ".Main; ex=" + ex + "\n"); } #endif AppManager.mMainWindowController = new FormMainController(); AppManager.mMainWindow = new FormMain(AppManager.mMainWindowController, file); #if !MONO AppManager.mMainWindow.Load += mainWindow_Load; #endif Application.Run(AppManager.mMainWindow); #if !DEBUG } catch (Exception ex) { String str_ex = getExceptionText(ex, 0); FormCompileResult dialog = new FormCompileResult( _("Failed to launch Cadencii. Please send the exception report to developer"), str_ex); dialog.Text = _("Error"); dialog.ShowDialog(); if (splash != null) { splash.Invoke(new Action(splash.Close)); } Logger.write(typeof(Cadencii) + ".Main; ex=" + ex + "\n"); } #endif }
static int GetRetainCount(IntPtr @this) { return(Messaging.int_objc_msgSend(@this, Selector.RetainCount)); }
/// <summary> /// Неужели, так можно было /// </summary> static RebarDrawing() { Messaging.Tweet("Вызвали статический конструктор"); }
public MPMediaItemCollection GetCollection(xint index) { using (var array = new NSArray(Messaging.IntPtr_objc_msgSend(Handle, Selector.GetHandle("collections")))) return(array.GetItem <MPMediaItemCollection> (index)); }
public override void Execute(string arguments) { PhotonPlayer player = PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(); int page = 1; if (!string.IsNullOrWhiteSpace(arguments)) { if (!int.TryParse(arguments, out page)) { PulsarPlugin plugin = PluginManager.Instance.GetPlugin(arguments); if (plugin == null) { foreach (PulsarPlugin p in PluginManager.Instance.GetAllPlugins()) { if (p.HarmonyIdentifier().ToLower() == arguments.ToLower()) { plugin = p; break; } } } if (plugin != null) { Messaging.Echo(player, $"[&%~[C4 {plugin.Name} ]&%~] - {plugin.ShortDescription}"); Messaging.Echo(player, $"Version: {plugin.Version}"); if (!string.IsNullOrWhiteSpace(plugin.LongDescription)) { Messaging.Echo(player, plugin.LongDescription); } } else { Messaging.Echo(player, $"Plugin {arguments} not found"); } return; } } int pluginsPerPage = (PLXMLOptionsIO.Instance.CurrentOptions.GetStringValueAsInt("ChatNumLines") * 5 + 10) - 2; IOrderedEnumerable <PulsarPlugin> plugins = PluginManager.Instance.GetAllPlugins().OrderBy(t => t.Name); int pages = Mathf.CeilToInt(plugins.Count() / (float)pluginsPerPage); page--; //Pages start from 1 if (page < 0) { page = 0; } Messaging.Echo(player, pages == 1 && page == 0 ? "[&%~[C4 Plugin List: ]&%~] :" : $"[&%~[C4 Plugin List: ]&%~] Page {page + 1} : {pages}"); for (int i = 0; i < pluginsPerPage; i++) { int index = i + page * pluginsPerPage; if (i + page * pluginsPerPage >= plugins.Count()) { break; } PulsarPlugin plugin = plugins.ElementAt(index); Messaging.Echo(player, $"{plugin.Name} - {plugin.ShortDescription}"); } Messaging.Echo(player, "Use [&%~[C2 /plugin <plugin> ]&%~] for details about a specific plugin"); }
public void DidReceiveRegistrationToken(Messaging messaging, string fcmToken) => this.onToken(fcmToken);
public bool UsableUntilDeadImpl() { // This test ensure that the main thread can send messages to a garbage collected object, // until the final 'release' message for the managed reference has been sent // (on the main thread). var notifierHandle = IntPtr.Zero; // bool isDeallocated = false; Action deallocated = () => { //Console.WriteLine ("Final release!"); // isDeallocated = true; }; ManualResetEvent isCollected = new ManualResetEvent(false); Action collected = () => { //Console.WriteLine ("Garbage collected!"); isCollected.Set(); }; bool isNotified = false; Action notified = () => { //Console.WriteLine ("Notified"); isNotified = true; }; // Create an object whose handle we store in a local variable. We do not // store the object itself, since we want the object to be garbage collected. var t = new Thread(() => { var obj = new Notifier(collected, notified); ReleaseNotifier.NotifyWhenDeallocated(obj, deallocated); notifierHandle = obj.Handle; }) { IsBackground = true, }; t.Start(); t.Join(); // Now we have a handle to an object that may be garbage collected at any time. int counter = 0; do { GC.Collect(); GC.WaitForPendingFinalizers(); } while (counter++ < 10 && !isCollected.WaitOne(10)); // Now we have a handle to a garbage collected object. if (!isCollected.WaitOne(0)) { // Objects may randomly not end up collected (at least in Boehm), because // other objects may happen to contain a random value pointing to the // object we're waiting to become freed. return(false); } // Send a message to the collected object. Messaging.void_objc_msgSend(notifierHandle, Selector.GetHandle("notify")); Assert.IsTrue(isNotified, "notified"); // We're done. Cleanup. NSRunLoop.Main.RunUntil(NSDate.Now.AddSeconds(0.1)); // Don't verify cleanup, it's not consistent. // And in any case it's not what this test is about. // Assert.IsTrue (isDeallocated, "released"); return(true); }
public void ResurrectedObjectsDisposedTest(Type type) { #if __WATCHOS__ if (Runtime.Arch == Arch.DEVICE) { Assert.Ignore("This test uses too much memory for the watch."); } #endif var invokerClassHandle = Class.GetHandle(typeof(ResurrectedObjectsDisposedTestClass)); // Create a number of native objects with no managed wrappers. // We create more than one to try to minimize the random effects // of the GC (a random value somewhere can keep a single object // from being collected, but the chances of X random values keeping // X objects from being collected are much lower). // Also the consequences if the GC doesn't collect an object is // that the test unexpectedly succeeds. // 10 objects seem to be a fine number that will cause pretty much // all test executions to fail. var objects = new IntPtr [10]; for (int i = 0; i < objects.Length; i++) { objects [i] = Messaging.IntPtr_objc_msgSend(Messaging.IntPtr_objc_msgSend(Class.GetHandle(type), Selector.GetHandle("alloc")), Selector.GetHandle("init")); } // Create a thread that creates managed wrappers for all of the above native objects. // We do this on a separate thread so that the GC finds no pointers to the managed // objects in any thread. var t1 = new Thread(() => { for (int i = 0; i < objects.Length; i++) { Messaging.bool_objc_msgSend_IntPtr_int(invokerClassHandle, Selector.GetHandle("invokeMe:wait:"), objects [i], 0); } }); t1.Start(); t1.Join(); // Collect all those managed wrappers, and make sure their finalizers are executed. GC.Collect(); GC.WaitForPendingFinalizers(); // Now all the managed wrappers should be on NSObject's drain queue on the main thread. // Spin up a thread for every native object, and invoke a managed method // that will fetch the managed wrapper and then wait for a while (500ms), // before verifying that the managed object hasn't been disposed while waiting. var invokerWait = 500; var threads = new Thread [objects.Length]; var brokenCount = 0; var countdown = new CountdownEvent(threads.Length); for (int t = 0; t < threads.Length; t++) { var tt = t; var thread = new Thread(() => { var ok = Messaging.bool_objc_msgSend_IntPtr_int(invokerClassHandle, Selector.GetHandle("invokeMe:wait:"), objects [tt], invokerWait); if (!ok) { //Console.WriteLine ("Broken #{0}: 0x{1}", tt, objects [tt].ToString ("x")); Interlocked.Increment(ref brokenCount); } countdown.Signal(); }); thread.Start(); } // Now all those threads should be waiting. // Run the runloop on the main thread, which will drain the managed wrappers // on NSObject's drain queue. while (!countdown.IsSet) { NSRunLoop.Current.RunUntil((NSDate)DateTime.Now.AddSeconds(0.1)); } // Release all the native objects we created for (int i = 0; i < objects.Length; i++) { Messaging.void_objc_msgSend(objects [i], Selector.GetHandle("release")); } Assert.AreEqual(0, brokenCount, "broken count"); }
public void MenuMessaging(MenuStack menuStack) { menuMessaging.Update(); if (menuMessaging.AddItem("Show Messages & Invites", User.IsSignedInPSN && !Messaging.IsBusy())) { Messaging.ShowRecievedDataMessageDialog(); } if (menuMessaging.AddItem("Send Session Invite", User.IsSignedInPSN && Matching.InSession)) { string text = "Join my session"; int npIDCount = 8; Matching.InviteToSession(text, npIDCount); } if (menuMessaging.AddItem("Send Game Invite", User.IsSignedInPSN && !Messaging.IsBusy())) { GameInviteData gameInviteData = new GameInviteData(); gameInviteData.taunt = "I got an awesome score, can you do better?"; gameInviteData.level = 1; gameInviteData.score = 123456789; byte[] data = gameInviteData.WriteToBuffer(); Messaging.MsgRequest msgRequest = new Messaging.MsgRequest(); msgRequest.body = "Game invite"; msgRequest.expireMinutes = 30; msgRequest.data = data; msgRequest.npIDCount = 8; string dataDescription = "Some data to test invite messages"; string dataName = "Test data"; msgRequest.dataDescription = dataDescription; msgRequest.dataName = dataName; msgRequest.iconPath = Application.streamingAssetsPath + "/PSP2SessionImage.jpg"; Messaging.SendMessage(msgRequest); } if (menuMessaging.AddItem("Send Data Message", User.IsSignedInPSN && !Messaging.IsBusy())) { GameData gameData = default(GameData); gameData.text = "Here's some data"; gameData.item1 = 2; gameData.item2 = 987654321; byte[] data2 = gameData.WriteToBuffer(); Messaging.MsgRequest msgRequest2 = new Messaging.MsgRequest(); msgRequest2.body = "Data message"; msgRequest2.expireMinutes = 0; msgRequest2.data = data2; msgRequest2.npIDCount = 8; string dataDescription2 = "Some data to test messages"; string dataName2 = "Test data"; msgRequest2.dataDescription = dataDescription2; msgRequest2.dataName = dataName2; msgRequest2.iconPath = Application.streamingAssetsPath + "/PSP2SessionImage.jpg"; Messaging.SendMessage(msgRequest2); } if (menuMessaging.AddItem("Send In Game Data (Session)", Matching.InSession && !Messaging.IsBusy())) { Matching.Session session = Matching.GetSession(); Matching.SessionMemberInfo[] members = session.members; if (members == null) { return; } int num = -1; for (int i = 0; i < members.Length; i++) { if ((members[i].memberFlag & Matching.FlagMemberType.MEMBER_MYSELF) == 0) { num = i; break; } } if (num >= 0) { OnScreenLog.Add("Sending in game data message to " + members[num].npOnlineID); GameData gameData2 = default(GameData); gameData2.text = "Here's some data"; gameData2.item1 = 2; gameData2.item2 = 987654321; byte[] data3 = gameData2.WriteToBuffer(); Messaging.SendInGameDataMessage(members[num].npID, data3); } else { OnScreenLog.Add("No session member to send to."); } } if (menuMessaging.AddItem("Send In Game Message (Friend)", User.IsSignedInPSN && !Messaging.IsBusy())) { Friends.Friend[] cachedFriendsList = Friends.GetCachedFriendsList(); if (cachedFriendsList.Length > 0) { int num2 = 0; if (num2 >= 0) { OnScreenLog.Add("Sending in game data message to " + cachedFriendsList[num2].npOnlineID); GameData gameData3 = default(GameData); gameData3.text = "Here's some data"; gameData3.item1 = 2; gameData3.item2 = 987654321; byte[] data4 = gameData3.WriteToBuffer(); Messaging.SendInGameDataMessage(cachedFriendsList[num2].npID, data4); } else { OnScreenLog.Add("No friends in this context."); } } else { OnScreenLog.Add("No friends cached."); OnScreenLog.Add("refresh the friends list then try again."); } } if (menuMessaging.AddBackIndex("Back")) { menuStack.PopMenu(); } }
public Messaging.MessageStatus Publish( object message, string channelName, Messaging.PublishOptions publishOptions, Messaging.DeliveryOptions deliveryOptions ) { return PublishSync( message, channelName, publishOptions, deliveryOptions ); }
private void OnMessageError(Messages.PluginMessage msg) { OnScreenLog.Add(" OnMessageError error code: " + Messaging.GetErrorFromMessage(msg).ToString("X")); }
public void Publish( object message, string channelName, Messaging.PublishOptions publishOptions, AsyncCallback<MessageStatus> callback ) { Publish( message, channelName, publishOptions, null, callback ); }
static void Main(string[] args) { MyClient my_client = new MyClient(); MyClient.InnitMethods(); Console.WriteLine("Bonjour Client !"); //entering the commands loop bool continuer = true; while (continuer) { try { Console.WriteLine("Que voulez-vous faire?" + "\n\t0-envoyer un message" + "\n\t1-demander les utilisateurs connectés" + "\n\t2-changer de UserName" + "\n\t3-afficher les utilisateurs connectés" + "\n\t4-afficher les rêquetes de match" + "\n\t5-répondre à une requête de match" + "\n\t6-exprimer une requête de match" + "\n\t7-se déconnecter" + "\n\t8-se connecter" + "\n\t9-afficher l'id de l'adversaire" + "\n\t10-actualiser le plateau" + "\n\t11-afficher le plateau" + "\n\t12-Jouer une position"); string choice = Console.ReadLine(); if (choice == "0") { Console.WriteLine("entrez un message"); string message = Console.ReadLine(); Messaging.SendMessage(my_client, message); } else if (choice == "1") { Messaging.AskOtherUsers(my_client); Console.WriteLine("La demande a été émise"); } else if (choice == "2") { Console.WriteLine("entrez un nom d'utilisateur"); string userName = Console.ReadLine(); Messaging.SendUserName(my_client, userName); } else if (choice == "3") { my_client.DisplayOtherUser(); } else if (choice == "4") { my_client.DisplayMatchRequest(); } else if (choice == "5") { Console.WriteLine("entrez l'id de l'adversaire:"); int id = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("entrez votre réponse:"); bool accepted = Convert.ToBoolean(Console.ReadLine()); Messaging.SendGameRequestResponse(my_client, id, accepted); } else if (choice == "6") { Console.WriteLine("Entrez l'id de l'adversaire souhaité:"); int id = Convert.ToInt32(Console.ReadLine()); Messaging.RequestMatch(my_client, id); Console.WriteLine("Requête envoyée"); } else if (choice == "7") { my_client.tryDisconnect(); } else if (choice == "8") { my_client.tryConnect(); Console.WriteLine($"Connected to the server {my_client.Ip}"); } else if (choice == "9") { if (my_client.Opponent != null) { Console.WriteLine($"L'id de votre adversaire est: {my_client.Opponent.Id} et son user name est: {my_client.Opponent.UserName}"); } else { Console.WriteLine($"Aucun adversaire n'est attribué"); } } else if (choice == "10") { Messaging.AskGameBoard(my_client); Console.WriteLine($"Requête envoyée"); } else if (choice == "11") { my_client.DisplayGameBoard(); } else if (choice == "12") { Console.WriteLine($"my_client.GameClient.Mode : {my_client.GameClient.Mode }; GameMode.Player1: {GameMode.Player1}; GameMode.Player2 : {GameMode.Player2}"); Console.WriteLine($"my_client.GameClient.IdPlayer1 : {my_client.GameClient.IdPlayer1 }; my_client.GameClient.IdPlayer2: {my_client.GameClient.IdPlayer2}; my_client.Opponent.Id : {my_client.Opponent.Id}"); { Vector3 position = new Vector3(); int x = 0; int y = 0; int z = 0; Console.WriteLine("Quelle est la coordonnee x (0,1 ou 2) de la position que vous voulez jouer ? (La couche)"); x = (int.Parse(Console.ReadLine())); position.X = x; Console.WriteLine("Quelle est la coordonnee y (0,1 ou 2) de la position que vous voulez jouer ? (la ligne) "); y = (int.Parse(Console.ReadLine())); position.Y = y; Console.WriteLine("Quelle est la coordonnee z (0,1 ou 2) de la position que vous voulez jouer ? (la colonne)"); z = (int.Parse(Console.ReadLine())); position.Z = z; Messaging.SendPositionPlayer(my_client, position); } } else { Console.WriteLine("Commande inconnue"); } } catch (System.IO.IOException ex) { Console.WriteLine("You have been disconnected from the server, please connect again"); my_client.tryDisconnect(); } } }
public void Publish( object message, string channelName, Messaging.PublishOptions publishOptions, Messaging.DeliveryOptions deliveryOptions, AsyncCallback<MessageStatus> callback ) { checkChannelName( channelName ); if( message == null ) throw new ArgumentNullException( ExceptionMessage.NULL_MESSAGE ); Invoker.InvokeAsync( MESSAGING_MANAGER_SERVER_ALIAS, "publish", new[] { Backendless.AppId, Backendless.VersionNum, channelName, message, publishOptions, deliveryOptions }, callback ); }
/// <summary> /// Configures the handler that will handle the messaging.poke request /// </summary> /// <param name="handler"></param> public void Subscribe(Messaging.PokeDelegate handler) { messagingDotPokeDelegate = handler; }
public Messaging.Subscription Subscribe( int pollingInterval, AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions ) { return Subscribe( DEFAULT_CHANNEL_NAME, pollingInterval, callback, subscriptionOptions ); }
/// <summary> /// Configures the handler that will handle the messaging.flow_member_result request /// </summary> /// <param name="handler"></param> public void Subscribe(Messaging.FlowMemberResultDelegate handler) { messagingDotFlowMemberResultDelegate = handler; }
public Messaging.Subscription Subscribe( string channelName, int pollingInterval, AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions ) { checkChannelName( channelName ); if( pollingInterval < 0 ) throw new ArgumentException( ExceptionMessage.WRONG_POLLING_INTERVAL ); string subscriptionId = subscribeForPollingAccess( channelName, subscriptionOptions ); Messaging.Subscription subscription = new Messaging.Subscription(); subscription.ChannelName = channelName; subscription.SubscriptionId = subscriptionId; if( pollingInterval != 0 ) subscription.PollingInterval = pollingInterval; subscription.OnSubscribe( callback ); return subscription; }
public NSData Encode(NSStringEncoding enc) { return(new NSData(Messaging.IntPtr_objc_msgSend_int_int(Handle, selDataUsingEncodingAllow, (int)enc, 0))); }
public void Subscribe( string channelName, AsyncCallback<List<Message>> callback, Messaging.SubscriptionOptions subscriptionOptions, AsyncCallback<Subscription> subscriptionCallback ) { Subscribe( channelName, 0, callback, subscriptionOptions, subscriptionCallback ); }
public static int SendSymbol(string recv, string sym) { return(Messaging.send_symbol(recv, sym)); }
private string subscribeForPollingAccess( string channelName, Messaging.SubscriptionOptions subscriptionOptions ) { checkChannelName( channelName ); if( subscriptionOptions == null ) subscriptionOptions = new Messaging.SubscriptionOptions(); return Invoker.InvokeSync<string>( MESSAGING_MANAGER_SERVER_ALIAS, "subscribeForPollingAccess", new Object[] { Backendless.AppId, Backendless.VersionNum, channelName, subscriptionOptions } ); }
static IntPtr RetainTrampoline(IntPtr @this, IntPtr sel) { int ref_count = Messaging.int_objc_msgSend(@this, Selector.RetainCount); NSObject obj = null; #if DEBUG_REF_COUNTING bool had_managed_ref = HasManagedRef(@this); int pre_gchandle = GetGCHandle(@this); #endif /* * We need to decide if the gchandle should become a strong one. * This happens if managed code has a ref, and the current refcount is 1. */ if (ref_count == 1) { obj = Runtime.TryGetNSObject(@this); if (obj != null && obj.has_managed_ref) { obj.SwitchGCHandle(false /* strong */); } } @this = InvokeObjCMethodImplementation(@this, sel); #if DEBUG_REF_COUNTING Console.WriteLine("RetainTrampoline ({0} Handle=0x{1}) initial retainCount={2}; new retainCount={3} HadManagedRef={4} HasManagedRef={5} old GCHandle={6} new GCHandle={7}", Class.GetName(Messaging.intptr_objc_msgSend(@this, Selector.GetHandle("class"))), @this.ToString("x"), ref_count, Messaging.int_objc_msgSend(@this, Selector.RetainCount), had_managed_ref, HasManagedRef(@this), pre_gchandle, GetGCHandle(@this)); #endif return(@this); }
// NSArray<NSNumber> => nint[] internal static nint[] ConvertArray(IntPtr handle) { return(NSArray.ArrayFromHandle <nint> (handle, (v) => Messaging.nint_objc_msgSend(v, Selector.GetHandle("integerValue")))); }
public NSData Encode(NSStringEncoding enc, bool allowLossyConversion) { return(new NSData(Messaging.IntPtr_objc_msgSend_int_int(Handle, selDataUsingEncodingAllow, (int)enc, allowLossyConversion ? 1 : 0))); }
/// <summary> /// Configures the handler that will handle the messaging.form_update request /// </summary> /// <param name="handler"></param> public void Subscribe(Messaging.FormUpdateDelegate handler) { messagingDotFormUpdateDelegate = handler; }
public static int SendBang(string recv) { return(Messaging.send_bang(recv)); }
/// <summary> /// Processes the specified message. /// </summary> /// <param name="message">The message.</param> /// <exception cref="System.NotImplementedException"></exception> public void Consume(Messaging.Models.MediaMessage message) { throw new NotImplementedException(); }
public static int SendFloat(string recv, float x) { return(Messaging.send_float(recv, x)); }