示例#1
0
 private void InitializeCommands()
 {
     LoginTempCommand = new RelayCommand(async() =>
     {
         var u       = await DataService.LoginTemp();
         CurrentUser = u.user;
     });
     GetIdeasCommand = new RelayCommand(async() => await LoadIdeas());
     IdeaTapCommand  = new RelayCommand <ItemClickEventArgs>(async args =>
     {
         var clickedItem = args.ClickedItem as DJIdea;
         try
         {
             if (clickedItem.type == "listing")
             {
                 App.ViewModelLocator.Listing.CurrentListing = clickedItem.listing;
                 NavigationService.NavigateTo(typeof(ListingViewModel).FullName);
             }
             else if (clickedItem.type == "story")
             {
                 App.ViewModelLocator.Story.CurrentStory = await DataService.LoadStory(clickedItem.story.id);
                 NavigationService.NavigateTo(typeof(StoryViewModel).FullName);
             }
         }
         catch (Exception ex)
         {
             await new MessageDialog(ex.Message).ShowAsync();
         }
     });
     HamburgerClickCommand = new RelayCommand(async() =>
     {
         await AppDataService.SaveRemoteSettings();
         if (true)
         {
             var test  = await AppDataService.LoadRemoteSettings();
             TestValue = test.test_value;
         }
     });
 }