Пример #1
0
 public void InitResolutionDDL(System.Windows.Forms.ComboBox _Combobox)
 {
     _Combobox.Items.Clear();
     _Combobox.Items.AddRange(StaticValues.Resolutions.ToArray());
     _Combobox.SelectedItem = Resolution;
     //_Combobox.SelectedIndexChanged += (object sender, EventArgs e) =>
     //{
     //    Resolution = (string)_Combobox.SelectedItem;
     //};
     ConfigValuesChanged += (string _ConfigName, string _ConfigValue) =>
     {
         if (_ConfigName == "gxResolution")
         {
             if (StaticValues.Resolutions.Contains(_ConfigValue) == false)
             {
                 StaticValues.Resolutions.Add(_ConfigValue);
             }
             _Combobox.BeginInvoke(new Action(() =>
             {
                 if (_Combobox.Items.Contains(_ConfigValue) == false)
                 {
                     _Combobox.Items.Add(_ConfigValue);
                 }
                 _Combobox.SelectedItem = _ConfigValue;
             }));
         }
     };
 }
Пример #2
0
        public void InitScriptMemoryDDL(System.Windows.Forms.ComboBox _Combobox)
        {
            int    currValue    = ScriptMemory;
            string currValueStr = (currValue / 1024).ToString() + "MB";

            if (StaticValues.ScriptMemorys.ContainsValue(currValue) == false)
            {
                StaticValues.ScriptMemorys.AddOrSet(currValueStr, currValue);
            }
            else
            {
                currValueStr = StaticValues.ScriptMemorys.First((_Value) => _Value.Value == currValue).Key;
            }
            _Combobox.Items.Clear();
            _Combobox.Items.AddRange(StaticValues.ScriptMemorys.Keys.ToArray());
            _Combobox.SelectedItem = currValueStr;
            //_Combobox.SelectedIndexChanged += (object sender, EventArgs e) =>
            //{
            //    ScriptMemory = StaticValues.ScriptMemorys[(string)_Combobox.SelectedItem];
            //};
            ConfigValuesChanged += (string _ConfigName, string _ConfigValue) =>
            {
                if (_ConfigName == "scriptMemory")
                {
                    int    newValue    = int.Parse(_ConfigValue);
                    string newValueStr = (newValue / 1024).ToString() + "MB";
                    if (StaticValues.ScriptMemorys.ContainsValue(newValue) == false)
                    {
                        StaticValues.ScriptMemorys.AddOrSet(newValueStr, newValue);
                    }
                    else
                    {
                        newValueStr = StaticValues.ScriptMemorys.First((_Value) => _Value.Value == newValue).Key;
                    }
                    _Combobox.BeginInvoke(new Action(() =>
                    {
                        if (_Combobox.Items.Contains(newValueStr) == false)
                        {
                            _Combobox.Items.Add(newValueStr);
                        }
                        _Combobox.SelectedItem = newValueStr;
                    }));
                }
            };
        }