Example #1
0
        private void DoCreateButtons(ObjectInfo rootItem, SubItemsCollection items)
        {
            foreach (ObjectInfo item in rootItem.Items)
            {
                ButtonItem button = new ButtonItem();
                button.Image = item.Image;

                string text = Res.TryGet(item.Text);
                if (items == Items)
                {
                    button.Tooltip   = text;
                    button.FixedSize = new Size(25, 25);
                }
                else
                {
                    button.Text        = text;
                    button.ButtonStyle = eButtonStyle.ImageAndText;
                }

                if (item.Items.Count > 0)
                {
                    // it's a category
                    DoCreateButtons(item, button.SubItems);
                    button.PopupSide         = ePopupSide.Right;
                    button.AutoExpandOnClick = true;
                    button.FixedSize         = new Size(25, 32);
                }
                else
                {
                    button.Tag    = item;
                    button.Click += button_Click;
                }

                items.Add(button);
            }
        }
 private void SiteItems(IDesignerHost host, SubItemsCollection items)
 {
     foreach (BaseItem item in items)
     {
         this.SiteItem(host, item);
     }
 }
Example #3
0
        /// <summary>
        /// Applies the Quick Access Toolbar customization changes made on QatCustomizePanel to the MetroShell Control Quick Access Toolbar. Note that QatCustomizePanel.DataChanged property indicates whether user made any changes to the data on the panel.
        /// </summary>
        /// <param name="customizePanel">Reference to the QatCustomizePanel</param>
        public void ApplyQatCustomizePanelChanges(Ribbon.QatCustomizePanel customizePanel)
        {
            if (customizePanel == null || !customizePanel.DataChanged) return;
            _TabStrip.BeginUpdate();
            try
            {
                ItemPanel itemPanelQat = customizePanel.itemPanelQat;

                int start = 0;
                BaseItem startButton = GetApplicationButton();
                if (startButton != null)
                    start = this.QuickToolbarItems.IndexOf(startButton) + 1;

                ArrayList removeList = new ArrayList();
                SubItemsCollection qatList = new SubItemsCollection(null);

                for (int i = start; i < this.QuickToolbarItems.Count; i++)
                {
                    BaseItem item = this.QuickToolbarItems[i];
                    if (IsSystemItem(item))
                        continue;

                    if (!itemPanelQat.Items.Contains(item.Name))
                        removeList.Add(item);
                    else
                        qatList._Add(item);
                }

                foreach (BaseItem item in removeList)
                    this.QuickToolbarItems.Remove(item);
                foreach (BaseItem item in qatList)
                    this.QuickToolbarItems.Remove(item);

                foreach (BaseItem item in itemPanelQat.Items)
                {
                    // Already exists on Quick Access Toolbar
                    if (item.Tag != null)
                    {
                        BaseItem copy = GetQatItemCopy(item.Tag as BaseItem);
                        this.QuickToolbarItems.Add(copy);
                    }
                    else
                    {
                        BaseItem qatItem = qatList[item.Name];
                        if (qatItem != null)
                            this.QuickToolbarItems.Add(qatItem);
                    }
                }

                m_QatLayoutChanged = true;
            }
            finally
            {
                _TabStrip.EndUpdate();
            }

            OnAfterQatDialogChangesApplied();
        }
Example #4
0
        private void findButton_Click(object sender, EventArgs e)
        {
            string accessNo;
            string memberNo;

            //Get the member who doesn't return the book
            #region Get the member
            if (bookIDRadioButton.Checked)
            {
                accessNo = searchIDTextBox.Text;
                memberNo = TransactionController.GetMember_NotReturned(accessNo);
                if (memberNo == null)
                {
                    ValidationClass.ShowInvalidError(
                        highlighter,
                        searchIDTextBox,
                        "This Book is already available in the Library OR\nAccession Number is not valid!",
                        "Invalid Accession Number"
                        );

                    //No Execution further
                    return;
                }
            }
            else
            {
                memberNo = searchIDTextBox.Text;
                if (!MemberController.IsMemberExists(memberNo))
                {
                    ValidationClass.ShowInvalidError(
                        highlighter,
                        searchIDTextBox,
                        "Invalid Member Number",
                        "Member No"
                        );

                    //No Execution further
                    return;
                }
            }

            //Load Member
            MemberModel member = MemberController.GetMember(memberNo);

            //If the member is already opened by a tab in parent form
            SubItemsCollection openedTabs = ParentTransForm.GetOpenedTabs();//TODO : This in not good
            for (int i = 0; i < openedTabs.Count; i++)
            {
                if (openedTabs[i].Text == member.Name)
                {
                    MessageBox.Show("This Member has already opened in a Tab.");
                    return;
                }
            }

            Member = member;
            memberPanel.Visible = true;

            #endregion

            //Load Books
            #region Load Books
            List <TransactionModel> transList = TransactionController.GetTransactions(memberNo);
            int transCount = transList.Count;
            returnBooks = new ReturnBookPanel[transCount];
            returnFlowLayout.Controls.Clear();
            for (int i = 0; i < transCount; i++)
            {
                BookModel book = BookController.GetBook(transList[i].AccessNo);
                addReturnBooksToTheFlowLayout(ref returnBooks[i]);
                returnBooks[i].BookModel   = book;
                returnBooks[i].Transaction = transList[i];
            }
            isAllReturned();
            #endregion

            verifyNextButton.PerformClick();
        }