예제 #1
0
        private async void OnPublishMessage(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

            await service.SendMessageAsync(args.Arguments.First());

            deferral.Complete();
        }
예제 #2
0
        private async void OnQueryProfile(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

            await service.GetNameAsync();

            deferral.Complete();
        }
예제 #3
0
        private async void OnUpdateProfile(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

            await service.SetNameAsync(args.Arguments.First());

            deferral.Complete();
        }
예제 #4
0
        /*private async void OnJoinRoomMessage(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
         * {
         *  var deferral = args.GetDeferral();
         *
         *  if (0 <= args.Arguments.Count)
         *  {
         * //                await userProvider.JoinRoomAsync(args.Arguments.First());
         *      args.Console.WriteLine("Join-Room: Ok", LogLevel.Success);
         *  }
         *  else
         *  {
         *      args.Console.WriteLine("Join-Room: Unknown error.", LogLevel.Error);
         *  }
         *
         *  deferral.Complete();
         * }*/

/*
 *      private void OnPollRoomMessage(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
 *      {
 *          var deferral = args.GetDeferral();
 *
 *          if (args.Options.Any(option => "disable" == option.Item1))
 *          {
 *              if (null == cts)
 *              {
 *                  args.Console.WriteLine("Poll-Room: Polling not started.", LogLevel.Error);
 *              }
 *              else
 *              {
 *                  cts.Cancel();
 *                  args.Console.WriteLine("Poll-Room: Cancel requested.", LogLevel.Information);
 *              }
 *          }
 *          else if (args.Options.Any(option => "enable" == option.Item1))
 *          {
 * //                cts = new CancellationTokenSource();
 * //                userProvider.Poll(cts.Token);
 *              args.Console.WriteLine("Poll-Room: Polling started.", LogLevel.Success);
 *          }
 *
 *          deferral.Complete();
 *      }
 */

/*
 *      private async void OnMessageReceived(UserProvider sender, ReceivingMessageEventArgs args)
 *      {
 *          var print = new DispatchedHandler(() =>
 *          {
 *              foreach (var message in args.Messages)
 *              {
 *                  CommandWindow.WriteLine(message.PublisherNick + " say:", LogLevel.Information);
 *                  CommandWindow.WriteLine(message.Text, LogLevel.Information);
 *              }
 *          });
 *
 *          if (Dispatcher.HasThreadAccess)
 *          {
 *              print.Invoke();
 *          }
 *          else
 *          {
 *              await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, print);
 *          }
 *      }
 */

/*
 *      private async void OnPollingCancelled(UserProvider sender, PollingCancelledEventArgs args)
 *      {
 *          var print = new DispatchedHandler(() =>
 *          {
 *                  CommandWindow.WriteLine("Poll-Room: Room polling stopped", LogLevel.Information);
 *          });
 *
 *          if (Dispatcher.HasThreadAccess)
 *          {
 *              print.Invoke();
 *          }
 *          else
 *          {
 *              await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, print);
 *          }
 *      }
 */

        private void OnClearMessage(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

            args.Console.Clear();

            deferral.Complete();
        }