Beispiel #1
0
        private async void OnAddClick(object sender, RoutedEventArgs e)
        {
            try
            {
                AddOrEditTeam.ShowEditDialog(this, false);
                var viewModel = (EditTeamsDialogViewModel)FindResource("EditTeamsDialogViewModel");
                await viewModel.LoadTeams();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowError(ex, "EditHelper.OnAddClick()");
            }

            list.Items.Refresh();
        }
Beispiel #2
0
        public static void ShowEditDialog(Window owner, bool isEdit)
        {
            var edit = new AddOrEditTeam
            {
                Owner = owner,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                IsEdit = isEdit,
            };

            var viewModel = (AddOrEditTeamViewModel)edit.FindResource("AddOrEditTeamViewModel");

            edit.text.Focus();

            if (isEdit)
            {
                viewModel.InitializeValues();
                edit.text.SelectAll();
            }

            edit.ShowDialog();
        }