public DetailsWindow(ApplicationDetails details) { InitializeComponent(); displayNameTextBox.Text = details.Name; pathTextBox.Text = details.Path; argumentsTextBox.Text = details.Arguments; ApplicationDetails = details; }
public DetailsWindow(string path) { InitializeComponent(); string filename = System.IO.Path.GetFileName(path); displayNameTextBox.Text = filename; pathTextBox.Text = path; ApplicationDetails = null; }
private void OnButtonClickedEdit(object sender, RoutedEventArgs e) { MenuItem sen = (MenuItem)sender; ApplicationDetails detail = (ApplicationDetails)sen.DataContext; DetailsWindow detailsDialog = new DetailsWindow(detail); bool? success = detailsDialog.ShowDialog(); if (success == true && detailsDialog.ApplicationDetails != null) { WriteToDisk(); } }
private void OnButtonClickedDelete(object sender, RoutedEventArgs e) { MenuItem sen = (MenuItem)sender; ApplicationDetails detail = (ApplicationDetails)sen.DataContext; MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure you want to delete the selected item?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { Programs.Remove(detail); detail.DeleteIcon(); WriteToDisk(); } }
private void Save() { if (ApplicationDetails == null) { ApplicationDetails = new ApplicationDetails { Name = displayNameTextBox.Text, Path = pathTextBox.Text, Arguments = argumentsTextBox.Text }; } else { ApplicationDetails.Name = displayNameTextBox.Text; ApplicationDetails.Path = pathTextBox.Text; ApplicationDetails.Arguments = argumentsTextBox.Text; } DialogResult = true; }