Ejemplo n.º 1
0
        private void butDuyet_Click(object sender, System.EventArgs e)
        {
            if (bKhoaso)
            {
                MessageBox.Show("Số liệu tháng " + s_mmyy.Substring(0, 2) + " năm " + s_mmyy.Substring(2, 2) + " đã khóa !\nNếu cần thay đổi thì vào mục khai báo hệ thống", ttb.Msg);
                return;
            }
            frmDuyet f = new frmDuyet(ttb, dtll, i_nhom, i_loai, s_makp, s_mmyy, s_kho, this.Text, s_ngay, i_userid, false, false, 1, bCongdon);

            f.ShowDialog(this);
            if (f.bOk)
            {
                dtll = f.dtll;
                dtll.AcceptChanges();
                mabn.Refresh();
                if (mabn.Items.Count > 0)
                {
                    l_id = decimal.Parse(mabn.SelectedValue.ToString());
                }
                else
                {
                    l_id = 0;
                }
                load_head();
                butChoduyet_Click(null, null);
            }
        }
Ejemplo n.º 2
0
        private void butDuyet_Click(object sender, System.EventArgs e)
        {
            if (bKhoaso)
            {
                MessageBox.Show(
                    lan.Change_language_MessageText("Số liệu tháng") + " " + s_mmyy.Substring(0, 2) + " " +
                    lan.Change_language_MessageText("năm") + " " + s_mmyy.Substring(2, 2) + " " +
                    lan.Change_language_MessageText("đã khóa !") + "\n" +
                    lan.Change_language_MessageText("Nếu cần thay đổi thì vào mục khai báo hệ thống"), d.Msg);
                return;
            }
            frmDuyet f = new frmDuyet(d, dtll, i_nhom, i_loai, s_makp, s_mmyy, s_kho, this.Text, s_ngay, i_userid, false, true, i_thuoc, false, s_userid, i_khudt);

            f.ShowDialog(this);
            if (f.bOk)
            {
                dtll = f.dtll;
                dtll.AcceptChanges();
                mabn.Refresh();
                if (dtll.Rows.Count > 0)
                {
                    l_id = decimal.Parse(mabn.SelectedValue.ToString());
                }
                else
                {
                    l_id = 0;
                }
                load_head();
                butChoduyet_Click(null, null);
            }
        }
 void UpdateMembersComboBox()
 {
     autoselect = false;
     try {
         if (currentCompilationUnit != null)
         {
             for (int i = 0; i < membersComboBox.Items.Count; ++i)
             {
                 if (((ComboBoxItem)membersComboBox.Items[i]).IsInside(textAreaControl.ActiveTextAreaControl.Caret.Line))
                 {
                     if (membersComboBox.SelectedIndex != i)
                     {
                         membersComboBox.SelectedIndex = i;
                     }
                     if (!membersComboBoxSelectedMember)
                     {
                         membersComboBox.Refresh();
                     }
                     membersComboBoxSelectedMember = true;
                     return;
                 }
             }
         }
         membersComboBox.SelectedIndex = -1;
         if (membersComboBoxSelectedMember)
         {
             membersComboBox.Refresh();
             membersComboBoxSelectedMember = false;
         }
     } finally {
         autoselect = true;
     }
 }
        void UpdateClassComboBox()
        {
            // Still needed ?
            if (currentCompilationUnit == null)
            {
                currentCompilationUnit = (ICompilationUnit)ParserService.GetParseInformation(FileUtility.NormalizePath(textAreaControl.FileName)).MostRecentCompilationUnit;
            }

            autoselect = false;
            try {
                if (currentCompilationUnit != null)
                {
                    //// Alex: when changing between files in different compilation units whole process must be restarted
                    //// happens usually when files are opened from different project(s)
                    for (int i = 0; i < classComboBox.Items.Count; ++i)
                    {
                        if (((ComboBoxItem)classComboBox.Items[i]).IsInside(textAreaControl.ActiveTextAreaControl.Caret.Line))
                        {
                            bool innerClassContainsCaret = false;
                            for (int j = i + 1; j < classComboBox.Items.Count; ++j)
                            {
                                if (((ComboBoxItem)classComboBox.Items[j]).IsInside(textAreaControl.ActiveTextAreaControl.Caret.Line))
                                {
                                    innerClassContainsCaret = true;
                                    break;
                                }
                            }
                            if (!innerClassContainsCaret)
                            {
                                if (classComboBox.SelectedIndex != i)
                                {
                                    classComboBox.SelectedIndex = i;
                                    FillMembersComboBox();
                                }
                                if (!classComboBoxSelectedMember)
                                {
                                    classComboBox.Refresh();
                                }
                                classComboBoxSelectedMember = true;
                                return;
                            }
                        }
                    }
                }
                if (classComboBoxSelectedMember)
                {
                    classComboBox.Refresh();
                    classComboBoxSelectedMember = false;
                }
            } finally {
                autoselect = true;
            }
//				classComboBox.SelectedIndex = -1;
        }
Ejemplo n.º 5
0
        public bool LlenarCombo_Windows(System.Windows.Forms.ComboBox Generico)
        {
            if (!Validar())
            {
                return(false);
            }
            clsConexionBD objConecionBD = new clsConexionBD();

            objConecionBD.SQL         = strSQL;
            objConecionBD.NombreTabla = strNombreTabla;

            if (!objConecionBD.LlenarDataSet(false))
            {
                strError = objConecionBD.Error;
                objConecionBD.CerrarConexion();
                objConecionBD = null;
                return(false);
            }

            Generico.DataSource    = objConecionBD.MiDataSet.Tables[strNombreTabla];
            Generico.DisplayMember = strColumnaTexto;
            Generico.ValueMember   = strColumnaValor;
            Generico.Refresh();
            objConecionBD.CerrarConexion();
            objConecionBD = null;
            return(true);
        }
Ejemplo n.º 6
0
        private void frmReset_Load(object sender, System.EventArgs e)
        {
            Usuario user = new Usuario();

            cmbUsuarios.DataSource    = user.Listar("", false);
            cmbUsuarios.ValueMember   = "LoginName";
            cmbUsuarios.DisplayMember = "LoginName";
            cmbUsuarios.Refresh();
        }
Ejemplo n.º 7
0
 private void CargarInformacion()
 {
     txtNombreCliente.Text = Factura.NombreCliente;
     txtRFC.Text           = Factura.RfcCliente;
     txtDireccion.Text     = Factura.DireccionCliente;
     txtCodigoPostal.Text  = Factura.CpCliente.ToString();
     txtCiudad.Text        = Factura.CiudadCliente;
     if (cmbEstado.Items.Contains(Factura.ToString()))
     {
         cmbEstado.SelectedItem = Factura.EstadoCliente;
         cmbEstado.Refresh();
     }
     else
     {
         cmbEstado.SelectedIndex = -1;
     }
     mtbTelefono.Text = Factura.TelefonoCliente;
 }
Ejemplo n.º 8
0
 public void RefreshCurveEqComboBox(ComboBox cb, INCCAnalysisParams.CurveEquationVals v)
 {
     cb.Items.Clear();
     foreach (INCCAnalysisParams.CurveEquation cs in System.Enum.GetValues(typeof(INCCAnalysisParams.CurveEquation)))
     {
         //Per Martyn, use equation string, not named value.  7/17/2014 HN
                 cb.Items.Add(cs.ToDisplayString());                
     }
     cb.Refresh();
     cb.SelectedIndex = cb.FindString (v.cal_curve_equation.ToDisplayString());
 }
Ejemplo n.º 9
0
 private void checkCustomFormatter_CheckedChanged(object sender, System.EventArgs e)
 {
     if (checkCustomFormatter.Checked)
     {
         labelFormatters.Enabled = comboFormatters.Enabled = true;
     }
     else
     {
         labelFormatters.Enabled = comboFormatters.Enabled = false;
         comboFormatters.Text    = String.Empty;
         comboFormatters.Refresh();
     }
 }
Ejemplo n.º 10
0
 private void UpdateMembersComboBox()
 {
     _autoselect = false;
     try
     {
         //if (currentCompilationUnit != null)
         {
             for (int i = 0; i < _membersComboBox.Items.Count; ++i)
             {
                 if (((ComboBoxItem)_membersComboBox.Items[i]).IsInside(textAreaControl.ActiveViewControl.Caret.Position.Y))
                 {
                     if (_membersComboBox.SelectedIndex != i)
                     {
                         _membersComboBox.SelectedIndex = i;
                     }
                     if (!_membersComboBoxSelectedMember)
                     {
                         _membersComboBox.Refresh();
                     }
                     _membersComboBoxSelectedMember = true;
                     return;
                 }
             }
         }
         _membersComboBox.SelectedIndex = -1;
         if (_membersComboBoxSelectedMember)
         {
             _membersComboBox.Refresh();
             _membersComboBoxSelectedMember = false;
         }
     }
     finally
     {
         _autoselect = true;
     }
 }
 public static void CreatePlaylist(ref CPlaylist list, ref ComboBox cbx, ref ListBox lbx, String name, String path)
 {
     list = new CPlaylist();
     list.Name = name;
     list.Path = path + "\\" + name;
     lbx.Items.Clear();
     cbx.Items.Add(list);
     cbx.Sorted = false;
     cbx.Sorted = true;
     cbx.Invalidate();
     cbx.Refresh();
     for (int i = 0; i < cbx.Items.Count; ++i)
     {
         if (cbx.Items[i].ToString() == list.Name)
         {
             cbx.SelectedIndex = i;
             break;
         }
     }
 }
Ejemplo n.º 12
0
        public void CargarComboBox(ComboBox objComboBox)
        {
            try
            {
                DataTable dataTable = new DataTable("TipoCambio");
                dataTable.Columns.Add("Id");
                dataTable.Columns.Add("Name");
                dataTable.Rows.Add("PEN", "SOLES");
                dataTable.Rows.Add("USD", "DÓLARES");

                objComboBox.DataSource = dataTable;
                objComboBox.DisplayMember = "Name";
                objComboBox.ValueMember = "Id";

                objComboBox.SelectedIndex = 1;
                objComboBox.Refresh();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 13
0
        private void WelcomeForm_Load(object sender, System.EventArgs e)
        {
            Language.LoadControlNames(this);

            this.BringToFront();

            langSel.Items.AddRange(Language.GetPackNames());
            langSel.SelectedItem = Language.Current;

            showAtStart.Checked = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "ShowWindow"), 1) == 1;

            clientList.Items.Add(Language.GetString(LocString.Auto2D));
            clientList.Items.Add(Language.GetString(LocString.Auto3D));
            for (int i = 1; ; i++)
            {
                string val = String.Format("Client{0}", i);
                string cli = Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, val);
                if (cli == null || cli == "")
                {
                    break;
                }
                if (File.Exists(cli))
                {
                    clientList.Items.Add(new PathElipsis(cli));
                }
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, val);
            }
            int sel = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "DefClient"), 0);

            if (sel >= clientList.Items.Count)
            {
                sel = 0;
                Config.SetRegString(Microsoft.Win32.Registry.CurrentUser, "DefClient", "0");
            }
            clientList.SelectedIndex = sel;

            dataDir.Items.Add(Language.GetString(LocString.AutoDetect));
            for (int i = 1; ; i++)
            {
                string val = String.Format("Dir{0}", i);
                string dir = Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, val);
                if (dir == null || dir == "")
                {
                    break;
                }
                if (Directory.Exists(dir))
                {
                    dataDir.Items.Add(dir);
                }
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, val);
            }

            try
            {
                dataDir.SelectedIndex = Convert.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "LastDir"));
            }
            catch
            {
                dataDir.SelectedIndex = 0;
            }

            patchEncy.Checked = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "PatchEncy"), 1) != 0;
            useEnc.Checked    = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "ServerEnc"), 0) != 0;

            LoginCFG_SE lse = new LoginCFG_SE();
            Custom_SE   cse;

            ShardEntry[] entries = null;
            try { entries = JsonConvert.DeserializeObject <ShardEntry[]>(Engine.ShardList); }
            catch { }

            serverList.BeginUpdate();

            //serverList.Items.Add( lse=new LoginCFG_SE() );
            //serverList.SelectedItem = lse;

            for (int i = 1; ; i++)
            {
                ServerEntry se;
                string      sval = String.Format("Server{0}", i);
                string      serv = Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, sval);
                if (serv == null)
                {
                    break;
                }
                string pval = String.Format("Port{0}", i);
                int    port = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, pval), 0);
                serverList.Items.Add(se = new ServerEntry(serv, port));
                if (serv == lse.RealAddress && port == lse.Port)
                {
                    serverList.SelectedItem = se;
                }
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, sval);
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, pval);
            }

            if (entries == null)
            {
                serverList.Items.Add(cse = new Custom_SE("Zenvera (UOR)", "login.zenvera.com"));
                if (serverList.SelectedItem == null || lse.RealAddress == cse.RealAddress && lse.Port == 2593)
                {
                    serverList.SelectedItem = cse;
                }
            }
            else
            {
                foreach (var entry in entries)
                {
                    if (String.IsNullOrEmpty(entry.name))
                    {
                        continue;
                    }

                    var ename = String.IsNullOrEmpty(entry.type) ? entry.name : String.Format("{0} ({1})", entry.name, entry.type);
                    serverList.Items.Add(cse = new Custom_SE(ename, entry.host, entry.port));
                    if (lse.RealAddress == cse.RealAddress && lse.Port == entry.port)
                    {
                        serverList.SelectedItem = cse;
                    }
                }
            }

            serverList.EndUpdate();

            serverList.Refresh();

            WindowState = FormWindowState.Normal;
            this.BringToFront();
            this.TopMost = true;

            _ShowTimer          = new System.Windows.Forms.Timer();
            _ShowTimer.Interval = 250;
            _ShowTimer.Enabled  = true;
            _ShowTimer.Tick    += new EventHandler(timer_Tick);
        }
Ejemplo n.º 14
0
        protected void FillEpiCurveMainVariables(ComboBox cmb)
        {
            cmb.Items.Clear();
            cmb.BeginUpdate();

            foreach (DataColumn Column in this.mainForm.EpiInterpreter.Context.DataSet.Tables["output"].Columns)
            {
                if (Column.DataType.FullName.ToString() == "System.DateTime")
                {
                    string columnName = Column.ColumnName.ToString();
                    if (columnName == "FirstSaveTime") continue;
                    if (columnName == "LastSaveTime") continue;
                    cmb.Items.Add(columnName);
                }
            }

            cmb.EndUpdate();
            cmb.Sorted = true;
            cmb.Refresh();
        }
Ejemplo n.º 15
0
        private void WelcomeForm_Load(object sender, System.EventArgs e)
        {
            Language.LoadControlNames(this);

            this.BringToFront();

            langSel.Items.AddRange(Language.GetPackNames());
            langSel.SelectedItem = Language.Current;

            showAtStart.Checked = Config.GetAppSetting <int>("ShowWelcome") == 1;

            uoClient.Text = Config.GetAppSetting <string>("UOClient");
            dataDir.Text  = Config.GetAppSetting <string>("UODataDir");

            IsValidClientAndDataDir();

            patchEncy.Checked = Config.GetAppSetting <int>("PatchEncy") != 0;
            useEnc.Checked    = Config.GetAppSetting <int>("ServerEnc") != 0;

            LoginCFG_SE lse = new LoginCFG_SE();
            Custom_SE   cse;

            serverList.BeginUpdate();

            // Always add the default UOR servers
            serverList.Items.Add(cse = new Custom_SE("UO Renaissance (Prod)", "login.uorenaissance.com", 2593));

            if (serverList.SelectedItem == null)
            {
                serverList.SelectedItem = cse;
            }

            serverList.Items.Add(new Custom_SE("UO Renaissance (Test)", "test.uorenaissance.com", 2597));

            // Load any custom servers they might have added
            NameValueCollection servers =
                (NameValueCollection)ConfigurationManager.GetSection("Servers");

            foreach (string server in servers.AllKeys)
            {
                string[] serverHostAndPort = servers[server].Split(',');
                string   serverHost        = serverHostAndPort[0];
                string   serverPort        = serverHostAndPort[1];

                serverList.Items.Add(new Custom_SE(server, serverHost, Convert.ToInt32(serverPort)));
            }

            serverList.EndUpdate();
            serverList.Refresh();

            // Set it to the last used one, or just set it to default UOR Prod
            try
            {
                serverList.SelectedIndex = Config.GetAppSetting <int>("LastServerId");
            }
            catch
            {
                serverList.SelectedIndex = 0;
            }

            WindowState = FormWindowState.Normal;
            this.BringToFront();
            this.TopMost = true;

            _ShowTimer          = new System.Windows.Forms.Timer();
            _ShowTimer.Interval = 250;
            _ShowTimer.Enabled  = true;
            _ShowTimer.Tick    += new EventHandler(timer_Tick);
        }
 public void RefreshData()
 {
     objLayerList.Refresh();
     objShadowLayerList.Refresh();
     UpdatePropLabel();
 }
 public bool LlenarCombo_Windows( ComboBox Generico )
 {
     if ( ! Validar() )
             return false;
         try
         {
             clsConexionBD objConexionBd = new clsConexionBD( strApp );
             objConexionBd.SQL = strSQL;
             if ( ! objConexionBd.LlenarDataSet( false ) )
             {
                 strError = objConexionBd.Error;
                 objConexionBd.CerrarCnx();
                 objConexionBd = null;
                 return false;
             }
             Generico.DataSource = objConexionBd.DataSet_Lleno.Tables[0];
             Generico.ValueMember = strCampoID;
             Generico.DisplayMember = strCampoTexto;
             Generico.Refresh();
             objConexionBd.CerrarCnx();
             objConexionBd = null;
             return true;
         }
         catch (Exception ex)
         {
             strError = ex.Message;
             return false;
         }
 }
Ejemplo n.º 18
0
        //presence validation for if a combo box is selected
        public bool isSelected(ComboBox combobox, string name)
        {
            if (combobox.SelectedIndex < 0)
            {
                MessageBox.Show(name + " must be selected", "Error");
                combobox.Refresh();
                combobox.Focus();
                return false;
            }

            return true;
        }
Ejemplo n.º 19
0
        private void UpdateClassComboBox()
        {
            if (lines != textAreaControl.Document.Count)
            {
                PopulateCombo();

                lines = textAreaControl.Document.Count;
            }


            // Still needed ?
            //if (currentCompilationUnit == null)
            {
                //currentCompilationUnit = (ICompilationUnit)Parser.ProjectParser.GetParseInformation(Path.GetFullPath(textAreaControl.FileName)).MostRecentCompilationUnit;
            }

            _autoselect = false;
            try
            {
                //if (currentCompilationUnit != null)
                {
                    //// Alex: when changing between files in different compilation units whole process must be restarted
                    //// happens usually when files are opened from different project(s)
                    for (int i = 0; i < _classComboBox.Items.Count; ++i)
                    {
                        if (((ComboBoxItem)_classComboBox.Items[i]).IsInside(textAreaControl.ActiveViewControl.Caret.Position.Y))
                        {
                            bool innerClassContainsCaret = false;
                            for (int j = i + 1; j < _classComboBox.Items.Count; ++j)
                            {
                                if (((ComboBoxItem)_classComboBox.Items[j]).IsInside(textAreaControl.ActiveViewControl.Caret.Position.Y))
                                {
                                    innerClassContainsCaret = true;
                                    break;
                                }
                            }
                            if (!innerClassContainsCaret)
                            {
                                if (_classComboBox.SelectedIndex != i)
                                {
                                    _classComboBox.SelectedIndex = i;
                                    FillMembersComboBox();
                                }
                                if (!_classComboBoxSelectedMember)
                                {
                                    _classComboBox.Refresh();
                                }
                                _classComboBoxSelectedMember = true;
                                return;
                            }
                        }
                    }
                }
                if (_classComboBoxSelectedMember)
                {
                    _classComboBox.Refresh();
                    _classComboBoxSelectedMember = false;
                }
            }
            finally
            {
                _autoselect = true;
            }
            //				classComboBox.SelectedIndex = -1;
        }
Ejemplo n.º 20
0
        private void AddGoodsToDataGrid()
        {
            double dCount = 0;

            if (txtCount.Text.Trim() == "")
            {
                MessageBox.Show("数量不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                dCount = int.Parse(txtCount.Text.Trim());
            }

            double dPrice = 0;

            if (txtPrice.Text.Trim() == "")
            {
                MessageBox.Show("单价不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                dPrice = Double.Parse(txtPrice.Text.Trim());
            }

            if (txtGoodsID.Text.Trim() == "")
            {
                MessageBox.Show("商品信息有误,请重新选择商品!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtGoodsID.Text = "";
                cmbGoodsName.Items.Clear();
                cmbGoodsName.Refresh();
                txtPrice.Text = "";
                txtCount.Text = "";
            }
            CMSMData.CMSMStruct.GoodsStruct gs = new CMSMData.CMSMStruct.GoodsStruct();
            err = null;
            gs  = cs.GetGoodsByID(txtGoodsID.Text.Trim(), out err);
            if (gs != null)
            {
                txtGoodsID.Text   = gs.strGoodsID;
                cmbGoodsName.Text = gs.strGoodsName;
                bool sumflag = false;
                for (int i = 0; i < dtConsItem.Rows.Count; i++)
                {
                    if (gs.strGoodsID == dtConsItem.Rows[i]["GoodsID"].ToString())
                    {
                        dtConsItem.Rows[i]["Count"] = (double.Parse(dtConsItem.Rows[i]["Count"].ToString()) + dCount).ToString();
                        sumflag = true;
                        break;
                    }
                }

                if (!sumflag)
                {
                    DataRow dr = dtConsItem.NewRow();
                    dr[0] = gs.strGoodsID;
                    dr[1] = gs.strGoodsName;
                    dr[2] = dPrice.ToString();
                    dr[3] = dCount.ToString();
                    dtConsItem.Rows.Add(dr);
                }
                this.DgBind();
                cmbGoodsName.Focus();
            }
            else
            {
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                MessageBox.Show("无此商品信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
        }
Ejemplo n.º 21
0
 private void SetComboHeight(ComboBox ctrl, int iNewHeight)
 {
     const uint CB_SETITEMHEIGHT = 0x153;
     SendMessage(ctrl.Handle, CB_SETITEMHEIGHT, -1, iNewHeight);
     ctrl.Refresh();
 }
Ejemplo n.º 22
0
        //private void iSetupGui(bool force= false)
        //{
        //System.Windows.Forms.Cursor oldCursor = Cursor;
        //Cursor = Cursors.WaitCursor;
        ////_cbIncludeWithinRegionOfStation_IndexChanged = false;
        //if (!_InitDone && !force)
        //    return;
        //_pt.startMeasuring();
        //cmbStation.BeginUpdate();
        //cmbStationToStationFrom.BeginUpdate();
        //cmbStationToStationTo.BeginUpdate();
        //cbCommodity.BeginUpdate();
        //_pt.PrintAndReset("1");
        //// notice the current selected items
        //string Key_cmbStation               = getCmbItemKey(cmbStation.SelectedItem);
        //string Key_cmbStationToStationFrom  = getCmbItemKey(cmbStationToStationFrom.SelectedItem);
        //string Key_cmbStationToStationTo    = getCmbItemKey(cmbStationToStationTo.SelectedItem);
        //_pt.PrintAndReset("2");
        //BindingList<System.Collections.Generic.KeyValuePair<string,string>> BaseList;
        //IFormatter formatter        = new BinaryFormatter();
        //MemoryStream SerialListCopy = new MemoryStream();
        //_pt.PrintAndReset("3");
        //BaseList = getDropDownStationsItems(ref _StationIndices);
        //formatter.Serialize(SerialListCopy, BaseList);
        //_bs_Stations.DataSource = BaseList;
        //SerialListCopy.Seek(0,0);
        //_bs_StationsFrom.DataSource = (BindingList<System.Collections.Generic.KeyValuePair<string,string>>)formatter.Deserialize(SerialListCopy);
        //SerialListCopy.Seek(0,0);
        //_bs_StationsTo.DataSource = (BindingList<System.Collections.Generic.KeyValuePair<string,string>>)formatter.Deserialize(SerialListCopy);
        //_pt.PrintAndReset("4");
        //SerialListCopy.Dispose();
        //if (!_InitDone)
        //{
        //    cmbStation.DataSource = _bs_Stations;
        //    cmbStation.DisplayMember = "Value";
        //    cmbStation.ValueMember = "Key";
        //    cmbStationToStationFrom.DataSource = _bs_StationsFrom;
        //    cmbStationToStationFrom.DisplayMember = "Value";
        //    cmbStationToStationFrom.ValueMember = "Key";
        //    cmbStationToStationTo.DataSource = _bs_StationsTo;
        //    cmbStationToStationTo.DisplayMember = "Value";
        //    cmbStationToStationTo.ValueMember = "Key";
        //}
        //_pt.PrintAndReset("5");
        //cbIncludeWithinRegionOfStation.SelectedIndexChanged -= cbIncludeWithinRegionOfStation_SelectionChangeCommitted;
        //var previouslySelectedValue = cbIncludeWithinRegionOfStation.SelectedItem;
        //cbIncludeWithinRegionOfStation.Items.Clear();
        //var systems = StationDirectory.Keys.Select(x => (object)(StructureHelper.CombinedNameToSystemName(x))).OrderBy(x => x).Distinct().ToArray();
        //cbIncludeWithinRegionOfStation.Items.Add("<Current System>");
        //cbIncludeWithinRegionOfStation.Items.AddRange(systems);
        ////cbIncludeWithinRegionOfStation.SelectedIndex = 0;
        //cbIncludeWithinRegionOfStation.DropDownStyle = ComboBoxStyle.DropDownList;
        //_pt.PrintAndReset("6");
        //if (previouslySelectedValue != null)
        //    cbIncludeWithinRegionOfStation.SelectedItem = previouslySelectedValue;
        //else
        //    cbIncludeWithinRegionOfStation.SelectedItem = "<Current System>";
        //cbIncludeWithinRegionOfStation.SelectedIndexChanged += cbIncludeWithinRegionOfStation_SelectionChangeCommitted;
        //int ListIndex;
        //_pt.PrintAndReset("7");
        //if ((Key_cmbStation != null) && _StationIndices.TryGetValue(Key_cmbStation, out ListIndex))
        //    cmbStation.SelectedIndex = ListIndex;
        //if ((Key_cmbStation != null) && _StationIndices.TryGetValue(Key_cmbStationToStationFrom, out ListIndex))
        //    cmbStationToStationFrom.SelectedIndex = ListIndex;
        //if ((Key_cmbStation != null) && _StationIndices.TryGetValue(Key_cmbStationToStationTo, out ListIndex))
        //    cmbStationToStationTo.SelectedIndex = ListIndex;
        //cbCommodity.Items.Clear();
        //_pt.PrintAndReset("8");
        //foreach (var commodity in CommodityDirectory.OrderBy(x => x.Key))
        //{
        //    cbCommodity.Items.Add(commodity.Key);
        //}
        //cbCommodity.SelectedItem = null;
        //if (cbCommodity.Items.Count > 0)
        //    cbCommodity.SelectedItem = cbCommodity.Items[0];
        //lvAllComms.Items.Clear();
        ////_pt.PrintAndReset("9");
        //Debug.Print("Anzahl = " + CommodityDirectory.Count.ToString());
        //// Populate all commodities tab
        //foreach (var commodity in CommodityDirectory)
        //{
        //    decimal bestBuyPrice;
        //    decimal bestSellPrice;
        //    string bestBuy;
        //    string bestSell;
        //    decimal buyers;
        //    decimal sellers;
        //    //_pt.PrintAndReset("9_1");
        //    GetBestBuyAndSell(commodity.Key, out bestBuyPrice, out bestSellPrice, out bestBuy, out bestSell, out buyers, out sellers);
        //    //_pt.PrintAndReset("9_2");
        //    lvAllComms.Items.Add(new ListViewItem(new[]
        //    {   commodity.Key,
        //        bestBuyPrice.ToString(CultureInfo.InvariantCulture) != "0" ? bestBuyPrice.ToString(CultureInfo.InvariantCulture) : "",
        //        bestBuy,
        //        buyers.ToString(CultureInfo.InvariantCulture),
        //        bestSellPrice.ToString(CultureInfo.InvariantCulture) != "0" ? bestSellPrice.ToString(CultureInfo.InvariantCulture) : "",
        //        bestSell,
        //        sellers.ToString(CultureInfo.InvariantCulture),
        //        bestBuyPrice != 0 && bestSellPrice != 0 ? (bestSellPrice - bestBuyPrice).ToString(CultureInfo.InvariantCulture) : ""
        //    }));
        //    //_pt.PrintAndReset("9_3");
        //}
        ////_pt.PrintAndReset("10");
        //cmbStation.EndUpdate();
        //cmbStationToStationFrom.EndUpdate();
        //cmbStationToStationTo.EndUpdate();
        //cbCommodity.EndUpdate();
        ////_pt.PrintAndReset("11");
        //UpdateStationToStation();
        ////_pt.PrintAndReset("12");
        //Cursor = oldCursor;
        //}
        private void setupCombobox(ComboBox CBRefreshed, List<KeyValuePair<string, string>> DDItems)
        {
            CBRefreshed.DataSource = null;

            CBRefreshed.Items.Clear();

            CBRefreshed.DataSource = DDItems;

            CBRefreshed.ValueMember = "Key";
            CBRefreshed.DisplayMember = "Value";

            if (CBRefreshed.Items.Count > 0)
                CBRefreshed.SelectedItem = CBRefreshed.Items[0];
            else
                CBRefreshed.SelectedItem = null;

            CBRefreshed.Refresh();
        }
Ejemplo n.º 23
0
 void Member_Invoke_Refresh()
 {
     membersComboBox.Refresh();
 }
 public static void AddItemstoComboBox(ComboBox pComboBox, List<ComboBoxItem> pItems)
 {
     pComboBox.DataSource = pItems;
     pComboBox.DisplayMember = "key";
     pComboBox.ValueMember = "value";
     pComboBox.Refresh();
 }
Ejemplo n.º 25
0
        private void AddGoodsToDataGrid()
        {
            double dCount = 0;

            if (txtCount.Text.Trim() == "")
            {
                MessageBox.Show("数量不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                dCount = int.Parse(txtCount.Text.Trim());
            }

            double dPrice = 0;

            if (txtPrice.Text.Trim() == "")
            {
                MessageBox.Show("单价不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                dPrice = Double.Parse(txtPrice.Text.Trim());
            }

            if (txtGoodsID.Text.Trim() == "")
            {
                MessageBox.Show("商品信息有误,请重新选择商品!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtGoodsID.Text = "";
                cmbGoodsName.Items.Clear();
                cmbGoodsName.Refresh();
                txtPrice.Text = "";
                txtCount.Text = "";
            }
            CMSMData.CMSMStruct.GoodsStruct gs = new CMSMData.CMSMStruct.GoodsStruct();
            err = null;
            gs  = cs.GetGoodsByID(txtGoodsID.Text.Trim(), out err);
            if (gs != null)
            {
                txtGoodsID.Text   = gs.strGoodsID;
                cmbGoodsName.Text = gs.strGoodsName;
                bool sumflag = false;
                foreach (DataRow dr in dtConsItem.Rows)
                {
                    if (gs.strGoodsID == dr["GoodsID"].ToString())
                    {
                        dr["Count"] = (double.Parse(dr["Count"].ToString()) + dCount).ToString();
                        sumflag     = true;
                        break;
                    }
                }

                if (!sumflag)
                {
                    switch (this.formType)
                    {
                    case FormType.ProductionInStorage:
                        if (cs.ProductionInStorageExist(SysInitial.CurOps.strDeptID, dtpInDate.Text, txtGoodsID.Text))
                        {
                            MessageBox.Show("此商品已入库", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                            return;
                        }
                        break;

                    case FormType.SaleCheck:
                        if (cs.SaleCheckExist(SysInitial.CurOps.strDeptID, dtpInDate.Text, txtGoodsID.Text))
                        {
                            MessageBox.Show("此商品已盘点", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                            return;
                        }
                        break;
                    }

                    DataRow dr = dtConsItem.NewRow();
                    dr[0] = "0";
                    dr[1] = gs.strGoodsID;
                    dr[2] = gs.strGoodsName;
                    dr[3] = dPrice.ToString();
                    dr[4] = dCount.ToString();
                    dtConsItem.Rows.Add(dr);
                }
                this.DgBind();
                cmbGoodsName.Focus();
            }
            else
            {
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                MessageBox.Show("无此商品信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
        }
        private static void SubtypeChange(int value, string SubtypeField)
        {
            try
            {
                int intSubVal = value;

                //Feature layer being Identified

                //Exit if the layer is not found
                if (v_ViewerLayer == null)
                    return;

                string strFld = null;
                ComboBox pCmbBox = default(ComboBox);
                NumericUpDown pNUP = default(NumericUpDown);
                ICodedValueDomain pCV = default(ICodedValueDomain);
                IRangeDomain pRg = default(IRangeDomain);

                ISubtypes pSubTypes = (ISubtypes)v_ViewerLayer.FeatureClass;
                int pLeftPadding = 10;

                //Loop through all controls
                foreach (TabPage tbPg in s_tbCntlDisplay.TabPages)
                {
                    foreach (Control cntrl in tbPg.Controls)
                    {
                        //If the control is a combobox, then reapply the domain

                        if (cntrl is Panel)
                        {
                            foreach (Control cntrlPnl in cntrl.Controls)
                            {

                                if (cntrlPnl is ComboBox)
                                {
                                    pCmbBox = (ComboBox)cntrlPnl;

                                    if (SubtypeField != pCmbBox.Tag.ToString())
                                    {
                                        //Get the Field
                                        strFld = pCmbBox.Tag.ToString();
                                        if (strFld.IndexOf("|") > 0)
                                        {
                                            strFld = (strFld.Substring(0, strFld.IndexOf("|"))).Trim();
                                        }
                                        //Get the domain

                                        pCV = (ICodedValueDomain)pSubTypes.get_Domain(intSubVal, strFld);
                                        if (pCV == null)
                                        {
                                            pCmbBox.DataSource = null;

                                        }
                                        else
                                        {
                                            //If the domain has two values, remove the combo box and add a custompanel
                                            if (pCV.CodeCount == 2)
                                            {
                                                CustomPanel pNewGpBox = new CustomPanel();
                                                RadioButton pRDButton = default(RadioButton);
                                                pNewGpBox.Tag = pCmbBox.Tag;
                                                pNewGpBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
                                                pNewGpBox.BackColor = Color.White;
                                                //  pNewGpBox.BorderColor = Pens.LightGray

                                                pNewGpBox.Width = pCmbBox.Width;
                                                pNewGpBox.Top = pCmbBox.Top;
                                                pNewGpBox.Left = pCmbBox.Left;

                                                pRDButton = new RadioButton();
                                                pRDButton.Name = "Rdo1";
                                                string codeVal = "";
                                                string displayVal = "";

                                                Globals.SubtypeValuesAtIndex(0, (ISubtypes)pCV, ref codeVal, ref  displayVal);

                                                pRDButton.Tag = codeVal;
                                                pRDButton.Text = displayVal;

                                                pRDButton.Left = pLeftPadding;

                                                pRDButton.AutoSize = true;
                                                pNewGpBox.Controls.Add(pRDButton);

                                                pNewGpBox.Height = pRDButton.Height + 12;
                                                pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;

                                                pRDButton = new RadioButton();
                                                pRDButton.Name = "Rdo2";
                                                Globals.SubtypeValuesAtIndex(1, (ISubtypes)pCV, ref codeVal, ref displayVal);

                                                pRDButton.Tag = codeVal;
                                                pRDButton.Text = displayVal;

                                                pRDButton.Left = pNewGpBox.Width / 2;

                                                pRDButton.AutoSize = true;
                                                pNewGpBox.Controls.Add(pRDButton);
                                                pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;

                                                tbPg.Controls.Add(pNewGpBox);

                                                try
                                                {
                                                    tbPg.Controls.Remove(pCmbBox);
                                                    //Dim cnts() As Control = tbPg.Controls.Find("lblEdit" & strFld, False)
                                                    //If cnts.Length > 0 Then
                                                    //    tbPg.Controls.Remove(cnts(0))
                                                    //End If

                                                }
                                                catch// (Exception ex)
                                                {
                                                }

                                                pNewGpBox = null;
                                                pRDButton = null;

                                            }
                                            else
                                            {
                                                //Set the domain value

                                                pCmbBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never;

                                                pCmbBox.DataSource = Globals.DomainToList((IDomain)pCV);
                                                pCmbBox.DisplayMember = "getDisplay";
                                                pCmbBox.ValueMember = "getValue";
                                                pCmbBox.Visible = true;
                                                pCmbBox.Refresh();

                                                string codeVal = "";
                                                string displayVal = "";
                                                Globals.SubtypeValuesAtIndex(0, (ISubtypes)pCV, ref codeVal, ref displayVal);
                                                pCmbBox.Text = displayVal;
                                            }

                                        }

                                    }
                                    //If the contorl is a coded value domain with two values

                                }
                                else if (cntrlPnl is CustomPanel)
                                {

                                    //Get the Field
                                    strFld = cntrlPnl.Tag.ToString();
                                    if (strFld.IndexOf("|") > 0)
                                    {
                                        strFld = (strFld.Substring(0, strFld.IndexOf("|"))).Trim();
                                    }
                                    //Get the fomain
                                    pCV = (ICodedValueDomain)pSubTypes.get_Domain(intSubVal, strFld);

                                    if (pCV == null)
                                    {
                                        cntrlPnl.Controls.Clear();

                                    }
                                    else
                                    {
                                        //If the domain has more than two values, remove the custompanel and add a combo box
                                        if (pCV.CodeCount == 2)
                                        {
                                            try
                                            {
                                                //Set up the proper domain values
                                                RadioButton pRdoBut = default(RadioButton);
                                                pRdoBut = (RadioButton)cntrlPnl.Controls["Rdo1"];
                                                string codeVal = "";
                                                string displayVal = "";
                                                Globals.SubtypeValuesAtIndex(0, (ISubtypes)pCV, ref  codeVal, ref  displayVal);

                                                pRdoBut.Tag = codeVal;
                                                pRdoBut.Text = displayVal;

                                                pRdoBut = (RadioButton)cntrlPnl.Controls["Rdo2"];
                                                Globals.SubtypeValuesAtIndex(1, (ISubtypes)pCV, ref codeVal, ref displayVal);

                                                pRdoBut.Tag = codeVal;
                                                pRdoBut.Text = displayVal;

                                            }
                                            catch //(Exception ex)
                                            {
                                            }

                                        }
                                        else
                                        {
                                            ComboBox pCBox = default(ComboBox);
                                            pCBox = new ComboBox();
                                            pCBox.Tag = strFld;
                                            pCBox.Name = "cboEdt" + strFld;
                                            pCBox.Left = cntrlPnl.Left;
                                            pCBox.Top = cntrlPnl.Top;
                                            pCBox.Width = cntrlPnl.Width;
                                            pCBox.Height = pCBox.Height + 5;
                                            pCBox.DropDownStyle = ComboBoxStyle.DropDownList;

                                            pCBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never;
                                            pCBox.DataSource = Globals.DomainToList((IDomain)pCV);
                                            pCBox.DisplayMember = "getDisplay";
                                            pCBox.ValueMember = "getValue";
                                            pCBox.Visible = true;
                                            pCBox.Refresh();

                                            string codeVal = "";
                                            string displayVal = "";
                                            Globals.SubtypeValuesAtIndex(0, (ISubtypes)pCV, ref codeVal, ref displayVal);
                                            pCBox.Text = displayVal;
                                            // pCmdBox.MaxLength = pDc.Length

                                            tbPg.Controls.Add(pCBox);
                                            // MsgBox(pCBox.Items.Count)

                                            pCBox.Visible = true;
                                            pCBox.Refresh();

                                            tbPg.Controls.Remove(cntrlPnl);

                                            pCBox = null;

                                        }

                                    }
                                    //If the contorl is a range domain
                                }
                                else if (cntrlPnl is NumericUpDown)
                                {
                                    //get the control
                                    pNUP = (NumericUpDown)cntrlPnl;
                                    //Get the field
                                    strFld = pNUP.Tag.ToString();
                                    if (strFld.IndexOf("|") > 0)
                                    {
                                        strFld = (strFld.Substring(0, strFld.IndexOf("|"))).Trim();
                                    }
                                    //Get the domain
                                    pRg = (IRangeDomain)pSubTypes.get_Domain(intSubVal, strFld);
                                    if (pRg == null)
                                    {
                                        pNUP.Enabled = false;

                                    }
                                    else
                                    {
                                        pNUP.Enabled = true;
                                        pNUP.Minimum = Convert.ToDecimal(pRg.MinValue.ToString());
                                        pNUP.Maximum = Convert.ToDecimal(pRg.MaxValue.ToString());
                                    }

                                    pNUP.Refresh();
                                }
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in the edit control subtype change" + Environment.NewLine + ex.Message);

            }
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     項目値変更後の処理 - プロヴィンスID
        /// </summary>
        /// <param name="control">プロヴィンスコンボボックス</param>
        /// <param name="unit">ユニット</param>
        private void PostItemChangedProvinceId(ComboBox control, Unit unit)
        {
            // 項目の値を更新する
            UpdateItemValue(control, unit);

            // 項目の色を更新する
            control.Refresh();
        }
Ejemplo n.º 28
0
        private void WelcomeForm_Load(object sender, System.EventArgs e)
        {
            Language.LoadControlNames(this);

            this.BringToFront();

            langSel.Items.AddRange(Language.GetPackNames());
            langSel.SelectedItem = Language.Current;

            showAtStart.Checked = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "ShowWindow"), 1) == 1;

            clientList.Items.Add(Language.GetString(LocString.Auto2D));
            clientList.Items.Add(Language.GetString(LocString.Auto3D));
            for (int i = 1; ; i++)
            {
                string val = String.Format("Client{0}", i);
                string cli = Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, val);
                if (cli == null || cli == "")
                {
                    break;
                }
                if (File.Exists(cli))
                {
                    clientList.Items.Add(new PathElipsis(cli));
                }
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, val);
            }
            int sel = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "DefClient"), 0);

            if (sel >= clientList.Items.Count)
            {
                sel = 0;
                Config.SetRegString(Microsoft.Win32.Registry.CurrentUser, "DefClient", "0");
            }
            clientList.SelectedIndex = sel;

            dataDir.Items.Add(Language.GetString(LocString.AutoDetect));
            for (int i = 1; ; i++)
            {
                string val = String.Format("Dir{0}", i);
                string dir = Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, val);
                if (dir == null || dir == "")
                {
                    break;
                }
                if (Directory.Exists(dir))
                {
                    dataDir.Items.Add(dir);
                }
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, val);
            }

            try
            {
                dataDir.SelectedIndex = Convert.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "LastDir"));
            }
            catch
            {
                dataDir.SelectedIndex = 0;
            }

            patchEncy.Checked = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "PatchEncy"), 1) != 0;
            useEnc.Checked    = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, "ServerEnc"), 0) != 0;

            LoginCFG_SE lse = new LoginCFG_SE();
            UOGamers_SE uog;

            serverList.BeginUpdate();

            //serverList.Items.Add( lse=new LoginCFG_SE() );
            //serverList.SelectedItem = lse;

            for (int i = 1; ; i++)
            {
                ServerEntry se;
                string      sval = String.Format("Server{0}", i);
                string      serv = Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, sval);
                if (serv == null)
                {
                    break;
                }
                string pval = String.Format("Port{0}", i);
                int    port = Utility.ToInt32(Config.GetRegString(Microsoft.Win32.Registry.CurrentUser, pval), 0);
                serverList.Items.Add(se = new ServerEntry(serv, port));
                if (serv == lse.RealAddress && port == lse.Port)
                {
                    serverList.SelectedItem = se;
                }
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, sval);
                Config.DeleteRegValue(Microsoft.Win32.Registry.CurrentUser, pval);
            }

            serverList.Items.Add(uog = new UOGamers_SE("Zenvera (UOR)", "login.zenvera.com"));
            if (serverList.SelectedItem == null || lse.RealAddress == uog.RealAddress && lse.Port == 2593)
            {
                serverList.SelectedItem = uog;
            }

            serverList.Items.Add(uog = new UOGamers_SE("Second Age (T2A)", "login.uosecondage.com"));
            if (lse.RealAddress == uog.RealAddress && lse.Port == 2593)
            {
                serverList.SelectedItem = uog;
            }

            serverList.Items.Add(uog = new UOGamers_SE("An Corp (T2A)", "login.uoancorp.com"));
            if (lse.RealAddress == uog.RealAddress && lse.Port == 2593)
            {
                serverList.SelectedItem = uog;
            }

            serverList.Items.Add(uog = new UOGamers_SE("Forever (P16)", "login.uoforever.com", 2599));
            if (lse.RealAddress == uog.RealAddress && lse.Port == 2599)
            {
                serverList.SelectedItem = uog;
            }

            serverList.Items.Add(uog = new UOGamers_SE("Pandora (HS)", "play.pandorauo.com"));
            if (lse.RealAddress == uog.RealAddress && lse.Port == 2593)
            {
                serverList.SelectedItem = uog;
            }

            serverList.Items.Add(uog = new UOGamers_SE("Electronic Arts/Origin Servers", "login.ultimaonline.com", 7775));
            if (lse.RealAddress == uog.RealAddress && (lse.Port >= 7775 && lse.Port <= 7778))
            {
                serverList.SelectedItem = uog;
            }

            serverList.EndUpdate();

            serverList.Refresh();

            WindowState = FormWindowState.Normal;
            this.BringToFront();
            this.TopMost = true;

            _ShowTimer          = new System.Windows.Forms.Timer();
            _ShowTimer.Interval = 250;
            _ShowTimer.Enabled  = true;
            _ShowTimer.Tick    += new EventHandler(timer_Tick);
        }
        private static void AddControls(bool displayOnly)
        {
            try
            {

                s_tbCntlDisplay.TabPages.Clear();
                s_tbCntlDisplay.Controls.Clear();

                //Exit if the layer is not found
                if (v_ViewerLayer == null)
                    return;
                if (v_ViewerLayer.FeatureClass == null)
                    return;

                int pLeftPadding = 10;

                //Clear out the controls from the container
               // s_tbCntlDisplay.TabPages.Clear();
              //  s_tbCntlDisplay.Controls.Clear();
                TabPage pTbPg = new TabPage();
                s_tbCntlDisplay.TabPages.Add(pTbPg);

                //Controls to display attributes
                //Dim pTbPg As TabPage = Nothing
                TextBox pTxtBox = default(TextBox);
                Label pLbl = default(Label);
                NumericUpDown pNumBox = default(NumericUpDown);
                System.Windows.Forms.Button pBtn = null;
                ComboBox pCBox = default(ComboBox);
                RadioButton pRDButton = default(RadioButton);

                DateTimePicker pDateTime = default(DateTimePicker);
                //Spacing between each control
               // int intCtrlSpace = 5;
                //Spacing between a lable and a control
                //int intLabelCtrlSpace = 0;

                //Set the width of each control
                //   Dim my.Globals.Constants.c_ControlWidth As Integer = 50
                //used for sizing text, only used when text is larger then display
                Graphics g = default(Graphics);
                SizeF s = default(SizeF);

                //Used to loop through featurelayer
                IFields pDCs = default(IFields);
                IField pDc = default(IField);
                int pSubTypeDefValue = 0;

                //Get the columns for hte layer
                pDCs = v_ViewerLayer.FeatureClass.Fields;
                ISubtypes pSubType = (ISubtypes)v_ViewerLayer.FeatureClass;
                if (pSubType.HasSubtype)
                {
                    pSubTypeDefValue = pSubType.DefaultSubtypeCode;
                    //pfl.Columns(pfl.SubtypeColumnIndex).DefaultValue
                }

                //Field Name
                string strfld = null;
                //Field Alias
                string strAli = null;

                IDomain pDom = default(IDomain);
                for (int i = 0; i <= pDCs.FieldCount - 1; i++)
                {
                    pDc = (IField)pDCs.get_Field(i);
                    ILayerFields pLayerFields = default(ILayerFields);
                    IFieldInfo pFieldInfo = default(IFieldInfo);

                    pLayerFields = (ILayerFields)v_ViewerLayer;
                    pFieldInfo = pLayerFields.get_FieldInfo(pLayerFields.FindField(pDc.Name));
                    //  pFieldInfo.Visible = False

                    if (pFieldInfo.Visible == false)
                    {

                    }
                    else
                    {

                        pDom = null;

                        //Get the field names
                        strfld = pDc.Name;
                        strAli = pDc.AliasName;

                        //Check the field types

                        if (v_ViewerLayer.FeatureClass.ShapeFieldName == strfld ||
                            v_ViewerLayer.FeatureClass.OIDFieldName == strfld ||
                            (strfld).ToUpper() == ("shape.len").ToUpper() ||
                           (strfld).ToUpper() == ("shape.area").ToUpper() ||
                           (strfld).ToUpper() == ("shape_length").ToUpper() ||
                           (strfld).ToUpper() == ("shape_len").ToUpper() ||
                           (strfld).ToUpper() == ("shape_area").ToUpper() ||
                           (strfld).ToUpper() == ("LASTUPDATE").ToUpper() ||
                           (strfld).ToUpper() == ("LASTEDITOR").ToUpper())
                        {

                        }
                        else if (displayOnly)
                        {

                            //Create a lable for the field name
                            pLbl = new Label();
                            //Apply the field alias to the field name
                            pLbl.Text = strAli;
                            //Link the field to the name of the control
                            pLbl.Name = "lblEdit" + strfld;
                            //Add the control at the determined Location
                            pLbl.Left = 0;

                            pLbl.Top = 0;
                            //Apply global font
                            pLbl.Font = c_FntLbl;
                            //Create a graphics object to messure the text
                            g = pLbl.CreateGraphics();
                            s = g.MeasureString(pLbl.Text, pLbl.Font);

                            pLbl.Height = Convert.ToInt32(s.Height);
                            //If the text is larger then the control, truncate the control
                            if (s.Width >= c_ControlWidth)
                            {
                                pLbl.Width = c_ControlWidth;
                                //Use autosize if it fits
                            }
                            else
                            {
                                pLbl.AutoSize = true;
                            }

                            //Create a new control to display the attributes
                            pTxtBox = new TextBox();

                            //Tag the control with the field it represents
                            pTxtBox.Tag = (strfld).Trim();
                            //Name the field with the field name
                            pTxtBox.Name = "txtEdit" + strfld;
                            //Locate the control on the display
                            pTxtBox.Left = 0;
                            // pTxtBox.Enabled = False
                            pTxtBox.BackColor = Color.White;
                            pTxtBox.ReadOnly = true;

                            pTxtBox.Width = c_ControlWidth;
                            if (pDc.Type == esriFieldType.esriFieldTypeString)
                            {
                                //Make the box taller if it is a long field
                                if (pDc.Length > 125)
                                {
                                    pTxtBox.Multiline = true;
                                    pTxtBox.Height = pTxtBox.Height * 3;

                                }

                            }
                            if (pDc.Length > 0)
                            {
                                pTxtBox.MaxLength = pDc.Length;
                            }

                            //Apply global font
                            pTxtBox.Font = c_Fnt;

                            //Group into panels to assist resizing
                            Panel pPnl = new Panel();
                            pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                            pLbl.Top = 0;
                            pTxtBox.Top = 5 + pLbl.Height;
                            pPnl.Width = c_ControlWidth;
                            pPnl.Margin = new Padding(0);
                            pPnl.Padding = new Padding(0);

                            pPnl.Top = 0;
                            pPnl.Left = 0;
                            pPnl.Height = pTxtBox.Height + pLbl.Height + 10;
                            pPnl.Controls.Add(pLbl);
                            pPnl.Controls.Add(pTxtBox);
                            pTbPg.Controls.Add(pPnl);

                            //Reserved Columns
                        }
                        else if (pSubType.SubtypeFieldName == strfld)
                        {
                            //Create a lable for the field name
                            pLbl = new Label();
                            //Apply the field alias to the field name
                            pLbl.Text = strAli + " (Set This Value First)";
                            //Link the field to the name of the control
                            pLbl.Name = "lblEdit" + strfld;

                            //Add the control at the determined Location

                            pLbl.Left = 0;

                            pLbl.Top = 0;
                            pLbl.ForeColor = Color.Blue;

                            //Apply global font
                            pLbl.Font = c_FntLbl;
                            //Create a graphics object to messure the text
                            g = pLbl.CreateGraphics();
                            s = g.MeasureString(pLbl.Text, pLbl.Font);

                            pLbl.Height = Convert.ToInt32(s.Height);
                            //If the text is larger then the control, truncate the control
                            if (s.Width >= c_ControlWidth)
                            {
                                pLbl.Width = c_ControlWidth;
                                //Use autosize if it fits
                            }
                            else
                            {
                                pLbl.AutoSize = true;
                            }

                            if (Globals.SubtypeCount((ISubtypes)pSubType.Subtypes) == 2)
                            {
                                CustomPanel pNewGpBox = new CustomPanel();
                                pNewGpBox.Tag = strfld;
                                pNewGpBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
                                pNewGpBox.BackColor = Color.White;
                                //  pNewGpBox.BorderColor = Pens.LightGray

                                pNewGpBox.Width = c_ControlWidth;
                                pNewGpBox.Top = 0;
                                pNewGpBox.Left = 0;

                                pRDButton = new RadioButton();
                                pRDButton.Font = c_Fnt;
                                pRDButton.Name = "Rdo1Sub";
                                string codeVal = "";
                                string displayVal = "";
                                Globals.SubtypeValuesAtIndex(0, (ISubtypes)pSubType, ref codeVal, ref displayVal);
                                pRDButton.Tag = codeVal;

                                pRDButton.Text = displayVal;

                                pRDButton.Left = pLeftPadding;

                                pRDButton.AutoSize = true;
                                pNewGpBox.Controls.Add(pRDButton);

                                pNewGpBox.Height = pRDButton.Height + 12;
                                pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;

                                pRDButton = new RadioButton();
                                pRDButton.Font = c_Fnt;
                                pRDButton.Name = "Rdo2Sub";
                                Globals.SubtypeValuesAtIndex(1, pSubType, ref codeVal, ref displayVal);

                                pRDButton.Tag = codeVal;
                                pRDButton.Text = displayVal;
                                pRDButton.Left = pNewGpBox.Width / 2;

                                pRDButton.AutoSize = true;
                                pNewGpBox.Controls.Add(pRDButton);
                                pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;

                                Panel pPnl = new Panel();
                                pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                pLbl.Top = 0;
                                pNewGpBox.Top = pLbl.Height + 5;

                                pPnl.Width = c_ControlWidth;
                                pPnl.Margin = new Padding(0);
                                pPnl.Padding = new Padding(0);

                                pPnl.Top = 0;
                                pPnl.Left = 0;
                                pPnl.Height = pNewGpBox.Height + pLbl.Height + 10;
                                pPnl.Controls.Add(pLbl);
                                pPnl.Controls.Add(pNewGpBox);

                                pTbPg.Controls.Add(pPnl);

                                pNewGpBox = null;
                                //  pPf = Nothing

                            }
                            else
                            {
                                pCBox = new ComboBox();
                                pCBox.Tag = strfld;
                                pCBox.Name = "cboEdt" + strfld;
                                pCBox.Left = 0;
                                pCBox.Top = 0;
                                pCBox.Width = c_ControlWidth;
                                pCBox.Height = pCBox.Height + 5;
                                pCBox.DropDownStyle = ComboBoxStyle.DropDownList;

                                pCBox.Font = c_Fnt;
                                pCBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never;

                                pCBox.DataSource = Globals.SubtypeToList(pSubType);
                                pCBox.DisplayMember = "getDisplay";
                                pCBox.ValueMember = "getValue";
                                // pCmdBox.MaxLength = pDc.Length

                                pCBox.SelectionChangeCommitted += cmbSubTypChange_Click;

                                Panel pPnl = new Panel();
                                pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                pLbl.Top = 0;
                                pCBox.Top = pLbl.Height + 5;

                                pPnl.Width = c_ControlWidth;
                                pPnl.Margin = new Padding(0);
                                pPnl.Padding = new Padding(0);

                                pPnl.Top = 0;
                                pPnl.Left = 0;
                                pPnl.Height = pCBox.Height + pLbl.Height + 15;
                                pPnl.Controls.Add(pLbl);
                                pPnl.Controls.Add(pCBox);

                                pTbPg.Controls.Add(pPnl);
                                string codeVal = "";
                                string displayVal = "";
                                Globals.SubtypeValuesAtIndex(0, (ISubtypes)pSubType, ref codeVal, ref displayVal);

                                pCBox.Text = displayVal;

                            }

                        }
                        else
                        {

                            if (pSubType.HasSubtype)
                            {
                                pDom = pSubType.get_Domain(pSubTypeDefValue, pDc.Name);

                            }
                            else
                            {
                                pDom = pDc.Domain;

                            }
                            //No Domain Found

                            if (pDom == null)
                            {

                                if (pDc.Type == esriFieldType.esriFieldTypeString || pDc.Type == esriFieldType.esriFieldTypeDouble || pDc.Type == esriFieldType.esriFieldTypeInteger || pDc.Type == esriFieldType.esriFieldTypeSingle || pDc.Type == esriFieldType.esriFieldTypeSmallInteger)
                                {
                                    //Create a lable for the field name
                                    pLbl = new Label();
                                    //Apply the field alias to the field name
                                    pLbl.Text = strAli;
                                    //Link the field to the name of the control
                                    pLbl.Name = "lblEdit" + strfld;
                                    //Add the control at the determined Location
                                    pLbl.Left = 0;

                                    pLbl.Top = 0;
                                    //Apply global font
                                    pLbl.Font = c_FntLbl;
                                    //Create a graphics object to messure the text
                                    g = pLbl.CreateGraphics();
                                    s = g.MeasureString(pLbl.Text, pLbl.Font);

                                    pLbl.Height = Convert.ToInt32(s.Height);
                                    //If the text is larger then the control, truncate the control
                                    if (s.Width >= c_ControlWidth)
                                    {
                                        pLbl.Width = c_ControlWidth;
                                        //Use autosize if it fits
                                    }
                                    else
                                    {
                                        pLbl.AutoSize = true;
                                    }

                                    //Create a new control to display the attributes
                                    pTxtBox = new TextBox();

                                    //Tag the control with the field it represents
                                    pTxtBox.Tag = (strfld).Trim();
                                    //Name the field with the field name
                                    pTxtBox.Name = "txtEdit" + strfld;
                                    //Locate the control on the display
                                    pTxtBox.Left = 0;

                                    pTxtBox.Width = c_ControlWidth;
                                    if (pDc.Type == esriFieldType.esriFieldTypeString)
                                    {
                                        //Make the box taller if it is a long field
                                        if (pDc.Length > 125)
                                        {
                                            pTxtBox.Multiline = true;
                                            pTxtBox.Height = pTxtBox.Height * 3;

                                        }

                                    }
                                    if (pDc.Length > 0)
                                    {
                                        pTxtBox.MaxLength = pDc.Length;
                                    }

                                    //Apply global font
                                    pTxtBox.Font = c_Fnt;

                                    //Group into panels to assist resizing
                                    Panel pPnl = new Panel();
                                    pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                    pLbl.Top = 0;
                                    pTxtBox.Top = 5 + pLbl.Height;
                                    pPnl.Width = c_ControlWidth;
                                    pPnl.Margin = new Padding(0);
                                    pPnl.Padding = new Padding(0);

                                    pPnl.Top = 0;
                                    pPnl.Left = 0;
                                    pPnl.Height = pTxtBox.Height + pLbl.Height + 10;
                                    pPnl.Controls.Add(pLbl);
                                    pPnl.Controls.Add(pTxtBox);
                                    pTbPg.Controls.Add(pPnl);

                                }
                                else if (pDc.Type == esriFieldType.esriFieldTypeDate)
                                {
                                    //Create a lable for the field name
                                    pLbl = new Label();
                                    //Apply the field alias to the field name
                                    pLbl.Text = strAli;
                                    //Link the field to the name of the control
                                    pLbl.Name = "lblEdit" + strfld;
                                    //Add the control at the determined Location
                                    pLbl.Left = 0;

                                    //   pLbl.Top = pNextControlTop
                                    //Apply global font
                                    pLbl.Font = c_FntLbl;
                                    //Create a graphics object to messure the text
                                    g = pLbl.CreateGraphics();
                                    s = g.MeasureString(pLbl.Text, pLbl.Font);

                                    pLbl.Height = Convert.ToInt32(s.Height);
                                    //If the text is larger then the control, truncate the control
                                    if (s.Width >= c_ControlWidth)
                                    {
                                        pLbl.Width = c_ControlWidth;
                                        //Use autosize if it fits
                                    }
                                    else
                                    {
                                        pLbl.AutoSize = true;
                                    }
                                    //Determine the Location for the next control
                                    //   pNextControlTop = pLbl.Top + s.Height + intLabelCtrlSpace

                                    pDateTime = new DateTimePicker();
                                    pDateTime.Font = c_Fnt;
                                    //pDateTime.CustomFormat = "m/d/yyyy"
                                    pDateTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
                                    pDateTime.CustomFormat = "M-d-yy";
                                    // h:mm tt"
                                    pDateTime.ShowCheckBox = true;
                                    pDateTime.Tag = strfld;
                                    pDateTime.Name = "dtEdt" + strfld;
                                    pDateTime.Left = 0;
                                    //   pDateTime.Top = pNextControlTop
                                    pDateTime.Width = c_ControlWidth;

                                    //Determine the Location for the next control
                                    //pNextControlTop = pDateTime.Top + pDateTime.Height + intCtrlSpace
                                    Panel pPnl = new Panel();
                                    pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                    pLbl.Top = 0;
                                    pDateTime.Top = 5 + pLbl.Height;
                                    pPnl.Width = c_ControlWidth;
                                    pPnl.Margin = new Padding(0);
                                    pPnl.Padding = new Padding(0);

                                    pPnl.Top = 0;
                                    pPnl.Left = 0;
                                    pPnl.Height = pDateTime.Height + pLbl.Height + 10;
                                    pPnl.Controls.Add(pLbl);
                                    pPnl.Controls.Add(pDateTime);
                                    pTbPg.Controls.Add(pPnl);

                                }
                                else if (pDc.Type == esriFieldType.esriFieldTypeRaster)
                                {
                                    //Create a lable for the field name
                                    pLbl = new Label();
                                    //Apply the field alias to the field name
                                    pLbl.Text = strAli;
                                    //Link the field to the name of the control
                                    pLbl.Name = "lblEdit" + strfld;
                                    //Add the control at the determined Location
                                    pLbl.Left = 0;
                                    pLbl.Top = 0;
                                    //Apply global font
                                    pLbl.Font = c_FntLbl;
                                    //Create a graphics object to messure the text
                                    g = pLbl.CreateGraphics();
                                    s = g.MeasureString(pLbl.Text, pLbl.Font);
                                    pLbl.Height = Convert.ToInt32(s.Height);
                                    //If the text is larger then the control, truncate the control
                                    if (s.Width >= c_ControlWidth)
                                    {
                                        pLbl.Width = 0;
                                        //Use autosize if it fits
                                    }
                                    else
                                    {
                                        pLbl.AutoSize = true;
                                    }
                                    //Determine the Location for the next control

                                    //Create a new control to display the attributes
                                    pTxtBox = new TextBox();
                                    //Disable the control
                                    //  pPic.ReadOnly = True
                                    //Tag the control with the field it represents
                                    pTxtBox.Tag = (strfld).Trim();
                                    //Name the field with the field name
                                    pTxtBox.Name = "txtEdit" + strfld;
                                    //Locate the control on the display
                                    pTxtBox.Left = 0;
                                    pTxtBox.Top = 0;
                                    pTxtBox.Width = c_ControlWidth - pTxtBox.Height;
                                    if (pDc.Type == esriFieldType.esriFieldTypeString)
                                    {
                                        //Make the box taller if it is a long field
                                        if (pDc.Length > 125)
                                        {
                                            pTxtBox.Multiline = true;
                                            pTxtBox.Height = pTxtBox.Height * 3;

                                        }

                                    }
                                    if (pDc.Length > 0)
                                    {
                                        pTxtBox.MaxLength = pDc.Length;
                                    }

                                    pTxtBox.BackgroundImageLayout = ImageLayout.Stretch;

                                    //Apply global font
                                    pTxtBox.Font = c_Fnt;

                                    pBtn = new System.Windows.Forms.Button();

                                    pBtn.Tag = (strfld).Trim();
                                    //Name the field with the field name
                                    pBtn.Name = "btnEdit" + strfld;
                                    //Locate the control on the display
                                    pBtn.Left = pTxtBox.Left + pTxtBox.Width + 5;
                                    pBtn.Top = 0;
                                    System.Drawing.Bitmap img = null;

                                    img = Properties.Resources.Open2;

                                    img.MakeTransparent(img.GetPixel(img.Width - 1, 1));

                                    pBtn.BackgroundImageLayout = ImageLayout.Center;
                                    pBtn.BackgroundImage = img;
                                    img = null;
                                    pBtn.Width = pTxtBox.Height;
                                    pBtn.Height = pTxtBox.Height;

                                    pBtn.Click += btnLoadImgClick;

                                    Panel pPnl = new Panel();
                                    pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                    pLbl.Top = 0;
                                    pTxtBox.Top = 5 + pLbl.Height;
                                    pBtn.Top = pTxtBox.Top;
                                    pPnl.Width = c_ControlWidth;
                                    pPnl.Margin = new Padding(0);
                                    pPnl.Padding = new Padding(0);

                                    pPnl.Top = 0;
                                    pPnl.Left = 0;
                                    pPnl.Height = pTxtBox.Height + pLbl.Height + 10;
                                    pPnl.Controls.Add(pLbl);
                                    pPnl.Controls.Add(pTxtBox);
                                    pPnl.Controls.Add(pBtn);
                                    pTbPg.Controls.Add(pPnl);

                                }
                                else if (pDc.Type == esriFieldType.esriFieldTypeBlob)
                                {
                                    //Create a lable for the field name
                                    pLbl = new Label();
                                    //Apply the field alias to the field name
                                    pLbl.Text = strAli;
                                    //Link the field to the name of the control
                                    pLbl.Name = "lblEdit" + strfld;
                                    //Add the control at the determined Location
                                    pLbl.Left = 0;
                                    pLbl.Top = 0;
                                    //Apply global font
                                    pLbl.Font = c_FntLbl;
                                    //Create a graphics object to messure the text
                                    g = pLbl.CreateGraphics();
                                    s = g.MeasureString(pLbl.Text, pLbl.Font);
                                    pLbl.Height = Convert.ToInt32(s.Height);
                                    //If the text is larger then the control, truncate the control
                                    if (s.Width >= c_ControlWidth)
                                    {
                                        pLbl.Width = 0;
                                        //Use autosize if it fits
                                    }
                                    else
                                    {
                                        pLbl.AutoSize = true;
                                    }
                                    //Determine the Location for the next control

                                    //Create a new control to display the attributes
                                    pTxtBox = new TextBox();
                                    //Disable the control
                                    //  pPic.ReadOnly = True
                                    //Tag the control with the field it represents
                                    pTxtBox.Tag = (strfld).Trim();
                                    //Name the field with the field name
                                    pTxtBox.Name = "txtEdit" + strfld;
                                    //Locate the control on the display
                                    pTxtBox.Left = 0;
                                    pTxtBox.Top = 0;
                                    pTxtBox.Width = c_ControlWidth - pTxtBox.Height;
                                    if (pDc.Type == esriFieldType.esriFieldTypeString)
                                    {
                                        //Make the box taller if it is a long field
                                        if (pDc.Length > 125)
                                        {
                                            pTxtBox.Multiline = true;
                                            pTxtBox.Height = pTxtBox.Height * 3;

                                        }

                                    }
                                    if (pDc.Length > 0)
                                    {
                                        pTxtBox.MaxLength = pDc.Length;
                                    }

                                    pTxtBox.BackgroundImageLayout = ImageLayout.Stretch;

                                    //Apply global font
                                    pTxtBox.Font = c_Fnt;

                                    pBtn = new System.Windows.Forms.Button();

                                    pBtn.Tag = (strfld).Trim();
                                    //Name the field with the field name
                                    pBtn.Name = "btnEdit" + strfld;
                                    //Locate the control on the display
                                    pBtn.Left = pTxtBox.Left + pTxtBox.Width + 5;
                                    pBtn.Top = 0;
                                    System.Drawing.Bitmap img = null;

                                    img = Properties.Resources.Open2;

                                    img.MakeTransparent(img.GetPixel(img.Width - 1, 1));

                                    pBtn.BackgroundImageLayout = ImageLayout.Center;
                                    pBtn.BackgroundImage = img;
                                    img = null;
                                    pBtn.Width = pTxtBox.Height;
                                    pBtn.Height = pTxtBox.Height;

                                    pBtn.Click += btnLoadImgClick;

                                    Panel pPnl = new Panel();
                                    pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                    pLbl.Top = 0;
                                    pTxtBox.Top = 5 + pLbl.Height;
                                    pBtn.Top = pTxtBox.Top;
                                    pPnl.Width = c_ControlWidth;
                                    pPnl.Margin = new Padding(0);
                                    pPnl.Padding = new Padding(0);

                                    pPnl.Top = 0;
                                    pPnl.Left = 0;
                                    pPnl.Height = pTxtBox.Height + pLbl.Height + 10;
                                    pPnl.Controls.Add(pLbl);
                                    pPnl.Controls.Add(pTxtBox);
                                    pPnl.Controls.Add(pBtn);
                                    pTbPg.Controls.Add(pPnl);

                                }
                            }
                            else
                            {
                                if (pDom is CodedValueDomain)
                                {
                                    ICodedValueDomain pCV = default(ICodedValueDomain);

                                    //Create a lable for the field name
                                    pLbl = new Label();
                                    //Apply the field alias to the field name
                                    pLbl.Text = strAli;
                                    //Link the field to the name of the control
                                    pLbl.Name = "lblEdit" + strfld;
                                    //Add the control at the determined Location
                                    pLbl.Left = 0;
                                    pLbl.Top = 0;
                                    //Apply global font
                                    pLbl.Font = c_FntLbl;
                                    //Create a graphics object to messure the text
                                    g = pLbl.CreateGraphics();
                                    s = g.MeasureString(pLbl.Text, pLbl.Font);
                                    pLbl.Height = Convert.ToInt32(s.Height);
                                    //If the text is larger then the control, truncate the control
                                    if (s.Width >= c_ControlWidth)
                                    {
                                        pLbl.Width = c_ControlWidth;
                                        //Use autosize if it fits
                                    }
                                    else
                                    {
                                        pLbl.AutoSize = true;
                                    }
                                    //Determine the Location for the next control
                                    //    pNextControlTop = pLbl.Top + s.Height + intLabelCtrlSpace

                                    pCV = (ICodedValueDomain)pDom;
                                    // pTbPg.Controls.Add(pLbl)

                                    if (pCV.CodeCount == 2)
                                    {
                                        CustomPanel pNewGpBox = new CustomPanel();
                                        pNewGpBox.Tag = strfld;
                                        pNewGpBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
                                        pNewGpBox.BackColor = Color.White;
                                        //  pNewGpBox.BorderColor = Pens.LightGray

                                        pNewGpBox.Width = c_ControlWidth;
                                        pNewGpBox.Top = 0;
                                        pNewGpBox.Left = 0;

                                        pRDButton = new RadioButton();
                                        pRDButton.Name = "Rdo1";
                                        string codeVal = "";
                                        string displayVal = "";
                                        Globals.DomainValuesAtIndex(0, (ICodedValueDomain)pCV, ref codeVal, ref displayVal);

                                        pRDButton.Tag = codeVal;
                                        pRDButton.Text = displayVal;
                                        pRDButton.Font = c_Fnt;
                                        //Dim pPf As SizeF = pRDButton.CreateGraphics.MeasureString(pRDButton.Text, pRDButton.Font)

                                        //'pRDButton.Height = pPf.Height
                                        //pRDButton.Width = pPf.Width + 25

                                        pRDButton.Left = pLeftPadding;

                                        pRDButton.AutoSize = true;
                                        pNewGpBox.Controls.Add(pRDButton);

                                        pNewGpBox.Height = pRDButton.Height + 12;
                                        pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;

                                        pRDButton = new RadioButton();
                                        pRDButton.Font = c_Fnt;
                                        pRDButton.Name = "Rdo2";
                                        Globals.DomainValuesAtIndex(1, (ICodedValueDomain)pCV, ref codeVal, ref displayVal);

                                        pRDButton.Tag = codeVal;
                                        pRDButton.Text = displayVal;
                                        pRDButton.Left = pNewGpBox.Width / 2;
                                        //pPf = pRDButton.CreateGraphics.MeasureString(pRDButton.Text, pRDButton.Font)
                                        //pRDButton.Height = pPf.Height
                                        //pRDButton.Width = pPf.Width + 25

                                        pRDButton.AutoSize = true;
                                        pNewGpBox.Controls.Add(pRDButton);
                                        pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;

                                        // pTbPg.Controls.Add(pNewGpBox)

                                        //  pNextControlTop = pNewGpBox.Top + pNewGpBox.Height + 7 + intLabelCtrlSpace

                                        Panel pPnl = new Panel();
                                        pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                        pLbl.Top = 0;
                                        pNewGpBox.Top = 5 + pLbl.Height;

                                        pPnl.Width = c_ControlWidth;
                                        pPnl.Margin = new Padding(0);
                                        pPnl.Padding = new Padding(0);

                                        pPnl.Top = 0;
                                        pPnl.Left = 0;
                                        pPnl.Height = pNewGpBox.Height + pLbl.Height + 10;
                                        pPnl.Controls.Add(pLbl);
                                        pPnl.Controls.Add(pNewGpBox);

                                        pTbPg.Controls.Add(pPnl);

                                        pNewGpBox = null;
                                        //  pPf = Nothing

                                    }
                                    else
                                    {
                                        pCBox = new ComboBox();
                                        pCBox.Tag = strfld;
                                        pCBox.Name = "cboEdt" + strfld;
                                        pCBox.Left = 0;
                                        pCBox.Top = 0;
                                        pCBox.Width = c_ControlWidth;
                                        pCBox.Height = pCBox.Height + 5;
                                        pCBox.DropDownStyle = ComboBoxStyle.DropDownList;
                                        pCBox.Font = c_Fnt;
                                        pCBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never;

                                        pCBox.DataSource = Globals.DomainToList((IDomain)pCV);
                                        pCBox.DisplayMember = "getDisplay";
                                        pCBox.ValueMember = "getValue";
                                        // pCmdBox.MaxLength = pDc.Length

                                        Panel pPnl = new Panel();
                                        pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                        pLbl.Top = 0;
                                        pCBox.Top = 5 + pLbl.Height;

                                        pPnl.Width = c_ControlWidth;
                                        pPnl.Margin = new Padding(0);
                                        pPnl.Padding = new Padding(0);

                                        pPnl.Top = 0;
                                        pPnl.Left = 0;
                                        pPnl.Height = pCBox.Height + pLbl.Height + 15;
                                        pPnl.Controls.Add(pLbl);
                                        pPnl.Controls.Add(pCBox);

                                        pTbPg.Controls.Add(pPnl);

                                        //   pTbPg.Controls.Add(pCBox)
                                        // MsgBox(pCBox.Items.Count)
                                        pCBox.Visible = true;

                                        string codeVal = "";
                                        string displayVal = "";
                                        Globals.DomainValuesAtIndex(0, (ICodedValueDomain)pCV, ref codeVal, ref displayVal);

                                        pCBox.Text = displayVal;

                                        //Try

                                        //pCBox.SelectedIndex = 0
                                        //Catch ex As Exception

                                        //End Try
                                        pCBox.Visible = true;
                                        pCBox.Refresh();

                                        //  pNextControlTop = pCBox.Top + pCBox.Height + 7 + intLabelCtrlSpace
                                    }

                                }
                                else if (pDom is RangeDomain)
                                {
                                    IRangeDomain pRV = default(IRangeDomain);
                                    //Create a lable for the field name
                                    pLbl = new Label();
                                    //Apply the field alias to the field name
                                    pLbl.Text = strAli;
                                    //Link the field to the name of the control
                                    pLbl.Name = "lblEdit" + strfld;
                                    //Add the control at the determined Location
                                    pLbl.Left = 0;
                                    pLbl.Top = 0;
                                    //Apply global font
                                    pLbl.Font = c_FntLbl;
                                    //Create a graphics object to messure the text
                                    g = pLbl.CreateGraphics();
                                    s = g.MeasureString(pLbl.Text, pLbl.Font);
                                    pLbl.Height = Convert.ToInt32(s.Height);
                                    //If the text is larger then the control, truncate the control
                                    if (s.Width >= c_ControlWidth)
                                    {
                                        pLbl.Width = c_ControlWidth;
                                        //Use autosize if it fits
                                    }
                                    else
                                    {
                                        pLbl.AutoSize = true;
                                    }
                                    //Determine the Location for the next control

                                    pRV = (IRangeDomain)pDom;
                                    pNumBox = new NumericUpDown();
                                    //    AddHandler pNumBox.MouseDown, AddressOf numericClickEvt_MouseDown

                                    if (pDc.Type == esriFieldType.esriFieldTypeInteger)
                                    {
                                        pNumBox.DecimalPlaces = 0;

                                    }
                                    else if (pDc.Type == esriFieldType.esriFieldTypeDouble)
                                    {
                                        pNumBox.DecimalPlaces = 2;
                                        //pDc.DataType.

                                    }
                                    else if (pDc.Type == esriFieldType.esriFieldTypeSingle)
                                    {
                                        pNumBox.DecimalPlaces = 1;
                                        //pDc.DataType.
                                    }
                                    else
                                    {
                                        pNumBox.DecimalPlaces = 2;
                                        //pDc.DataType.
                                    }

                                    pNumBox.Minimum = Convert.ToDecimal(pRV.MinValue.ToString());
                                    pNumBox.Maximum = Convert.ToDecimal(pRV.MaxValue.ToString());
                                    NumericUpDownAcceleration pf = new NumericUpDownAcceleration(3, Convert.ToInt32(Convert.ToDouble(pNumBox.Maximum - pNumBox.Minimum) * 0.02));

                                    pNumBox.Accelerations.Add(pf);

                                    pNumBox.Tag = strfld;
                                    pNumBox.Name = "numEdt" + strfld;
                                    pNumBox.Left = 0;
                                    pNumBox.BackColor = Color.White;
                                    pNumBox.Top = 0;
                                    pNumBox.Width = c_ControlWidth;
                                    pNumBox.Font = c_Fnt;

                                    Panel pPnl = new Panel();
                                    pPnl.BorderStyle = System.Windows.Forms.BorderStyle.None;

                                    pLbl.Top = 0;
                                    pNumBox.Top = 5 + pLbl.Height;

                                    pPnl.Width = c_ControlWidth;
                                    pPnl.Margin = new Padding(0);
                                    pPnl.Padding = new Padding(0);

                                    pPnl.Top = 0;
                                    pPnl.Left = 0;
                                    pPnl.Height = pNumBox.Height + pLbl.Height + 15;
                                    pPnl.Controls.Add(pLbl);
                                    pPnl.Controls.Add(pNumBox);

                                    pTbPg.Controls.Add(pPnl);

                                }

                            }

                        }
                        pLayerFields = null;
                        pFieldInfo = null;

                    }
                }
                //pDC

                if (pSubType.HasSubtype)
                {
                    SubtypeChange(pSubTypeDefValue, pSubType.SubtypeFieldName);

                }
                //cleanup
                pBtn = null;
                pDCs = null;
                pDc = null;

                pTbPg = null;

                pTxtBox = null;
                pLbl = null;
                pNumBox = null;

                pRDButton = null;

                pCBox = null;
                pDateTime = null;
                g = null;
                //s = null;
                s_tbCntlDisplay.ResumeLayout();
                s_tbCntlDisplay.Refresh();

            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in the Costing Tools - CIPProjectWindow: AddControls" + Environment.NewLine + ex.Message);

            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// FillvariableCombo()
 /// </summary>
 /// <param name="cmb">ComboBox to be filled</param>
 /// <param name="scopeWord">The scope of the variable</param>
 protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord)
 {
     cmb.Items.Clear();
     List<EpiInfo.Plugin.IVariable> vars = this.EpiInterpreter.Context.GetVariablesInScope((VariableScope)scopeWord);
     cmb.BeginUpdate();
     foreach (EpiInfo.Plugin.IVariable var in vars)
     {
         if (!(var is Epi.Fields.PredefinedDataField))
         {
             cmb.Items.Add(var.Name.ToString());
         }
     }
     cmb.EndUpdate();
     cmb.Sorted = true;
     cmb.Refresh();
 }
Ejemplo n.º 31
0
        private void txtCount_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                if (e.KeyChar == 8)
                {
                    return;
                }
                if (e.KeyChar < 48 || e.KeyChar > 57)
                {
                    e.Handled = true;
                    return;
                }
            }
            else
            {
                if (SpecTypeIndex > -10 && SpecTypeIndex != this.cmbSepcialType.SelectedIndex)
                {
                    MessageBox.Show("你所选择的特殊处理类型以之前录入商品的处理类型不一致!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                double dCount = 0;
                if (txtCount.Text.Trim() == "")
                {
                    MessageBox.Show("数量不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    dCount = int.Parse(txtCount.Text.Trim());
                }

                double dPrice = 0;
                if (SysInitial.TP == "1")
                {
                    if (txtPrice.Text.Trim() == "")
                    {
                        MessageBox.Show("单价不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        dPrice = Double.Parse(txtPrice.Text.Trim());
                    }
                }

                if (txtGoodsID.Text.Trim() == "")
                {
                    MessageBox.Show("商品信息有误,请重新选择商品!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    txtGoodsID.Text = "";
                    cmbGoodsName.Items.Clear();
                    cmbGoodsName.Refresh();
                    txtPrice.Text = "0";
                    txtCount.Text = "";
                }
                CMSMData.CMSMStruct.GoodsStruct gs = new CMSMData.CMSMStruct.GoodsStruct();
                err = null;
                gs  = cs.GetGoodsByID(txtGoodsID.Text.Trim(), out err);
                if (gs != null)
                {
                    txtGoodsID.Text   = gs.strGoodsID;
                    cmbGoodsName.Text = gs.strGoodsName;
                    bool sumflag = false;
                    for (int i = 0; i < dtConsItem.Rows.Count; i++)
                    {
                        if (gs.strGoodsID == dtConsItem.Rows[i]["GoodsID"].ToString())
                        {
                            dtConsItem.Rows[i]["Count"] = (double.Parse(dtConsItem.Rows[i]["Count"].ToString()) + dCount).ToString();
                            dtConsItem.Rows[i]["Fee"]   = (double.Parse(dtConsItem.Rows[i]["Fee"].ToString()) + (dPrice * dCount)).ToString();
                            sumflag = true;
                            break;
                        }
                    }
                    if (!sumflag)
                    {
                        DataRow dr = dtConsItem.NewRow();
                        dr[0] = gs.strGoodsID;
                        dr[1] = gs.strGoodsName;
                        dr[2] = dPrice.ToString();
                        dr[3] = dCount.ToString();
                        dr[4] = "0";
                        dr[5] = (dPrice * dCount).ToString();
                        dtConsItem.Rows.Add(dr);
                    }
                    if (SpecTypeIndex == -10)
                    {
                        SpecTypeIndex = this.cmbSepcialType.SelectedIndex;
                    }
                    if (this.cmbSepcialType.Enabled == true)
                    {
                        this.cmbSepcialType.Enabled = false;
                    }
                    this.DgBind();
                    cmbGoodsName.Focus();
                }
                else
                {
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                    MessageBox.Show("无此商品信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
            }
        }
Ejemplo n.º 32
0
        protected void FillVariableCombo(ComboBox cmb )
        {
            cmb.Items.Clear();
            //VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
            cmb.BeginUpdate();
            foreach (DataColumn Column in this.mainForm.EpiInterpreter.Context.DataSet.Tables["output"].Columns)
            {
                if (!(Column.DataType.FullName.ToString() == "System.DateTime"))
                {
                    cmb.Items.Add(Column.ColumnName.ToString());
                }

            }

            cmb.EndUpdate();
            cmb.Sorted = true;
            cmb.Refresh();
        }
Ejemplo n.º 33
0
		public void DrawItemEventTest ()
		{
			eventFired = false;
			drawItemsArgs = null;
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			ComboBox cmbbox = new ComboBox ();
			cmbbox.DropDownStyle = ComboBoxStyle.Simple;
			cmbbox.DrawMode = DrawMode.OwnerDrawFixed;
			cmbbox.DrawItem += new DrawItemEventHandler (DrawItemEventH);

			myform.Controls.Add (cmbbox);
			cmbbox.Items.AddRange(new object[] {"Item1"});

			myform.Visible = true;
			cmbbox.Visible = true;
			cmbbox.Refresh ();

			Assert.AreEqual (true, eventFired, "DW1");
			Assert.AreEqual (0, drawItemsArgs.Index, "DW2");
			myform.Dispose ();
		}
Ejemplo n.º 34
0
 /// <summary>
 /// FillvariableCombo()
 /// </summary>
 /// <param name="cmb">ComboBox to be filled</param>
 /// <param name="scopeWord">The scope of the variable</param>
 /// <param name="typ">Limit selection to (DataType)</param>
 protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord, DataType typ)
 {
     cmb.Items.Clear();
     VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
     cmb.BeginUpdate();
     foreach (IVariable var in vars)
     {
         int VType = (int)var.DataType;
         int FType = (int)typ;
         if (!(var is Epi.Fields.PredefinedDataField) && ((VType & FType) == VType))
         {
             cmb.Items.Add(var.Name.ToString());
         }
     }
     cmb.EndUpdate();
     cmb.Sorted = true;
     cmb.Refresh();
 }
Ejemplo n.º 35
0
 void Invoke_Refresh()
 {
     classComboBox.Refresh();
 }
Ejemplo n.º 36
0
        /// <summary>
        /// FillWeightVariableCombo()
        /// </summary>
        /// <param name="cmb">ComboBox to be filled</param>
        /// <param name="scopeWord">The scope of the variable</param>
        protected void FillWeightVariableCombo(ComboBox cmb, VariableType scopeWord)
        {
            cmb.Items.Clear();
            VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
            cmb.BeginUpdate();

            foreach (IVariable var in vars)
            {
                if (this.EpiInterpreter.Context.DataSet.Tables["output"].Columns.Contains(var.Name))
                {
                    Type type = this.EpiInterpreter.Context.DataSet.Tables["output"].Columns[var.Name].DataType;

                    switch (Type.GetTypeCode(type))
                    {
                        case TypeCode.Boolean:
                        case TypeCode.Byte:
                        case TypeCode.SByte:
                        case TypeCode.UInt16:
                        case TypeCode.UInt32:
                        case TypeCode.UInt64:
                        case TypeCode.Int16:
                        case TypeCode.Int32:
                        case TypeCode.Int64:
                        case TypeCode.Decimal:
                        case TypeCode.Double:
                        case TypeCode.Single:
                            cmb.Items.Add(var.Name.ToString());
                            break;
                    }
                }
            }

            cmb.EndUpdate();
            cmb.Sorted = true;
            cmb.Refresh();
        }
 private void LoadAlmCustomFieldFailed(string ErrorMessage, ComboBox AlmCustomField, string CustomFieldLabel)
 {
     AlmLoginGroup.Invoke(new MethodInvoker(delegate
     {
         LogMessage("FAILED loading " + CustomFieldLabel + "s.");
         LogMessage(ErrorMessage);
         AlmCustomField.Items.Clear();
         AlmCustomField.Refresh();
     }));
 }
Ejemplo n.º 38
0
        private void txtCount_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                if (e.KeyChar == 8)
                {
                    return;
                }
                if (e.KeyChar < 48 || e.KeyChar > 57)
                {
                    e.Handled = true;
                    return;
                }
            }
            else
            {
                int dCount = 0;
                int LastIg = int.Parse(this.txtIgCur.Text.Trim());
                if (txtCount.Text.Trim() == "")
                {
                    MessageBox.Show("数量不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    dCount = int.Parse(txtCount.Text.Trim());
                }

                int dIgPay = 0;
                if (txtIgPay.Text.Trim() == "")
                {
                    MessageBox.Show("需要的积分不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    dIgPay = int.Parse(txtIgPay.Text.Trim());
                }

                if (txtGoodsID.Text.Trim() == "")
                {
                    MessageBox.Show("商品信息有误,请重新选择商品!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    txtGoodsID.Text = "";
                    cmbGoodsName.Items.Clear();
                    cmbGoodsName.Refresh();
                    txtIgPay.Text = "";
                    txtCount.Text = "";
                }
                if ((int.Parse(txtTolCharge.Text.Trim()) + dIgPay) > LastIg)
                {
                    MessageBox.Show("所剩积分不能再兑换此商品!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                CMSMData.CMSMStruct.GoodsStruct gs = new CMSMData.CMSMStruct.GoodsStruct();
                err = null;
                gs  = cs.GetGoodsByID(txtGoodsID.Text.Trim(), out err);
                if (gs != null)
                {
                    txtGoodsID.Text   = gs.strGoodsID;
                    cmbGoodsName.Text = gs.strGoodsName;
                    bool sumflag = false;
                    for (int i = 0; i < dtIgItem.Rows.Count; i++)
                    {
                        if (gs.strGoodsID == dtIgItem.Rows[i]["GoodsID"].ToString())
                        {
                            dtIgItem.Rows[i]["Count"] = (int.Parse(dtIgItem.Rows[i]["Count"].ToString()) + dCount).ToString();
                            dtIgItem.Rows[i]["IgPay"] = (int.Parse(dtIgItem.Rows[i]["IgPay"].ToString()) + (dIgPay * dCount)).ToString();
                            sumflag = true;
                            break;
                        }
                    }
                    if (!sumflag)
                    {
                        DataRow dr = dtIgItem.NewRow();
                        dr[0] = gs.strGoodsID;
                        dr[1] = gs.strGoodsName;
                        dr[2] = dIgPay.ToString();
                        dr[3] = dCount.ToString();
                        dr[4] = (dIgPay * dCount).ToString();
                        dtIgItem.Rows.Add(dr);
                    }
                    this.DgBind();
                    txtCount.Focus();
                }
                else
                {
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                    MessageBox.Show("无此商品信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
            }
        }
Ejemplo n.º 39
0
        private void WelcomeForm_Load(object sender, System.EventArgs e)
        {
            Language.LoadControlNames(this);

            this.BringToFront();

            langSel.Items.AddRange(Language.GetPackNames());
            langSel.SelectedItem = Language.Current;

            showAtStart.Checked = Config.GetAppSetting <int>("ShowWelcome") == 1;

            uoClient.Text = Config.GetAppSetting <string>("UOClient");
            dataDir.Text  = Config.GetAppSetting <string>("UODataDir");

            IsValidClientAndDataDir();

            patchEncy.Checked = Config.GetAppSetting <int>("PatchEncy") != 0;

            LoginCFG_SE lse = new LoginCFG_SE();
            Custom_SE   cse;

            serverList.BeginUpdate();

            AddUORServers();

            // Load any custom servers they might have added
            NameValueCollection servers =
                (NameValueCollection)ConfigurationManager.GetSection("Servers");

            foreach (string server in servers.AllKeys)
            {
                string[] serverHostAndPort = servers[server].Split(',');
                string   serverHost        = serverHostAndPort[0];
                string   serverPort        = serverHostAndPort[1];

                serverList.Items.Add(new Custom_SE(server, serverHost, Convert.ToInt32(serverPort)));
            }

            serverList.EndUpdate();
            serverList.Refresh();

            // Set it to the last used one, or just set it to default UOR Prod
            try
            {
                serverList.SelectedIndex = Config.GetAppSetting <int>("LastServerId");
            }
            catch
            {
                serverList.SelectedIndex = 0;
            }

            WindowState = FormWindowState.Normal;
            this.BringToFront();
            this.TopMost = true;

            _ShowTimer          = new System.Windows.Forms.Timer();
            _ShowTimer.Interval = 250;
            _ShowTimer.Enabled  = true;
            _ShowTimer.Tick    += new EventHandler(timer_Tick);


            if (Config.GetAppSetting <bool>("ImportProfilesAndMacros"))
            {
                string appDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Razor");

                if (Directory.Exists(appDataDir))
                {
                    if (MessageBox.Show(Language.GetString(LocString.ImportFromPrevious), "Import Razor Profiles and Macros",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Config.ImportProfilesMacros(appDataDir);

                        MessageBox.Show("Import complete", "Import Razor Profiles and Macros", MessageBoxButtons.OK);
                    }
                }

                Config.SetAppSetting("ImportProfilesAndMacros", "false");
            }
        }
Ejemplo n.º 40
0
        public void llenarComboBox(ComboBox cBox, SqlCommand sp, string nombreCampo)
        {
            cBox.Items.Clear();
            try
            {
                using (SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString))
                {
                    sp.Connection.Open();
                    SqlDataReader rdr = sp.ExecuteReader();
                    while (rdr.Read())
                    {
                        cBox.Items.Add(rdr[nombreCampo].ToString());
                    }
                    sp.Connection.Close();
                }

                cBox.Refresh();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }