Beispiel #1
0
 private void AddAllCheckedChildNodes(TreeNode treeNode, bool bApplications)
 {
     foreach (TreeNode node in treeNode.Nodes)
     {
         if (node.Nodes.Count > 0)
         {
             // If the current node has child nodes, call the CheckAllChildsNodes method recursively.
             AddAllCheckedChildNodes(node, bApplications);
         }
         else
         {
             if (node.Checked)
             {
                 if (bApplications)
                 {
                     //SelectedApplicationsList.Add(node.Text);
                     ApplicationItems Items = new ApplicationItems();
                     Items.ApplicationName = node.Text;
                     Items.Manufacturer    = node.Parent.Text;
                     LastSavedSelectionItem.ApplicationItemList.Add(Items);
                 }
                 else
                 {
                     LastSavedSelectionItem.LocationNames.Add(node.Text);
                 }
             }
             else
             {
             }
         }
     }
 }
Beispiel #2
0
        private static void ApplicationManager_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                ApplicationItems.Clear();
                IgnoredApplicationItems.Clear();
                return;
            }

            if (e.NewItems != null)
            {
                foreach (var item in e.NewItems)
                {
                    AddApplication((IApplication)item);
                }
            }

            if (e.OldItems != null)
            {
                foreach (var item in e.OldItems)
                {
                    RemoveApplication((IApplication)item);
                }
            }
        }
Beispiel #3
0
        private static void ReloadApplicationItems()
        {
            if (ApplicationItems == null)
            {
                ApplicationItems = new ObservableCollection <IApplication>();
            }
            if (IgnoredApplicationItems == null)
            {
                IgnoredApplicationItems = new ObservableCollection <IgnoredApp>();
            }

            ApplicationItems.Clear();
            IgnoredApplicationItems.Clear();

            ApplicationItems.Add(ApplicationManager.Instance.GetGlobalApplication());
            foreach (IApplication app in ApplicationManager.Instance.Applications)
            {
                if (app is UserApp)
                {
                    ApplicationItems.Add(app);
                }
                else if (app is IgnoredApp)
                {
                    IgnoredApplicationItems.Add((IgnoredApp)app);
                }
            }
        }
Beispiel #4
0
 private static void RemoveApplication(IApplication application)
 {
     if (application is IgnoredApp)
     {
         IgnoredApplicationItems.Remove((IgnoredApp)application);
     }
     else
     {
         ApplicationItems.Remove(application);
     }
 }
Beispiel #5
0
 private static void AddApplication(IApplication application)
 {
     if (application is IgnoredApp)
     {
         IgnoredApplicationItems.Add((IgnoredApp)application);
     }
     else
     {
         ApplicationItems.Add(application);
     }
 }
        public MainMenu(MainWindow form)
        {
            form_ = form;

            ApplicationItems.Add(new NewFileCommand(form_));
            ApplicationItems.Add(new OpenFileCommand(form_));
            ApplicationItems.Add(new SaveFileCommand(form_));
            ApplicationItems.Add(new SaveAsFileCommand(form_));
            ApplicationItems.Add(new SeparatorMenuItem());
            ApplicationItems.Add(new QuitCommand(form_));

            HelpItems.Add(new FormattingHelp(form_));
            HelpItems.Add(new SeparatorMenuItem());
            HelpItems.Add(new AboutCommand(form_));
        }
Beispiel #7
0
 private void CheckSelectedApplicationNodes(TreeNode treeNode, ApplicationItems Items)
 {
     foreach (TreeNode node in treeNode.Nodes)
     {
         if (node.Nodes.Count > 0)
         {
             // If the current node has child nodes, call the CheckAllChildsNodes method recursively.
             CheckSelectedApplicationNodes(node, Items);
         }
         else
         {
             if ((node.Parent.Text == Items.Manufacturer) && (node.Text == Items.ApplicationName))
             {
                 node.Checked        = true;
                 node.Parent.Checked = true;
             }
         }
     }
 }
        private static void UpdateApplicationItems()
        {
            if (ApplicationItems == null)
            {
                ApplicationItems = new ObservableCollection <IApplication>();
            }
            else
            {
                ApplicationItems.Clear();
            }

            var newApps = new List <IApplication>();

            newApps.Add(ApplicationManager.Instance.GetGlobalApplication());
            newApps.AddRange(ApplicationManager.Instance.Applications.Where(app => (app is UserApp)).OrderBy(app => app.Name));

            foreach (var app in newApps)
            {
                ApplicationItems.Add(app);
            }
        }
Beispiel #9
0
        public MainMenu(MainWindow form, IEditor <CampaignFile> editor)
        {
            ApplicationItems.Add(new NewFileCommand(editor));
            ApplicationItems.Add(new OpenFileCommand(editor));
            ApplicationItems.Add(new SaveFileCommand(editor));
            //ApplicationItems.Add(new SeparatorMenuItem());
            ApplicationItems.Add(new ButtonMenuItem()
            {
                Text  = "&Import / Export",
                Image = Resources.GetIcon("Package.ico"),
                Items =
                {
                    new ImportFileCommand(editor, form),
                    new ExportFileCommand(editor, form)
                }
            });
            ApplicationItems.Add(new SeparatorMenuItem());
            ApplicationItems.Add(new CloseProjectCommand(editor));
            ApplicationItems.Add(new SeparatorMenuItem());
            ApplicationItems.Add(new SettingsCommand());
            //ApplicationItems.Add(new SeparatorMenuItem());
            ApplicationItems.Add(new QuitCommand(form));

            HelpItems.Add(new FeedbackCommand());
            HelpItems.Add(new TutorialsCommand());
            HelpItems.Add(new SeparatorMenuItem());
            HelpItems.Add(new AboutCommand());

            Items.Add(new ButtonMenuItem()
            {
                Text  = "&Project",
                Items =
                {
                    new RunGameCommand(editor),
                    new CheckFilesCommand(editor),
                    new ProjectFolderCommand(editor)
                }
            });
        }