Exemple #1
0
        public void LoadJobList()
        {
            try
            {
                //get list from central config
                IList<string> entitlements = MainForm.Hierarchy.LevelNames2("user\\" + config.User, "BITS_ENTITLEMENT");
                IList<string> jobNames = MainForm.Hierarchy.LevelNames(@"appgroup\BITS_JOB_SPEC");
                ArrayList arJobNames = SortList(jobNames);
                List<string> categories = GetCategories(arJobNames);

                foreach (string s in arJobNames)
                {
                    if (entitlements.Contains(s) || config.AuthLevel > BitsUIConfig.Role.USER)
                    {
                        ListBox l = null;
                        string cat = GetCategory(s);
                        if (listCtls.ContainsKey(cat))
                            l = listCtls[cat];
                        else
                        {
                            l = new ListBox();
                            l.Font = new System.Drawing.Font("Arial", 8.25F, FontStyle.Regular);
                        }

                        if (l.Items.Contains(s) == false)
                            l.Items.Add(s);

                        listCtls[cat] = l;
                    }
                }

                foreach (string cat in categories)
                {
                    if (listCtls[cat].Items.Count == 0)
                        continue;

                    GroupBarItem item = new GroupBarItem();

                    //TextInfo myTI = new CultureInfo("en-US", false).TextInfo;
                    //item.Text = myTI.ToTitleCase(cat.ToLower());

                    item.Text = cat ;
                    item.Client = listCtls[cat];
                    item.Font = new System.Drawing.Font("Arial", 8.25F, FontStyle.Bold);
                    gbJobs.GroupBarItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
Exemple #2
0
        public void AddCategory(SourceCategory category, bool selectFirstItem)
        {
            GroupBarItem item = new GroupBarItem { Text = category.Type.Type };
            item.Icon = category.Icon;
            this.GroupBarItems.Add(item);
            SourceResourcesView view = new SourceResourcesView(this);

            if (first == null)
                first = view;

            view.Text = category.Comment;
            item.Client = view;
            categories.Add(category, view);
            
            category.Resources.ForEach(n => AddResource(category, n, false));

            if(selectFirstItem && category.Resources.Count>0)
                SelectItem(category.Resources.First());
        }
Exemple #3
0
        /// <summary>
        /// Adds an existing symbol palette to the GroupBar.
        /// </summary>
        /// <param name="palette">Symbol palette to add</param>
        /// <remarks>
        /// <seealso cref="Syncfusion.Windows.Forms.Diagram.SymbolPalette"/>
        /// </remarks>
        public void AddPalette(SymbolPalette palette)
        {
            GroupBarItem paletteBarItem = new GroupBarItem();

            paletteBarItem.Text = palette.Name;
            paletteBarItem.Tag  = palette;

            PaletteGroupView paletteView = new PaletteGroupView();

            paletteView.EditMode                = this.editMode;
            paletteView.ButtonView              = true;
            paletteView.BackColor               = Color.Ivory;
            paletteView.SymbolModelSelected    += new SymbolModelEvent(OnSymbolModelSelected);
            paletteView.SymbolModelDoubleClick += new SymbolModelEvent(OnSymbolModelDoubleClick);

            paletteView.LoadPalette(palette);
            paletteBarItem.Client = paletteView;
            this.GroupBarItems.Add(paletteBarItem);
        }
        /// <summary>
        /// Notifies the click event.
        /// </summary>
        /// <param name="sender">Invokes the click event</param>
        /// <param name="e"></param>
        void menu_Click(object sender, RoutedEventArgs e)
        {
            ContextMenu contextMenu = (ContextMenu)(e.OriginalSource as MenuItem).Parent;

            if (contextMenu.PlacementTarget is GroupBarItem)
            {
                GroupBarItem groupBarItem = (GroupBarItem)contextMenu.PlacementTarget;
                MessageBox.Show(groupBarItem.HeaderText);
            }
            else if (contextMenu.PlacementTarget is GroupView)
            {
                GroupView groupBarView = (GroupView)contextMenu.PlacementTarget;
                for (int i = 0; i < groupBarView.Items.Count; i++)
                {
                    GroupViewItem groupBarviewItem = (GroupViewItem)groupBarView.Items[i];
                    if (groupBarviewItem.IsSelected)
                    {
                        MessageBox.Show(groupBarviewItem.Text);
                        break;
                    }
                }
            }
        }
        private void okButton_Click(object sender, System.EventArgs e)
        {
            // Compare the items order in the checkedListBox with that in the GroupBar's collection and if the two
            // are not identical then perform a reinsertion of all GroupBarItems using the checkedListBox's order
            bool breinsertitems = false;

            GroupBarItem[] itemstore = new GroupBarItem[this.mainForm.GroupBarControl.GroupBarItems.Count];
            int            index     = 0;

            foreach (GroupBarItem item in this.mainForm.GroupBarControl.GroupBarItems)
            {
                itemstore[index++] = item;
            }
            for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
            {
                String itemtext = this.checkedListBox1.Items[i] as String;
                if (itemtext != itemstore[i].Text)
                {
                    GroupBarItem currentitem = itemstore[i];
                    for (int newitempos = 0; newitempos < this.checkedListBox1.Items.Count; newitempos++)
                    {
                        if (itemstore[newitempos].Text == itemtext)
                        {
                            // Switch the currentitem and newitem positions in the mainform's GroupBarItemStore
                            GroupBarItem newitem = itemstore[newitempos];
                            itemstore[i]          = newitem;
                            itemstore[newitempos] = currentitem;
                            breinsertitems        = true;
                            break;
                        }
                    }
                }
            }

            // Synchronize the GroupBarItem positions of the GroupBar control with the new GroupBarItem positions of the itemstore
            if (breinsertitems == true)
            {
                // The number of items in the navigation pane should remain the same even after the insertion. Use the
                // non-NavPane item count to ensure this.
                int nstackcount = 0;
                foreach (GroupBarItem item in this.mainForm.GroupBarControl.GroupBarItems)
                {
                    if (item.InNavigationPane == false)
                    {
                        nstackcount++;
                    }
                }

                for (int i = 0; i < itemstore.GetLength(0); i++)
                {
                    GroupBarItem iteminstore  = itemstore[i];
                    int          controlindex = this.mainForm.GroupBarControl.GroupBarItems.IndexOf(iteminstore);
                    if (controlindex != -1)
                    {
                        // If the item is present in the GroupBar control but is in a different index than in the itemstore
                        // then remove the item from it's current position and reinsert at the itemstore position.
                        int itemstorepos = i;
                        if (itemstorepos >= this.mainForm.GroupBarControl.GroupBarItems.Count)
                        {
                            itemstorepos = this.mainForm.GroupBarControl.GroupBarItems.Count - 1;
                        }
                        if (controlindex != itemstorepos)
                        {
                            this.mainForm.GroupBarControl.GroupBarItems.Remove(iteminstore);
                            this.mainForm.GroupBarControl.GroupBarItems.Insert(itemstorepos, iteminstore);
                        }
                    }
                }

                // The GroupBarItem stack should contain only nstackcount items.
                foreach (GroupBarItem item in this.mainForm.GroupBarControl.GroupBarItems)
                {
                    if (this.mainForm.GroupBarControl.GroupBarItems.IndexOf(item) >= nstackcount)
                    {
                        item.InNavigationPane = true;
                    }
                    else
                    {
                        item.InNavigationPane = false;
                    }
                }
            }

            // If the visibility state of an item in the CheckedListBox has changed by checking/unchecking then
            // apply the new state to the GroupBarItem
            for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
            {
                String itemtext = this.checkedListBox1.Items[i] as String;
                foreach (GroupBarItem item in this.mainForm.GroupBarControl.GroupBarItems)
                {
                    if (item.Text == itemtext)
                    {
                        if (this.checkedListBox1.GetItemChecked(i) == true)
                        {
                            if (item.Visible == false)
                            {
                                item.Visible = true;
                            }
                        }
                        else
                        {
                            if (item.Visible == true)
                            {
                                item.Visible = false;
                            }
                        }
                        break;
                    }
                }
            }

            this.Close();
        }
Exemple #6
0
        public void LoadJobList()
        {
            try
            {
                IList<string> jobNames;

                //get list from central config (for backward-compatibility)
                jobNames = Bits.Configuration.ConfigUtils.GlobalConfig.Hierarchy.LevelNames(@"app\BITS_JOB_SPEC");

                if (jobNames.Count == 0)
                log.InfoFormat("Obtained {0} jobs from Central Config.", jobNames.Count);
                ArrayList arJobNames = SortList(jobNames);

                List<string> categories = GetCategories(arJobNames);
                log.InfoFormat("Obtained {0} categories from Central Config.", categories.Count);

                object startUpJobsObject = GetStartUpJobs();
                ArrayList startUpJobArrayList = new ArrayList();

                if (startUpJobsObject != null)
                    startUpJobArrayList = (ArrayList)startUpJobsObject;

                foreach (string s in arJobNames)
                {
                    ListView l = null;
                    ColumnHeader header1;

                    //skip over depr_ (deprecated) jobs
                    if (s.ToUpper().Contains("DEPR_"))
                        continue;

                    string cat = GetCategory(s);
                    if (listCtls.ContainsKey(cat))
                        l = listCtls[cat];
                    else
                    {
                        l = new ListView();

                        l.Font = new System.Drawing.Font("Arial", 8.25F, FontStyle.Regular);
                        l.ContextMenuStrip = contextMenuStrip1;
                        l.MultiSelect = true;
                    }

                    if (l.Columns.Count == 0)
                    {
                        header1 = new ColumnHeader();
                        l.Columns.Add(header1);
                        l.Columns[0].Width = 400;
                    }

                    if (l.Items.ContainsKey(s) == false && 
                        (Config.Entitlements.Contains(s) || 
                        ConfigUtils.GlobalConfig.UserRole > Role.USER))
                    {
                        ListViewItem li = new ListViewItem(s);
                        li.Name = s;
                        l.Items.Add(li);
                    } 

                    if (l.Items.Count > 0)
                    {
                        l.View = View.Details;
                        l.FullRowSelect = true;
                        l.HeaderStyle = ColumnHeaderStyle.None;
                    }
                    listCtls[cat] = l;
                }

                gbJobs.GroupBarItems.Clear();
                foreach (string cat in categories)
                {
                    //skip over depr (deprecated) category
                    if (cat.ToUpper().Contains("DEPR"))
                        continue;

                    GroupBarItem item = new GroupBarItem();
                    item.Text = cat;
                    item.Client = listCtls[cat];
                    item.Font = new System.Drawing.Font("Arial", 8.25F, FontStyle.Bold);
                    gbJobs.GroupBarItems.Add(item);
                    log.InfoFormat("Added category {0}....", cat);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
 void m_Controller_OnSourcesChanged()
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new MethodInvoker(m_Controller_OnSourcesChanged));
         return;
     }
     clear();
     foreach (var cat in m_Controller.Categories)
     {
         GroupBarItem item = new GroupBarItem() { Text = cat.Key };
         this.groupBar1.GroupBarItems.Add(item);
         SwitchableGroupView view = createGroupView();
         item.Client = view;
         foreach (var src in cat.Value)
         {
             var newItem = new GroupViewItem() { Text = src.Key, ToolTipText = src.Key, Tag = src.Value };
             view.GroupViewItems.Add(newItem);
             view.MarkedItems[newItem] = m_Controller.States[cat.Key][src.Key];
             //if (!m_Controller.States[cat.Key][src.Key])
             //    view.MarkedItems.Add(newItem);
         }
     }
     if (this.groupBar1.GroupBarItems.Count > 0)
     {
         this.groupBar1.SelectedItem = 0;
         GroupView currView = (this.groupBar1.GroupBarItems[0].Client as GroupView);
         if (currView.GroupViewItems.Count > 0)
         {
             this.m_Controller.ChangeSelectedItem(currView.GroupViewItems[0].Tag);
             return;
         }
     }
     this.m_Controller.ChangeSelectedItem(null);
 }
        private void UpdatePanel()
        {
            // protect against unintentional changes to settings.
            _populating = true;

            // make sure there are no group-bar items.
            this.gbPasses.GroupBarItems.Clear();

            // set all of the controls.
            if (_material == null)
            {
                // simply clear all of the controls.
                lbName.Text = "No material selected...";

                // return.
                _populating = false;
                return;
            }

            // assign values to all of the controls.
            lbName.Text = _material.Name;

            // get the error image.
            Bitmap errorImage = Program.ThumbnailMgr.GetErrorThumbnail();

            // make sure the material can be presented.
            int passCount = _material.PassCount;

            if (passCount == 0)
            {
                this.pbPreview.Image = errorImage;
                _populating          = false;
                return;
            }

            // if there isn't a diffuse texture, set the error texture.
            Bootstrap.MaterialPass pass = _material.GetPass(0);
            string diffuseTex           = "";

            if (pass.DiffuseStage != null)
            {
                diffuseTex = pass.DiffuseStage.Texture;
            }
            if (diffuseTex == null || diffuseTex == "")
            {
                this.pbPreview.Image = errorImage;
            }
            else
            {
                // try to create the thumbnail.
                Bootstrap.Image image   = new Bootstrap.Image(diffuseTex);
                Bitmap          preview = image.ToBitmap(this.pbPreview.Size.Width, this.pbPreview.Size.Height);
                if (preview != null)
                {
                    this.pbPreview.Image = preview;
                }
                else
                {
                    this.pbPreview.Image = errorImage;
                }
            }

            // setup material states.
            this.cbStipple.Checked = _material.Stipple;

            // populate pass controls.
            for (int i = 0; i < passCount; ++i)
            {
                Bootstrap.MaterialPass curPass = _material.GetPass(i);

                // create the material pass control group.
                Controls.MaterialPassControlGroup materialPassControlGroup = new Controls.MaterialPassControlGroup();
                materialPassControlGroup.SetPass(curPass);

                // create the pass item and add it to the group bar.
                GroupBarItem passItem = new GroupBarItem();
                gbPasses.GroupBarItems.Add(passItem);

                // configure the current group bar item.
                passItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(73)))), ((int)(((byte)(73)))));
                passItem.Client    = materialPassControlGroup;
                passItem.Text      = "Pass " + (i + 1).ToString();
            }

            // resize the gbPasses
            this.pnGroupBarPanel.AutoScroll = true;
            this.gbPasses.Size = new Size(this.gbPasses.Size.Width, 1100);

            _populating = false;
        }
 private void SubscribeToTabEvents(GroupBarItem tab)
 {
     if (tab != null)
     {
     
     }
 }