コード例 #1
0
        private void CreateNewGroupButton_Click(object sender, RoutedEventArgs e) // Клик по кнопке "создать новую группу"
        {
            CreateGroupWindow createGroupWindow = new CreateGroupWindow();

            if (createGroupWindow.ShowDialog() == true)
            {
                ShowGroups();
            }
        }
コード例 #2
0
        /// <summary>
        /// Executing command.
        /// </summary>
        /// <param name="mainWindowVM">View-model of main window.</param>
        protected override void Execute(MainWindowVM mainWindowVM)
        {
            var createGroupWindowVM = new GroupWindowVM();
            var createGroupWindow   = new CreateGroupWindow
            {
                DataContext = createGroupWindowVM
            };

            if (createGroupWindow.ShowDialog() != true)
            {
                return;
            }

            var groupName = createGroupWindowVM.GroupName;

            mainWindowVM.GroupNames.Add(groupName);
            mainWindowVM.ContactService.CreateGroup(groupName);
        }
コード例 #3
0
        public static bool GroupEdit(Group group)
        {
            var viewModel = new GroupEditWindowModel(group);
            var view      = new CreateGroupWindow
            {
                DataContext           = viewModel,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            if (view.ShowDialog() != true)
            {
                return(false);
            }

            group.Name = viewModel.Name;

            return(true);
        }