예제 #1
0
        private void menuRemoveGroup_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new AddGroupWindow()
            {
                Title = "Remove group"
            };
            var result = dlg.ShowDialog();

            if (result == null || result.Value == false)
            {
                return;
            }

            foreach (var item in groups)
            {
                if (item.Id == dlg.groupId)
                {
                    groups.Remove(item);
                }
            }
            foreach (var item in menuGroups.Items)
            {
                try
                {
                    if ((item as MenuItem).Header.ToString().Contains(dlg.groupId))
                    {
                        menuGroups.Items.Remove(item);
                    }
                }
                catch
                {
                }
            }
        }
예제 #2
0
        private void menuAddGroup_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new AddGroupWindow()
            {
                Title = "Add group"
            };
            var result = dlg.ShowDialog();

            if (result == null || result.Value == false)
            {
                return;
            }
            var tmp = new MenuItem()
            {
                Header = dlg.groupName + '|' + dlg.groupId
            };

            tmp.Click += menuEnterRoom_Click;

            menuGroups.Items.Add(tmp);
            groups.Add(new Contact(dlg.groupId, dlg.groupName));
            //comboboxGroups.Items.Add(dlg.groupName);
            SaveGroups();
        }