예제 #1
0
 public static void BlockUser(string userId)
 {
     try
     {
         IUserService userservice = AuthenticatedRestFactory.GetUserService();
         userservice.BlockUser(userId).Wait();
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #2
0
 public static async Task <User> GetCurrentUser()
 {
     try
     {
         IUserService userService = AuthenticatedRestFactory.GetUserService();
         return(await userService.GetCurrentUser());
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(Storage.Cache.CurrentUser.Raw);
 }
예제 #3
0
 public static async Task <IEnumerable <SharedModels.UserGuild> > GetGuilds()
 {
     try
     {
         IUserService userservice = AuthenticatedRestFactory.GetUserService();
         return(await userservice.GetCurrentUserGuilds());
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(null);
 }
예제 #4
0
 public static async Task <UserProfile> GetUserProfile(string id)
 {
     try
     {
         IUserService userservice = AuthenticatedRestFactory.GetUserService();
         return(await userservice.GetUserProfile(id));
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(new SharedModels.UserProfile());
 }
예제 #5
0
 public static async Task <IEnumerable <SharedFriend> > GetUserRelationShips(string id)
 {
     try
     {
         IUserService userservice = AuthenticatedRestFactory.GetUserService();
         return(await userservice.GetUserReleations(id));
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(null);
 }
예제 #6
0
 public static async Task <IEnumerable <DirectMessageChannel> > GetDMs()
 {
     try
     {
         IUserService userService = AuthenticatedRestFactory.GetUserService();
         return(await userService.GetCurrentUserDirectMessageChannels());
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(null);
 }
예제 #7
0
 public static async Task <User> GetUser(string userid)
 {
     try
     {
         IUserService userService = AuthenticatedRestFactory.GetUserService();
         return(await userService.GetUser(userid));
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(new User());
 }
예제 #8
0
 public static async Task <IEnumerable <SharedModels.Message> > GetRecentMentions(int limit, bool ShowRoles, bool ShowEveryone)
 {
     try
     {
         IUserService userservice = AuthenticatedRestFactory.GetUserService();
         return(await userservice.GetRecentMentions(limit, ShowRoles, ShowEveryone));
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(null);
 }
예제 #9
0
 public static void AddNote(string userid, string note)
 {
     try
     {
         IUserService channelservice = AuthenticatedRestFactory.GetUserService();
         channelservice.AddNote(userid, new Note()
         {
             note = note
         }).Wait();
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #10
0
 public static async void ChangeCurrentGame(string game)
 {
     try
     {
         await Task.Run(() =>
         {
             IUserService userservice = AuthenticatedRestFactory.GetUserService();
             userservice.UpdateGame("{\"name\":\"" + game + "\"}").Wait();
         });
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #11
0
 public static void ModifyCurrentUser(string newUsername)
 {
     try
     {
         ModifyUser modifyuser = new ModifyUser();
         modifyuser.Username = newUsername;
         IUserService             userService = AuthenticatedRestFactory.GetUserService();
         Task <SharedModels.User> userTask    = userService.ModifyCurrentUser(modifyuser);
         userTask.Wait();
         Storage.Cache.CurrentUser = new CacheModels.User(userTask.Result);
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #12
0
 public static async void ChangeUserSettings(string settings)
 {
     try
     {
         await Task.Run(() =>
         {
             Gateway.UpdateStatus(settings, 0, null);
             IUserService userservice = AuthenticatedRestFactory.GetUserService();
             userservice.UpdateSettings("{\"status\":\"" + settings + "\"}").Wait();
         });
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #13
0
        private Task <bool> Login()
        {
            Messenger.Default.Send(new ConnectionStatusMessage(ConnectionStatus.Connecting));

            IAuthenticator           authenticator            = new DiscordAuthenticator(_accessToken);
            AuthenticatedRestFactory authenticatedRestFactory = new AuthenticatedRestFactory(new DiscordApiConfiguration()
            {
                BaseUrl = "https://discordapp.com/api"
            }, authenticator);

            ActivitesService   = authenticatedRestFactory.GetActivitesService();
            ChannelService     = authenticatedRestFactory.GetChannelService();
            ConnectionsService = authenticatedRestFactory.GetConnectionService();
            GameService        = authenticatedRestFactory.GetGameService();
            GuildService       = authenticatedRestFactory.GetGuildService();
            InviteService      = authenticatedRestFactory.GetInviteService();
            MiscService        = authenticatedRestFactory.GetMiscService();
            UserService        = authenticatedRestFactory.GetUserService();
            VoiceService       = authenticatedRestFactory.GetVoiceService();

            return(_gatewayService.InitializeGateway(_accessToken));
        }
예제 #14
0
        public static void CreateDM(CreateDM createDM)
        {
            IUserService userservice = AuthenticatedRestFactory.GetUserService();

            userservice.CreateDirectMessageChannelForCurrentUser(createDM).Wait();
        }
예제 #15
0
        public static void LeaveServer(string guildId)
        {
            IUserService userservice = AuthenticatedRestFactory.GetUserService();

            userservice.LeaveGuild(guildId).Wait();
        }