コード例 #1
0
        private void AccordianGroupBoxControl_Maximized(object sender, RoutedEventArgs e)
        {
            AccordianGroupBoxControl control = (AccordianGroupBoxControl)sender;

            if (control.Content != null)
            {
                FrameworkElement content = (FrameworkElement)control.Content;
                if (content != null)
                {
                    CommandGroupControlViewModel group = (CommandGroupControlViewModel)content.DataContext;
                    if (group != null)
                    {
                        group.IsMinimized = false;
                    }
                }
            }
        }
        public void AddCommand(CommandModelBase command)
        {
            this.RemoveCommand(command);

            foreach (CommandGroupControlViewModel group in this.CommandGroups)
            {
                if (string.Equals(group.GroupName, command.GroupName))
                {
                    group.AddCommand(command);
                    this.NotifyProperties();
                    return;
                }
            }

            CommandGroupSettingsModel groupSettings = null;

            if (!string.IsNullOrEmpty(command.GroupName) && ChannelSession.Settings.CommandGroups.ContainsKey(command.GroupName))
            {
                groupSettings = ChannelSession.Settings.CommandGroups[command.GroupName];
            }

            CommandGroupControlViewModel viewModel = new CommandGroupControlViewModel(groupSettings, new List <CommandModelBase>()
            {
                command
            });

            if (groupSettings != null)
            {
                for (int i = 0; i < this.CommandGroups.Count; i++)
                {
                    if (string.Compare(groupSettings.Name, this.CommandGroups[i].DisplayName, ignoreCase: true) < 0)
                    {
                        this.CommandGroups.Insert(i, viewModel);
                        this.NotifyProperties();
                        return;
                    }
                }
            }

            this.CommandGroups.Add(viewModel);
            this.NotifyProperties();
        }