Beispiel #1
0
        private RibbonDropDownItem makeItem(string str)
        {
            RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();

            item.Label = str;
            return(item);
        }
Beispiel #2
0
        // 用户从下拉组合框选择项或在编辑框中输入新项时
        // 会激发“文本已更改”事件。事件处理程序
        // 执行两个操作。首先,它执行在工作表中查找文本字符串的操作。
        // 下一步,查看在下拉组合框中是否存在字符串。如果
        // 不存在,则将字符串添加到列表中。
        private void cbMRUFind_TextChanged(object sender, RibbonControlEventArgs e)
        {
            var xlcell = Globals.ThisWorkbook.Application.Cells.Find(cbMRUFind.Text, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext, Type.Missing, Type.Missing, Type.Missing);

            if (xlcell == null)
            {
                System.Windows.Forms.MessageBox.Show("Text Not Found");
            }
            else
            {
                xlcell.Select();
                System.Windows.Forms.MessageBox.Show("Search text: " + cbMRUFind.Text + " found in cell "
                                                     + xlcell.get_Address(Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1, Type.Missing, Type.Missing).ToString());
            }

            bool newSearchText = true;

            foreach (RibbonDropDownItem ddI in cbMRUFind.Items)
            {
                if (cbMRUFind.Text == ddI.Label)
                {
                    newSearchText = false;
                }
            }
            if (newSearchText)
            {
                var item = new RibbonDropDownItem {
                    Label = cbMRUFind.Text
                };
                cbMRUFind.Items.Add(item);
                System.Windows.Forms.MessageBox.Show("New item: " + item.Label + " added to ComboBox");
            }
        }
        private void btnLoadSheet_Click(object sender, RibbonControlEventArgs e)
        {
            _workBook = Globals.Consolidate.Application.ActiveWorkbook;
            if (_workBook == null)
            {
                return;
            }
            _sheets = _workBook.Sheets;
            if (_sheets == null)
            {
                return;
            }

            foreach (Worksheet workSheet in _sheets)
            {
                RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = workSheet.Name;
                ddlOriginalSheet.Items.Add(item);
            }
            ddlOriginalSheet.SelectedItemIndex = 0;


            foreach (Worksheet workSheet in _sheets)
            {
                RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = workSheet.Name;
                ddlRefSheet.Items.Add(item);
            }
            ddlRefSheet.SelectedItemIndex = 0;
        }
Beispiel #4
0
        //ドロップダウンに値追加
        private void add_data()
        {
            if (InputFormText.Text == "")
            {
                MessageBox.Show("値が入力されていません!");
            }
            string buf = InputFormText.Text;

            string[] sep   = { "\r\n" };
            string[] lines = buf.Split(sep, StringSplitOptions.None);
            string   body  = "";

            if (Globals.Ribbons.Ribbon1.addCommentPreClearCheck.Checked == true)
            {
                do_clear_combo_comment_all();
            }
            for (int i = 0; i < lines.Length; i++)
            {
                string             row  = lines[i];
                RibbonDropDownItem item = Globals.Ribbons.Ribbon1.Factory.CreateRibbonDropDownItem();
                item.Label = row;
                Globals.Ribbons.Ribbon1.writeCommentCombo.Items.Add(item);
            }
            MessageBox.Show("値の追加に成功しました");
            this.Dispose();
        }
        private void UpdateNextStateComboBox(string source_id, OfficeConnectorExtensionAddinRibbon MyRibbon)
        {
            Item Document = inn.applyAML(AddtoItem(Settings.Default.getStateName, "config_id", source_id));

            if (Document.node != null)
            {
                string        stateId        = Document.getProperty("current_state");
                Item          CurrentUserIds = inn.applyAML(Settings.Default.getCurrentUserIDs);
                List <string> idslist        = new List <string>();
                for (int i = 0; i < CurrentUserIds.getItemCount(); i++)
                {
                    Item id = CurrentUserIds.getItemByIndex(i);
                    idslist.Add(id.getAttribute("id"));
                }
                Item NextStates = inn.applyAML(AddtoItem(Settings.Default.getNextStates, "from_state", stateId));
                MyRibbon.NextStateComboBox.Items.Clear();
                MyRibbon.NextStateComboBox.Text = "";
                MyRibbon.PromoteButton.Enabled  = !MyRibbon.PromoteButton.Enabled;
                for (int i = 0; i < NextStates.getItemCount(); i++)
                {
                    Item   nextstate = NextStates.getItemByIndex(i);
                    string role      = nextstate.getProperty("role");
                    if (idslist.Contains(role))
                    {
                        RibbonDropDownItem rddi = MyRibbon.Factory.CreateRibbonDropDownItem();
                        rddi.Label = nextstate.getPropertyAttribute("to_state", "keyed_name");
                        MyRibbon.NextStateComboBox.Items.Add(rddi);
                    }
                }
            }
        }
        private void btn_ExecuteSearch_Click(object sender, RibbonControlEventArgs e)
        {
            //get the text from the settings
            Searches searches = Properties.Settings.Default.searches;

            //Find out which option is selected
            RibbonDropDownItem item = this.dd_Searches.SelectedItem;

            if (searches.Dict.ContainsKey(item.Label))
            {
                Search search = searches.Dict[item.Label];
                if (search.Replace == null)
                {
                    Globals.ThisAddIn.Application.Selection.Find.Execute(FindText: search.Find, MatchCase: search.CaseSensitive, MatchWildcards: search.Wildcards, Wrap: Word.WdFindWrap.wdFindAsk);
                }
                else
                {
                    Word.WdReplace mode = Word.WdReplace.wdReplaceOne;
                    if (search.ReplaceAll)
                    {
                        mode = Word.WdReplace.wdReplaceAll;
                    }
                    Globals.ThisAddIn.Application.Selection.Find.Execute(FindText: search.Find, MatchCase: search.CaseSensitive, MatchWildcards: search.Wildcards, Wrap: Word.WdFindWrap.wdFindAsk, ReplaceWith: search.Replace, Replace: mode);
                }
            }
            else
            {
                MessageBox.Show("An error occurred when finding your saved search. Please let Aaron know!");
                return;
            }
        }
        public void PopulateTemplatesFromDataModel()
        {
            // remove any existing items in menu
            mReplyWithJiraTab.Items.Clear();
            mReplyWithMailTab.Items.Clear();
            ddDefaultTemplate.Items.Clear();

            foreach (JiraTemplate item in Globals.ThisAddIn.dataModel.JiraTemplates)
            {
                RibbonButton rb1 = this.Factory.CreateRibbonButton();
                rb1.Click += rbReplyWithTemplate_Click;
                rb1.Label  = item.Name;
                mReplyWithJiraTab.Items.Add(rb1);

                RibbonButton rb2 = this.Factory.CreateRibbonButton();
                rb2.Click += rbReplyWithTemplate_Click;
                rb2.Label  = item.Name;
                mReplyWithMailTab.Items.Add(rb2);

                RibbonDropDownItem rddt = this.Factory.CreateRibbonDropDownItem();
                rddt.Label = item.Name;
                ddDefaultTemplate.Items.Add(rddt);
            }
            SelectDefaultItemInDropDown();
        }
Beispiel #8
0
        private void button4_Click(object sender, RibbonControlEventArgs e)
        {
            if (dbCon.IsConnect())
            {
                //suppose col0 and col1 are defined as VARCHAR in the DB
                comboBox1.Items.Clear();

                string query  = "select * From wp_pid_cma_subjects Where CMA_Action = 1";
                var    cmd    = new MySqlCommand(query, dbCon.Connection);
                var    reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    SubjectPropertyAdress = reader.IsDBNull(1) ? "" : reader.GetString("Subject_Address");
                    SubjectUnitNo         = reader.IsDBNull(2) ? "" : reader.GetString("Unit_No");
                    //SubjectUnitNo.Replace("#", "");
                    //SubjectUnitNo += string.IsNullOrEmpty(SubjectUnitNo) ? "" : "-";
                    SubjectPropertyAge = reader.IsDBNull(3) ? 0 : reader.GetInt16("Age");
                    RibbonDropDownItem ddItem1 = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                    ddItem1.Label = SubjectUnitNo + "-" + SubjectPropertyAdress; //add unit no to address
                    comboBox1.Items.Add(ddItem1);
                }
                reader.Close();
                dbCon.Close();
            }
        }
Beispiel #9
0
        /// <summary>
        /// Logs out a user and updates the ribbon user interface to prevent
        /// the option of submitting documents to courses. The drop down menu
        /// is emptied.
        /// </summary>
        private void logoutActions()
        {
            //set state to null
            mState = null;

            //hide OSBLE options and switch login and logout visibility
            grpOSBLEOptions.Visible = false;
            btnLogin.Visible        = true;;
            btnLogout.Visible       = false;

            //reset last save label
            lblLastSave.Label = "Last Save: ";

            //clear drop down course menu
            dropDownCourse.Items.Clear();
            RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();

            item.Label = "No Courses Found";
            item.Tag   = null;
            dropDownCourse.Items.Add(item);

            //clear drop down assignment menu
            dropDownAssignment.Items.Clear();
            item.Label = "No Assignments Found";
            item.Tag   = null;
            dropDownAssignment.Items.Add(item);
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            #region create organisations for dropdown
            //Get Organisations from Textfile
            OrganisationHandler           OrgHandler           = new OrganisationHandler();
            ObservableCollection <string> OrganisationList     = new ObservableCollection <string>();
            ObservableCollection <string> OrganisationListMail = new ObservableCollection <string>();
            OrgHandler.createFile();
            OrganisationList     = OrgHandler.GetOrganisations();
            OrganisationListMail = OrgHandler.GetOrganisations();

            RibbonDropDown DropdownOrganisations      = Globals.Ribbons.RibbonMenu.dropDownOrg;
            RibbonDropDown DropdownOrganisationsEmail = Globals.Ribbons.RibbonMail.dropDownOrg;


            foreach (string Organisation in OrganisationList)
            {
                RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = Organisation;
                DropdownOrganisations.Items.Add(item);
            }

            foreach (string Organisation in OrganisationListMail)
            {
                RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = Organisation;
                DropdownOrganisationsEmail.Items.Add(item);
            }
            #endregion
        }
Beispiel #11
0
        private void btnSaveToOSBLE_Click(object sender, RibbonControlEventArgs e)
        {
            // We need a valid state for login
            if (null == m_state)
            {
                btnErrorMsg.Label = "Save error: You must log in first";
                btnErrorMsg.Tag   = "You must log in to OSBLE with your account before you " +
                                    "can upload gradebook data.";
                grpError.Visible = true;
                return;
            }

            RibbonDropDownItem rddi = ddCourses.SelectedItem;

            OSBLEServices.Course          c  = rddi.Tag as OSBLEServices.Course;
            OSBLEWorkbookSaver.SaveResult sr = OSBLEWorkbookSaver.Save(
                m_state.UserName, m_state.Password, c.ID,
                Globals.ThisAddIn.Application.ActiveWorkbook);

            if (!sr.Success)
            {
                btnErrorMsg.Label = "Upload attempt at " + DateTime.Now.ToString() +
                                    " failed. Click here for more information.";
                btnErrorMsg.Tag  = sr.ErrorMessage;
                grpError.Visible = true;
                return;
            }

            // If we did succeed then hide the error message
            grpError.Visible = false;

            lblLastSave.Label = "Last Save: " + DateTime.Now.ToString();
        }
        private void btn_ApplyBoilerplate_Click(object sender, RibbonControlEventArgs e)
        {
            //get the text from the settings
            StringCollection            bps  = Properties.Settings.Default.Options_StandardComments;
            Dictionary <string, string> dict = new Dictionary <string, string>();

            for (int i = 0; i < bps.Count - 1; i++)
            {
                dict.Add(bps[i], bps[i + 1]);
            }

            //Find out which option is selected
            RibbonDropDownItem item = this.dd_Boilerplate.SelectedItem;

            if (dict.ContainsKey(item.Label))
            {
                Word.Document  doc       = Globals.ThisAddIn.Application.ActiveDocument;
                Word.Selection selection = Globals.ThisAddIn.Application.Selection;
                if (selection != null && selection.Range != null)
                {
                    selection.Comments.Add(selection.Range, dict[item.Label]);
                }
                else
                {
                    MessageBox.Show("Could not find any selected text or valid insertion point. Please let Aaron know!");
                }
            }
            else
            {
                MessageBox.Show("An error occurred when finding your boilerplate. Please let Aaron know!");
                return;
            }
        }
Beispiel #13
0
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
            CMADataSheet          = ListingDataSheet.MLSHelperExport;
            PublicReportDataSheet = ListingDataSheet.ParagonExport;
            dbCon = DBConnection.Instance();
            dbCon.DatabaseName = "pidrealty4";
            if (dbCon.IsConnect())
            {
                //suppose col0 and col1 are defined as VARCHAR in the DB
                comboBox1.Items.Clear();

                string query  = "select * From wp_pid_cma_subjects Where CMA_Action = 1";
                var    cmd    = new MySqlCommand(query, dbCon.Connection);
                var    reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    SubjectPropertyAdress = reader.IsDBNull(1) ? "" : reader.GetString("Subject_Address");
                    SubjectUnitNo         = reader.IsDBNull(2) ? "" : reader.GetString("Unit_No");
                    //SubjectUnitNo.Replace("#", "");
                    //SubjectUnitNo += string.IsNullOrEmpty(SubjectUnitNo) ? "" : "-";
                    SubjectPropertyAge = reader.IsDBNull(3) ? 0 : reader.GetInt16("Age");
                    RibbonDropDownItem ddItem1 = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                    ddItem1.Label = SubjectUnitNo + "-" + SubjectPropertyAdress; //add unit no to address
                    comboBox1.Items.Add(ddItem1);
                }
                reader.Close();
                dbCon.Close();
            }
        }
        private void btn_ApplyBoilerplate_Click(object sender, RibbonControlEventArgs e)
        {
            //get the text from the settings
            Boilerplate bp = Properties.Settings.Default.newboiler;

            //Find out which option is selected
            RibbonDropDownItem item = this.dd_Boilerplate.SelectedItem;

            if (bp.Dict.ContainsKey(item.Label))
            {
                Word.Document  doc       = Globals.ThisAddIn.Application.ActiveDocument;
                Word.Selection selection = Globals.ThisAddIn.Application.Selection;
                if (selection != null && selection.Range != null)
                {
                    selection.Comments.Add(selection.Range, bp.Dict[item.Label].Text);
                }
                else
                {
                    MessageBox.Show("Could not find any selected text or valid insertion point. Please let Aaron know!");
                }
            }
            else
            {
                MessageBox.Show("An error occurred when finding your boilerplate. Please let Aaron know!");
                return;
            }
        }
Beispiel #15
0
        private void cboMyList_ItemsLoading(object sender, RibbonControlEventArgs e)
        {
            // Add ComboBox items via code
            RibbonDropDownItem item = new RibbonDropDownItem();

            item.Label = string.Format("Item Added via code at time {0}", DateTime.Now);
            cboMyList.Items.Add(item);
        }
Beispiel #16
0
        private RibbonDropDownItem makeRibbonDropDownItem(string Label, System.Drawing.Image Image)
        {
            RibbonDropDownItem tmp = this.Factory.CreateRibbonDropDownItem();

            tmp.Label = Label;
            tmp.Image = Image;
            return(tmp);
        }
Beispiel #17
0
 private void ModelSizesSet(int[] obj)
 {
     foreach (int size in obj)
     {
         RibbonDropDownItem itemToAdd = Factory.CreateRibbonDropDownItem();
         itemToAdd.Label = size.ToString(CultureInfo.InvariantCulture);
         dropDown_BarSize.Items.Add(itemToAdd);
     }
 }
Beispiel #18
0
        //Clicking one of the options, when multiple are provided, will simply set it as active.
        //At the same time it will disable the control.
        private void gallery1_Click(object sender, RibbonControlEventArgs e)
        {
            RibbonDropDownItem item = moveOptions.SelectedItem;

            folderBox.Text      = item.Label;
            folderBox.Tag       = item.Tag;
            moveOptions.Enabled = false;
            moveButton.Enabled  = true;
        }
        private void loginButton_Click(object sender, RibbonControlEventArgs e)
        {
            loginDialog dlg = new loginDialog();

            dlg.ShowDialog();

            while (dlg.IsAccessible)
            {
                ;
            }

            if (dlg.LoggedInFunction())
            {
                this.LoggedInLabel.Visible = true;
                jwt     = dlg.getJWT();
                courses = dlg.getCourse();


                seasons       = dlg.getSeason();
                coursesToTerm = dlg.getCoursesToTerm();
                RibbonDropDownItem items = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                items.Label = "Select Semester"; // Select semester
                semesterDropDown.Items.Add(items);

                string         result7;
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://52.41.106.241:1337/metrics/1/1");
                request.Headers.Add(HttpRequestHeader.Cookie, "jwt=" + jwt);
                request.Method = "GET";
                String test = String.Empty;
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    //response.Headers.Add(HttpRequestHeader.Cookie, "jwt=" + jwt);
                    Stream       dataStream = response.GetResponseStream();
                    StreamReader reader     = new StreamReader(dataStream);
                    test = reader.ReadToEnd();
                    reader.Close();
                    dataStream.Close();
                }

                Debug.WriteLine("Start Graph Pull");
                Debug.WriteLine(test);



                foreach (KeyValuePair <String, int> entry in coursesToTerm)
                {
                    if (seasons.ContainsKey(entry.Value) && !mySeasonsInDropDown.Contains(seasons[entry.Value]))
                    {
                        RibbonDropDownItem temp = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                        temp.Label = seasons[entry.Value];
                        semesterDropDown.Items.Add(temp);
                        mySeasonsInDropDown.Add(seasons[entry.Value]);
                    }
                }
            }
        }
 private void yearDropDown_SelectionChanged(object sender, RibbonControlEventArgs e)
 {
     projektekDropDown.Items.Clear();
     foreach (String projectNumber in Globals.ThisAddIn.projectNumberList[yearDropDown.SelectedItem.Label])
     {
         RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
         item.Label = projectNumber;
         projektekDropDown.Items.Add(item);
     }
 }
Beispiel #21
0
 private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
 {
     foreach (var item in synth.GetInstalledVoices())
     {
         RibbonDropDownItem ribbonDropDownItemImpl = this.Factory.CreateRibbonDropDownItem();
         ribbonDropDownItemImpl.Label = item.VoiceInfo.Name;
         comboBox1.Items.Add(ribbonDropDownItemImpl);
         comboBox1.Text = item.VoiceInfo.Name;
     }
 }
Beispiel #22
0
 private void SetFormat()
 {
     if (drSymbology.SelectedItem.Label == "DataMatrix")
     {
         drFormato.Items.Clear();
         RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
         item.Label = formatosDataMatrix[0];
         drFormato.Items.Add(item);
     }
 }
 public Ribbon1()
 {
     InitializeComponent();
     RibbonDropDownItem ddItem1 = new RibbonDropDownItem();
     ddItem1.Label = "Item added at runtime";
     ddList.Items.Add(ddItem1);
     RibbonDropDownItem ddItem2 = new RibbonDropDownItem();
     ddItem2.Label = "Second item added at runtime";
     ddList.Items.Add(ddItem2);
     ddList.SelectedItemIndex = 1;
 }
Beispiel #24
0
        private void LoadDataSources()
        {
            DataSourceType[] sources = { DataSourceType.Local, DataSourceType.Web };

            foreach (DataSourceType source in sources)
            {
                RibbonDropDownItem ribbonDropDown = Factory.CreateRibbonDropDownItem();
                ribbonDropDown.Label = source.ToString();
                dataSourceDropDown.Items.Add(ribbonDropDown);
            }
        }
Beispiel #25
0
        //only searches one level deep!
        private void searchFolder(string query, Outlook.Folders folders)
        {
            if (folders == null)
            {
                Outlook.MAPIFolder inBox = (Outlook.MAPIFolder)Globals.ThisAddIn.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
                folders = inBox.Folders;
            }

            Hashtable res = new Hashtable();

            foreach (Outlook.MAPIFolder folder in folders)
            {
                if (folder.Name.ToLower().Contains(query))
                {
                    res[folder.Name] = folder.FolderPath;
                }
            }

            switch (res.Keys.Count)
            {
            case 0:
                writeError("Folder not found");
                //searchButton.Image = new Bitmap(Properties.Resources.foundNot);
                break;

            case 1:
                //there's only 1, but not sure if there's a better way to get it.
                foreach (string key in res.Keys)
                {
                    folderBox.Text      = key;
                    folderBox.Tag       = res[key];
                    moveButton.Enabled  = true;
                    moveOptions.Enabled = false;
                    //searchButton.Image = new Bitmap(Properties.Resources.foundOk);
                }
                break;

            default:
                moveOptions.Enabled = true;
                moveButton.Enabled  = false;
                moveOptions.Items.Clear();
                //clearing the field triggers the folderBox_TextChanged option as well!
                //folderBox.Text = null;
                //searchButton.Image = new Bitmap(Properties.Resources.foundOk);
                foreach (string key in res.Keys)
                {
                    RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                    item.Label = key;
                    item.Tag   = res[key];
                    moveOptions.Items.Add(item);
                }
                break;
            }
        }
 private void ReloadDesignList(string fileId)
 {
     cbxDesignList.Items.Clear();
     for (int i = 0; i < dataSet.Tables["Cliente"].Rows.Count; i++)
     {
         RibbonDropDownItem ribbonDropDownItem = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
         ribbonDropDownItem.Label = dataSet.Tables["Cliente"].Rows[i]["Id"].ToString();
         cbxDesignList.Items.Add(ribbonDropDownItem);
     }
     cbxDesignList.Text = fileId;
 }
 private void LoadDropDown()
 {
     this.ddlReportTo.Items.Clear();
     foreach (SpamGrabberCommon.Profile profile in SpamGrabberCommon.UserProfiles.ProfileList)
     {
         RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
         item.Label = profile.Name;
         item.Tag   = profile.Id;
         this.ddlReportTo.Items.Add(item);
     }
 }
Beispiel #28
0
        private void addSelectSmellTypeItem(string id, string option, bool selected = false)
        {
            RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();

            item.Label = option;
            item.Tag   = id;
            addIn.theRibbon.selectSmellType.Items.Add(item);
            if (selected)
            {
                addIn.theRibbon.selectSmellType.SelectedItem = item;
            }
        }
Beispiel #29
0
        public void loadProjectFile()
        {
            projektekDropDown.Items.Clear();
            yearDropDown.Items.Clear();

            try
            {
                foreach (string year in Globals.ThisAddIn.yearList)
                {
                    RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                    item.Label = year;
                    yearDropDown.Items.Add(item);
                }

                if (yearDropDown.Items[0].Label != null || yearDropDown.Items[0].Label != "")
                {
                    foreach (String projectNumber in Globals.ThisAddIn.projectNumberList[yearDropDown.Items[0].Label])
                    {
                        RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                        item.Label = projectNumber;
                        projektekDropDown.Items.Add(item);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Hiba az adatok a menük feltöltése során!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            /*
             * //combobox from file
             * int counter = 0;
             * string line;
             * try
             * {
             *  //StreamReader file = new StreamReader(Globals.ThisAddIn.getPath() + "\\projektnyilvántartás.txt");
             *  StreamReader file = new StreamReader(Globals.ThisAddIn.getProjectnameFile());
             *
             *  while ((line = file.ReadLine()) != null)
             *  {
             *      RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
             *      item.Label = line;
             *      projektekDropDown.Items.Add(item);
             *      counter++;
             *  }
             *  file.Close();
             * }
             * catch (Exception ex)
             * {
             *  MessageBox.Show("Nem létezik a projektnyilvántartási file.", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
             * }*/
        }
Beispiel #30
0
        /// <summary>
        /// Updates the ribbon user interface to give a user who has logged in
        /// successful the option to submit documents and logout. The drop down
        /// menu will be populated with the courses they are allowed to submit
        /// documents.
        /// </summary>
        private void loginActions()
        {
            //show OSBLE options and switch login and logout visibility
            grpOSBLEOptions.Visible = true;
            btnLogin.Visible        = false;
            btnLogout.Visible       = true;

            //reset last save label
            lblLastSave.Label = "Last Save: ";

            //clear drop down menus
            dropDownCourse.Items.Clear();
            dropDownAssignment.Items.Clear();

            if (mState.Courses.Length > 0)
            {
                //display message in drop down menus
                RibbonDropDownItem courseBlank = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                courseBlank.Label = "Select a course...";
                courseBlank.Tag   = null;
                dropDownCourse.Items.Add(courseBlank);

                RibbonDropDownItem assignmentBlank = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                dropDownAssignment.Items.Clear();
                assignmentBlank.Label = "Select a course to populate assignments...";
                assignmentBlank.Tag   = null;
                dropDownAssignment.Items.Add(assignmentBlank);

                //populate drop down course menu
                foreach (ProfileCourse c in mState.Courses)
                {
                    RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                    item.Label = c.Name;
                    item.Tag   = c;
                    dropDownCourse.Items.Add(item);
                }
            }

            else
            {
                //display no items found error
                RibbonDropDownItem courseNone = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                courseNone.Label = "No Courses Found";
                courseNone.Tag   = null;
                dropDownCourse.Items.Add(courseNone);

                RibbonDropDownItem assignmentNone = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                dropDownAssignment.Items.Clear();
                assignmentNone.Label = "No Assignments Found";
                assignmentNone.Tag   = null;
                dropDownAssignment.Items.Add(assignmentNone);
            }
        }
        //*************************************************************************
        //  Method: AddRibbonDropDownItems()
        //
        /// <summary>
        /// Adds a set of items to a RibbonDropDown, one for each layout supported
        /// by this class.
        /// </summary>
        ///
        /// <param name="ribbonDropDown">
        /// RibbonDropDown to add items to.
        /// </param>
        ///
        /// <remarks>
        /// When the RibbonDropDown's selection is changed, the <see
        /// cref="Layout" /> property is changed and the <see
        /// cref="LayoutManager.LayoutChanged" /> event fires.
        /// </remarks>
        //*************************************************************************
        public void AddRibbonDropDownItems(
            RibbonDropDown ribbonDropDown
            )
        {
            Debug.Assert(ribbonDropDown != null);
            Debug.Assert(m_oRibbonDropDown == null);
            AssertValid();

            m_oRibbonDropDown = ribbonDropDown;

            RibbonDropDownItemCollection oItems = m_oRibbonDropDown.Items;
            Int32 iIndexToSelect = -1;

            // Add an item for each available layout.

            foreach ( LayoutInfo oLayoutInfo in AllLayouts.GetAllLayouts() )
            {
            // Note: Separators cannot be added to the RibbonDropDown class.

            if (oLayoutInfo != AllLayouts.LayoutGroupSeparator)
            {
                LayoutType eLayout = oLayoutInfo.Layout;

                if (eLayout == base.Layout)
                {
                    iIndexToSelect = oItems.Count;
                }

                RibbonDropDownItem oItem = new RibbonDropDownItem();
                oItem.Label = oItem.ScreenTip = oLayoutInfo.Text;
                oItem.SuperTip = oLayoutInfo.Description;
                oItem.Tag = eLayout;

                oItems.Add(oItem);
            }
            }

            Debug.Assert(oItems.Count ==
            Enum.GetValues( typeof(LayoutType) ).Length);

            Debug.Assert(iIndexToSelect != -1);

            m_oRibbonDropDown.SelectedItemIndex = iIndexToSelect;

            m_oRibbonDropDown.SelectionChanged +=
            new System.EventHandler<RibbonControlEventArgs>(
                this.RibbonDropDown_SelectionChanged);
        }
 void Addin_ClientInstanceChanged(object sender, EventArgs e)
 {
     //Refresh the available syntaxes.
     syntaxes = Addin.Client.GetConfiguredSyntaxes();
     String defaultSyntax = Addin.Client.GetDefaultServerSyntax();
     dropDownSyntax.Items.Clear();
     foreach (String syntax in syntaxes)
     {
         RibbonDropDownItem rddi = new RibbonDropDownItem();
         rddi.Label = syntax;
         dropDownSyntax.Items.Add(rddi);
         if (syntax == defaultSyntax)
         {
             dropDownSyntax.SelectedItem = rddi;
         }
     }
 }
Beispiel #33
0
        // 用户从下拉组合框选择项或在编辑框中输入新项时
        // 会激发“文本已更改”事件。事件处理程序
        // 执行两个操作。首先,它执行在工作表中查找文本字符串的操作。
        // 下一步,查看在下拉组合框中是否存在字符串。如果
        // 不存在,则将字符串添加到列表中。
        private void cbMRUFind_TextChanged(object sender, RibbonControlEventArgs e)
        {
            var xlcell = Globals.ThisWorkbook.Application.Cells.Find(cbMRUFind.Text, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext, Type.Missing, Type.Missing, Type.Missing);
            if (xlcell == null)
            {
                System.Windows.Forms.MessageBox.Show("Text Not Found");
            }
            else
            {
                xlcell.Select();
                System.Windows.Forms.MessageBox.Show("Search text: " + cbMRUFind.Text + " found in cell "
                    + xlcell.get_Address(Type.Missing,Type.Missing,Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1,Type.Missing,Type.Missing).ToString());
            }

            bool newSearchText = true;
            foreach (RibbonDropDownItem ddI in cbMRUFind.Items)
            {
                if (cbMRUFind.Text == ddI.Label)
                {
                    newSearchText = false;
                }
            }
            if (newSearchText)
            {
                var item = new RibbonDropDownItem { Label = cbMRUFind.Text };
                cbMRUFind.Items.Add(item);
                System.Windows.Forms.MessageBox.Show("New item: " + item.Label + " added to ComboBox");
            }
        }