示例#1
0
 private void OnSetUserProfile(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
 {
     /*var deferral = args.GetDeferral();
      *
      * if (null == profile)
      * {
      *  args.Console.WriteLine("Set-QueryProfileResponse: Get-QueryProfileResponse command sould be executed first.", LogLevel.Error);
      * }
      * else
      * {
      *  var arg = args.Arguments.First();
      *
      *  if (args.Options.Any(option => "name" == option.Item1))
      *  {
      *      profile.Name = arg;
      *      args.Console.WriteLine("Set-QueryProfileResponse: Name updated", LogLevel.Success);
      *  }
      *  else if (args.Options.Any(option => "id" == option.Item1))
      *  {
      *      profile.Id = Guid.Parse(arg);
      *      args.Console.WriteLine("Set-QueryProfileResponse: Id updated", LogLevel.Success);
      *  }
      * }
      *
      * deferral.Complete();*/
 }
示例#2
0
        private async void OnPublishMessage(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

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

            deferral.Complete();
        }
示例#3
0
        private async void OnQueryProfile(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

            await service.GetNameAsync();

            deferral.Complete();
        }
示例#4
0
        private async void OnUpdateProfile(ConsoleCommand sender, ExecuteConsoleCommandEventArgs args)
        {
            var deferral = args.GetDeferral();

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

            deferral.Complete();
        }
示例#5
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();
        }