Пример #1
0
 private void gal_WooTable_Format_ButtonClick(object sender, RibbonControlEventArgs e)
 {
     try
     {
         Microsoft.Office.Tools.Ribbon.RibbonButton _but = (Microsoft.Office.Tools.Ribbon.RibbonButton)sender;
         Converter(_but.Name);
     }
     catch (Exception E)
     {
         System.Windows.Forms.MessageBox.Show("Urgh, this was quite an unexpected error, I don't get what you clicked: " + E.Message + ". Sorry for that.", "WooTable .::. Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
 }
Пример #2
0
        private void QuickConnectMenu_ItemsLoading(
            object sender, RibbonControlEventArgs e)
        {
            QuickConnectItem = null;
            XmlDocument dbInfo = new XmlDocument();

            ConnectionStatus.xmlPath = Environment.GetFolderPath(
                Environment.SpecialFolder.Personal) + "\\SEMC_SQL_For_Excel.xml";
            if (System.IO.File.Exists(ConnectionStatus.xmlPath))
            {
                dbInfo.Load(ConnectionStatus.xmlPath);
                XmlNodeList recNode = dbInfo.SelectNodes("//DBInfo/DB");
                //This is for each text in every child. That's we can easily find any text.
                if (QuickConnect.Items.Count != 0)
                {
                    QuickConnect.Items.Clear();
                }

                foreach (XmlNode node in recNode)
                {
                    string temp;
                    temp = node.Attributes[0].Value.ToString();
                    this.QuickConnectItem        = this.Factory.CreateRibbonButton();
                    this.QuickConnectItem.Label  = temp;
                    this.QuickConnectItem.Name   = temp;
                    this.QuickConnectItem.Click +=
                        new RibbonControlEventHandler(QuickConnectItems_Click);
                    this.QuickConnectItem.Visible   = true;
                    this.QuickConnectItem.ShowImage = false;
                    QuickConnect.Items.Add(this.QuickConnectItem);
                    this.QuickConnectItem.Dispose();
                }
                dbInfo = null;
                ConnectionStatus.xmlPath = null;
                recNode = null;
            }
            QuickConnectItem.Dispose();
        }
        private void QuickConnectMenu_ItemsLoading(
            object sender, RibbonControlEventArgs e)
        {
            QuickConnectItem = null;
            XmlDocument dbInfo = new XmlDocument();
            ConnectionStatus.xmlPath = Environment.GetFolderPath(
            Environment.SpecialFolder.Personal) + "\\SEMC_SQL_For_Excel.xml";
            if (System.IO.File.Exists(ConnectionStatus.xmlPath))
            {
                dbInfo.Load(ConnectionStatus.xmlPath);
                XmlNodeList recNode = dbInfo.SelectNodes("//DBInfo/DB");
                //This is for each text in every child. That's we can easily find any text.
                if(QuickConnect.Items.Count != 0)
                {
                    QuickConnect.Items.Clear();
                }

                foreach (XmlNode node in recNode)
                {
                    string temp;
                    temp = node.Attributes[0].Value.ToString();
                    this.QuickConnectItem = this.Factory.CreateRibbonButton();
                    this.QuickConnectItem.Label = temp;
                    this.QuickConnectItem.Name = temp;
                    this.QuickConnectItem.Click +=
                        new RibbonControlEventHandler(QuickConnectItems_Click);
                    this.QuickConnectItem.Visible = true;
                    this.QuickConnectItem.ShowImage = false;
                    QuickConnect.Items.Add(this.QuickConnectItem);
                    this.QuickConnectItem.Dispose();
                }
                dbInfo = null;
                ConnectionStatus.xmlPath = null;
                recNode = null;
            }
            QuickConnectItem.Dispose();
        }