public MainForm()
 {
     proxy = new ServerOps.ServerOpsClient();
     InitializeComponent();
     cbType.SelectedIndex = 0;
     cbShareType.Items.AddRange(proxy.GetAllSharesType());
     cbShareType.SelectedIndex = 0;
     cbCurrency.Items.AddRange(proxy.GetAllCurrency());
     cbCurrency.SelectedIndex = 0;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ddShare.Items.Count <= 1)
            {
                ddShare.Items.Clear();
                ddCurrency.Items.Clear();
                ddShare.Items.Add("None available!");
                ddCurrency.Items.Add("None available!");
                proxy = new ServerOps.ServerOpsClient();
                try
                {
                    proxy.Open();
                    String[] types = proxy.GetAllSharesType();
                    String[] currencies = proxy.GetAllCurrency();
                    ddShare.Items.Clear();
                    ddCurrency.Items.Clear();
                    if(types.Count() == 0)
                        ddShare.Items.Add("None available!");
                    else
                        foreach (String s in types)
                        {
                            ddShare.Items.Add(s);
                        }

                    if (currencies.Count() == 0)
                        ddCurrency.Items.Add("None available!");
                    else
                        foreach (String s in currencies)
                        {
                            ddCurrency.Items.Add(s);
                        }
                }
                catch (Exception ex){}
                finally
                {
                    if (!proxy.State.ToString().Equals("Faulted"))
                        proxy.Close();
                    else
                        lblServer.Text = " - Server is down!";
                }
            }
        }