using System;
using System.ComponentModel;
using System.Windows.Forms;

using BandObjectLib;
using System.Runtime.InteropServices;

namespace SampleBars
{
	[Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")]
	[BandObject("UC Search Bar", BandObjectStyle.Horizontal | BandObjectStyle.ExplorerToolbar | BandObjectStyle.TaskbarToolBar, HelpText = "Shows bar that says hello.")]
	public class HelloWorldBar : BandObject
	{
		private System.Windows.Forms.Button button1;
        private ComboBox searchBox1;
        private TextBox textBox1;
        private PictureBox pictureBox1;
		private System.ComponentModel.Container components = null;

		public HelloWorldBar()
		{
			InitializeComponent();
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if( components != null )
					components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		private void InitializeComponent()
		{
            this.button1 = new System.Windows.Forms.Button();
            this.searchBox1 = new System.Windows.Forms.ComboBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Anchor = System.Windows.Forms.AnchorStyles.Left;
            this.button1.BackColor = System.Drawing.SystemColors.GrayText;
            this.button1.ForeColor = System.Drawing.SystemColors.Info;
            this.button1.Location = new System.Drawing.Point(541, 0);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(159, 24);
            this.button1.TabIndex = 0;
            this.button1.Text = "Search";
            this.button1.UseVisualStyleBackColor = false;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // searchBox1
            // 
            this.searchBox1.DisplayMember = "(none)";
            this.searchBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.searchBox1.FormattingEnabled = true;
            this.searchBox1.ItemHeight = 13;
            this.searchBox1.Items.AddRange(new object[] {
            "OneSearch",
            "Catalog",
            "Online Journal Titles",
            "Electronic Journal Resources",
            "OhioLink Catalog",
            "University Libraries"});
            this.searchBox1.Location = new System.Drawing.Point(341, 2);
            this.searchBox1.Name = "searchBox1";
            this.searchBox1.Size = new System.Drawing.Size(194, 21);
            this.searchBox1.TabIndex = 1;
            this.searchBox1.SelectedIndexChanged += new System.EventHandler(this.searchBox1_SelectedIndexChanged);
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(154, 3);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(162, 20);
            this.textBox1.TabIndex = 2;
            // 
            // pictureBox1
            // 
            this.pictureBox1.Image = global::SampleBars.Properties.Resources.UCLibraries_transparent;
            this.pictureBox1.Location = new System.Drawing.Point(3, 0);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(121, 50);
            this.pictureBox1.TabIndex = 3;
            this.pictureBox1.TabStop = false;
            // 
            // HelloWorldBar
            // 
            this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.searchBox1);
            this.Controls.Add(this.button1);
            this.MinSize = new System.Drawing.Size(150, 24);
            this.Name = "HelloWorldBar";
            this.Size = new System.Drawing.Size(700, 27);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}

       


		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
            string theTerm = this.textBox1.Text;
            string theText = this.searchBox1.Text;
            
            if (theText == "OneSearch")
            {
                string targetURL = "http://aj2vr6xy7z.cs.serialssolutions.com/results?SS_LibHash=AJ2VR6XY7Z&dbIDList=&searchType=basic&action=start&catGroupList=default&searchBy=Category&field=Keyword&term=" + theTerm + "&catID=19851"; 
                System.Diagnostics.Process.Start(targetURL);

             }
            if (theText == "Catalog")
            {
                string targetURL = "http://uclid.uc.edu/search/X?" + theTerm + "&b=&l=&Da=&Db=&m=&s=&v=&c=&SORT=D&searchscope=39";
                System.Diagnostics.Process.Start(targetURL);

            }
            if (theText == "Online Journal Titles")
            {
                string targetURL = "http://aj2vr6xy7z.search.serialssolutions.com/?V=1.0&N=100&L=AJ2VR6XY7Z&S=AC_T_B&C="+theTerm;
                System.Diagnostics.Process.Start(targetURL);

            }
            if (theText == "Electronic Journal Resources")
            {
                string targetURL = "http://journals.ohiolink.edu./lsearch/search.do?query="+theTerm+"&field=contents";
                System.Diagnostics.Process.Start(targetURL);

            }
            if (theText == "OhioLink Catalog")
            {
                string targetURL = "http://olc1.ohiolink.edu/search/~?searchtype=X&searcharg=" +theTerm+ "&SORT=D";
                System.Diagnostics.Process.Start(targetURL);

            }
            if (theText == "University Libraries")
            {
                string targetURL = "http://www.googlesyndicatedsearch.com/u/UCincinnati?q="+theTerm;
                System.Diagnostics.Process.Start(targetURL);

            }
		}

        private void searchBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

     }
}
