/// <summary> /// Shows the game in the view. /// </summary> /// <param name="viewModel">The view model to show.</param> private void ShowGame(GameViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; GameView view = new GameView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Shows the item in the view. /// </summary> /// <param name="viewModel">The view model to show.</param> private void ShowPublisher(PublisherViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; window.Height = 150; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; PublisherView view = new PublisherView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Edit the current account that is being viewed. /// </summary> private void EditAccount() { AccountViewModel viewModel = new AccountViewModel(this.account, this.repository, null); WorkspaceWindow window = new WorkspaceWindow(); window.Width = 650; window.Height = 425; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; AccountView view = new AccountView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Shows the receipts tied to the logged in account. /// </summary> private void ShowReceipts() { MultiReceiptViewModel viewModel = new MultiReceiptViewModel(this.repository, this.account); WorkspaceWindow window = new WorkspaceWindow(); window.Width = 500; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; MultiReceiptView view = new MultiReceiptView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Views the friend's public account. /// </summary> private void ViewFriend() { string username = this.AllFriends.SingleOrDefault(vm => vm.IsSelected).Username; ////IEnumerable<AccountViewModel> friend = //// from a in this.repository.GetAccounts() //// where a.Username == username //// select new AccountViewModel(a, this.repository, null); List <Account> friends = this.repository.GetAccounts(); AccountViewModel viewModel = null; for (int i = 0; i < friends.Count(); i++) { if (friends[i].Username == username) { viewModel = new AccountViewModel(friends[i], this.repository, null); } } if (viewModel != null) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 500; window.Height = 300; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; PublicAccountView view = new PublicAccountView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); if (window.DialogResult == true) { this.Update(); } } }
/// <summary> /// Actions taken on the startup of the application. /// </summary> /// <param name="e">The startup of the application.</param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); LoginViewModel viewModel = new LoginViewModel(); LoginView view = new LoginView(); WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; #if DEBUG window.Width = 550; #endif window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Shows the item in the view. /// </summary> /// <param name="viewModel">The view model to show.</param> private void ShowFriend(AddFriendViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 500; window.Height = 400; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; FriendView view = new FriendView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); if (window.DialogResult == true) { this.Update(); } }