protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { SettingParam setting = item as SettingParam; Type type = setting.Type; SettingListItem container = element as SettingListItem; if (type.Equals(typeof(UInt32))) { container.Style = App.Current.Resources["settingListItem_UInt32"] as Style; } else if (type.Equals(typeof(Double))) { container.Style = App.Current.Resources["settingListItem_Double"] as Style; } else if (type.Equals(typeof(Boolean))) { container.Style = App.Current.Resources["settingListItem_Boolean"] as Style; } else if (type.Equals(typeof(Windows.UI.Xaml.Media.Brush))) { container.Style = App.Current.Resources["settingListItem_Brush"] as Style; } else if (type.GetTypeInfo().IsEnum) { container.Style = App.Current.Resources["settingListItem_Enum"] as Style; } else if (type.Equals(typeof(Object.Threshold))) { container.Style = App.Current.Resources["settingListItem_Threshold"] as Style; } base.PrepareContainerForItemOverride(element, item); }
public RunningEnv(MainForm mainForm) { CheckData = new CheckParam(); CheckingData = new CheckingParam(); LibraryData = new LibraryParam(); SettingData = new SettingParam(); UIContext = mainForm; EnvTimestamp = new DateTime(); }
/// <summary> /// 編集用Dictionary の作成 /// </summary> /// <typeparam name="U"></typeparam> /// <returns></returns> public bool CreateDictionary <U>() where U : struct { System.Array enumArray = System.Enum.GetValues(typeof(U)); int objectCount = enumArray.Length; this.editParamDic.Clear(); // 保存されている配列のリスト化 List <SettingParam> serializedList = new List <SettingParam>(this.serializedParams); bool changed = false; // シリアライズデータからEDITOR 用のテーブルを作成 for (int i = 0; i < serializedList.Count; ++i) { SettingParam p = serializedList[i]; // 既に値が存在するかチェック bool find = false; for (int j = 0; j < objectCount; ++j) { if (p.key == enumArray.GetValue(j).ToString()) { find = true; break; } } // 存在しない、または重複しているなら削除 if (!find || this.editParamDic.ContainsKey(p.key)) { serializedList.Remove(p); --i; changed = true; continue; } this.editParamDic.Add(p.key, p); } for (int i = 0; i < objectCount; ++i) { string key = enumArray.GetValue(i).ToString(); // 不足分の項目を作成 if (!this.editParamDic.ContainsKey(key)) { SettingParam param = new SettingParam(key, null, 1); this.editParamDic.Add(key, param); changed = true; } } // 削除対応したものを更新 this.serializedParams = serializedList.ToArray(); return(changed); }
public static SettingParam SetParam(string name, Vector3 v3) { SettingParam sp = instance.GetSettingParam(name, paramType.Vector3); if (sp.type != paramType.Vector3) { Debug.Log(sp.name + " is " + sp.type + "!!"); return(sp); } sp.val = v3; return(sp); }
public static SettingParam SetParam(string name, string s) { SettingParam sp = instance.GetSettingParam(name, paramType.String); if (sp.type != paramType.String) { Debug.LogError(sp.name + " is " + sp.type + "!!"); return(sp); } sp.val = s; return(sp); }
private void SetDefaultParam(SettingParam pr = null) { if (pr == null) { pr = AppManager.GetDefaultSetting(); } currentSetting = pr; txtVoltAlarm.Text = "" + pr.VoltAlarmValue; txtIonAlarm.Text = "" + pr.IonAlarmValue; txtUpVal.Text = "" + pr.UpVal; txtLowVal.Text = "" + pr.LowVal; txtDecayTime.Text = "" + pr.DecayTimeCheck; txtDecayStopTime.Text = "" + pr.StopDecayTime; txtIonCheck.Text = "" + pr.IonBalanceCheck; txtIonStopTimeCheck.Text = "" + pr.IonStopTimeCheck; chkAutoTime.Checked = pr.IsAuto; if (!string.IsNullOrEmpty(pr.AutoCheckTimes)) { var times = pr.AutoCheckTimes.Split(',').OrderBy(i => i); dg.Rows.Clear(); foreach (string tm in times) { dg.Rows.Add(); dg[colTime.Index, dg.Rows.Count - 1].Value = tm; dg[colNo.Index, dg.Rows.Count - 1].Value = dg.Rows.Count; } } if (!string.IsNullOrEmpty(pr.AutoCheckDays)) { var days = pr.AutoCheckDays.Split(','); List <DayOfWeek> lstDays = new List <DayOfWeek>(); foreach (string item in days) { DayOfWeek d = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), item); lstDays.Add(d); } chkMon.Checked = lstDays.Contains(DayOfWeek.Monday); chkTue.Checked = lstDays.Contains(DayOfWeek.Tuesday); chkWed.Checked = lstDays.Contains(DayOfWeek.Wednesday); chkThu.Checked = lstDays.Contains(DayOfWeek.Thursday); chkFri.Checked = lstDays.Contains(DayOfWeek.Friday); chkSat.Checked = lstDays.Contains(DayOfWeek.Saturday); chkSun.Checked = lstDays.Contains(DayOfWeek.Sunday); } txtVoltAlarm.Focus(); }
SettingParam GetSettingParam(string name, paramType type) { foreach (SettingParam sp in settingParams) { if (sp.name == name) { return(sp); } } SettingParam param = new SettingParam(name, type); settingParams.Add(param); //paramSize = settingParams.Count; return(param); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); SettingParam pr = null; if (this.Params != null) { pr = this.Params as SettingParam; txtUpVal.Text = "" + pr.UpVal; txtLowVal.Text = "" + pr.LowVal; txtDecayTime.Text = "" + pr.DecayTimeCheck; txtStopTime.Text = "" + pr.StopDecayTime; txtIonBalanceCheck.Text = "" + pr.IonBalanceCheck; txtStopIonBlance.Text = "" + pr.IonStopTimeCheck; } }
protected override void OnLoad(EventArgs e) { var blockid = (int)this.Params; currentBlock = AppManager.ListBlock.FirstOrDefault(b => b.BlockId == blockid); SettingParam prDefault = null; if (!string.IsNullOrEmpty(currentBlock.DefaultParams)) { prDefault = Newtonsoft.Json.JsonConvert.DeserializeObject <SettingParam>(currentBlock.DefaultParams); } SetDefaultParam(prDefault); //SetLanguageControl(); base.OnLoad(e); }
/// <summary> /// シリアライズデータの更新 /// </summary> /// <typeparam name="U"></typeparam> public void UpdateSerializedList <U>() where U : struct { System.Array enumArray = System.Enum.GetValues(typeof(U)); int objectCount = enumArray.Length; this.serializedParams = new SettingParam[objectCount]; for (int i = 0; i < objectCount; ++i) { string key = enumArray.GetValue(i).ToString(); SettingParam param = null; if (!this.editParamDic.TryGetValue(key, out param)) { param = new AssetCatalog.SettingParam(key, null, 1); } this.serializedParams[i] = param; } }
public static SettingParam GetDefaultSetting() { var pr = new SettingParam() { VoltAlarmValue = int.Parse(ConfigurationManager.AppSettings["VoltAlarm"]), IonAlarmValue = int.Parse(ConfigurationManager.AppSettings["IonAlarm"]), UpVal = int.Parse(ConfigurationManager.AppSettings["UpVal"]), LowVal = int.Parse(ConfigurationManager.AppSettings["LowVal"]), DecayTimeCheck = int.Parse(ConfigurationManager.AppSettings["DecayTimeCheck"]), StopDecayTime = int.Parse(ConfigurationManager.AppSettings["StopDecayTime"]), IonBalanceCheck = int.Parse(ConfigurationManager.AppSettings["IonValueCheck"]), IonStopTimeCheck = int.Parse(ConfigurationManager.AppSettings["IonTimeCheck"]), AutoCheckTimes = ConfigurationManager.AppSettings["AutoCheckTimes"], AutoCheckDays = ConfigurationManager.AppSettings["AutoCheckDays"], IsAuto = ConfigurationManager.AppSettings["IsAuto"] == "1" ? true : false }; return(pr); }
private IEnumerator ApplyChange() { bool fullscreen = sp.fullScreen; int maxResIdx = Screen.resolutions.Length - 1; int maxWidth = Screen.resolutions[maxResIdx].width; int maxHeight = Screen.resolutions[maxResIdx].height; if (sp.width >= maxWidth && sp.height >= maxHeight) { fullscreen = true; } Screen.SetResolution(sp.width, sp.height, fullscreen); PlayerPrefs.SetInt("BfScreenWidth", sp.width); PlayerPrefs.SetInt("BfScreenHeight", sp.height); PlayerPrefs.SetInt("BfFullScreen", sp.fullScreen ? 1 : 0); yield return((object)null); QualitySettings.SetQualityLevel(sp.qualityLevel); PlayerPrefs.SetInt("BfQualityLevel", QualitySettings.GetQualityLevel()); sp = null; }
public static void AddParam(string name) { SettingParam sp = new SettingParam(name, paramType.Bool); instance.settingParams.Add(sp); }
SettingParam GetSettingParam(string name, paramType type) { foreach(SettingParam sp in settingParams){ if(sp.name == name) return sp; } SettingParam param = new SettingParam(name,type); settingParams.Add(param); //paramSize = settingParams.Count; return param; }
private void btnCharge_Click(object sender, EventArgs e) { if (_sensor == null) { return; } var frmMain = this.ParentForm as MainForm; if (frmMain != null) { if (frmMain.isDecayRuning) { frmMain.ShowMsg(MessageBoxIcon.Warning, "Has one device is running. Please waiting!"); return; } } else { return; } SettingParam pr = new SettingParam() { UpVal = _sensor.DecayUpperValue, LowVal = _sensor.DecayLowerValue, DecayTimeCheck = _sensor.DecayTimeCheck, StopDecayTime = _sensor.DecayStopTime, IonBalanceCheck = _sensor.IonValueCheck, IonStopTimeCheck = _sensor.IonTimeCheck }; var dlgResult = AppManager.ShowDialog <ChargingConfirmPopup>(pr); if (dlgResult == null) { return; } // Reset timer tmPos.Stop(); tmNeg.Stop(); counterPos = 0; counterNeg = 0; endtimePos = DateTime.Now.AddSeconds(_sensor.DecayStopTime); SetDecayLabel("0", lbDecayPositive); SetDecayLabel("0", lbDecayNegative); SetDecayLabel("0", lbIonCheck); if (_sensor.PositivePoint == null) { _sensor.PositivePoint = new System.Collections.Generic.List <int>(); } if (_sensor.NegativePoint == null) { _sensor.NegativePoint = new System.Collections.Generic.List <int>(); } _sensor.PositivePoint.Clear(); _sensor.NegativePoint.Clear(); _sensor.GraphData?.Samples?.Clear(); _sensor.Alarm = false; SensorInfo sensorDB = AppManager.ListSensor.Find(i => i.SensorId == _sensor.SensorId); if (sensorDB != null) { sensorDB.PositivePoint.Clear(); sensorDB.NegativePoint.Clear(); sensorDB.GraphData?.Samples?.Clear(); } // Charge if (frmMain != null && _sensor != null) { frmMain.Charge(_sensor.SensorId, MeasureState.Positive, false); } }
public override bool DoDialog() { RefreshTabNames(); newInputDelta += Time.deltaTime; bool result = false; CheckNewKey(); GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); Vector2 pos = new Vector2(size.x / 2f, 15f); LabelUtil.TextOut(pos, StringMgr.Instance.Get("CHANGE_SETTING"), "BigLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter); GUI.Box(crdOutline, string.Empty, "BoxPopLine"); GUI.enabled = !IsWaitingInput(); tab = GUI.SelectionGrid(crdTab, tab, mainTab, mainTab.Length, "popTab"); switch (tab) { case 0: DoGraphic(); break; case 1: DoSound(); break; case 2: DoInput(); break; case 3: DoMouse(); break; case 4: DoLocal(); break; case 5: DoEtc(); break; } if (GlobalVars.Instance.MyButton(crdOk, StringMgr.Instance.Get("OK"), "BtnAction")) { SaveInput(); GameObject gameObject = GameObject.Find("Main"); PlayerPrefs.SetInt("HideOurForcesNickname", hideOurForcesNickname ? 1 : 0); PlayerPrefs.SetInt("HideEnemyForcesNickname", hideEnemyForcesNickname ? 1 : 0); PlayingCameraChange(); PlayerPrefs.SetFloat("CameraSpeedFactor", cameraSpeedFactor); PlayerPrefs.SetInt("ReverseMouse", reverseMouse ? 1 : 0); PlayerPrefs.SetInt("SwitchLRBuild", switchLRBuild ? 1 : 0); PlayerPrefs.SetInt("ReverseMouseWheel", reverseMouseWheel ? 1 : 0); PlayerPrefs.SetFloat("SfxVolume", sfxVolume); PlayerPrefs.SetFloat("BgmVolume", bgmVolume); PlayerPrefs.SetInt("SfxMute", sfxMute ? 1 : 0); PlayerPrefs.SetInt("BgmMute", bgmMute ? 1 : 0); PlayerPrefs.SetInt("RadioSndMute", radioSndMute ? 1 : 0); PlayerPrefs.SetInt("UIScale", uiScale ? 1 : 0); GlobalVars.Instance.IsScaleUI = uiScale; GlobalVars.Instance.ReloadPlayerPrefs(); if (null != gameObject) { gameObject.BroadcastMessage("OnChangeAudioSource"); } GlobalVars.Instance.ChangeAudioSource(); SaveInviteMessage(); SaveWhisperMessage(); if (0 <= curRes && curRes < supportedResolutions.Length && (Screen.fullScreen != fullScreen || currentResolution.width != supportedResolutions[curRes].width || currentResolution.height != supportedResolutions[curRes].height || QualitySettings.GetQualityLevel() != currentQualityLevel) && null != gameObject) { Resolution resolution = supportedResolutions[curRes]; SettingParam settingParam = new SettingParam(); settingParam.width = resolution.width; settingParam.height = resolution.height; settingParam.fullScreen = fullScreen; settingParam.qualityLevel = currentQualityLevel; gameObject.SendMessage("OnSettingChange", settingParam); } result = true; } Rect rc = new Rect(size.x - 44f, 5f, 34f, 34f); if (GlobalVars.Instance.MyButton(rc, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed()) { result = true; } GUI.enabled = true; GUI.skin = skin; if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } return(result); }
private void SaveSensor(SettingParam pr = null) { var sensor = dgvDevice.GetSelectedData <SensorInfo>(); if (sensor == null) { return; } if (pr == null) { // User data sensor.SensorName = txtSensorName.Text.Trim(); sensor.Active = ckbActiveSensor.Checked ? clsConst.ACTIVE : clsConst.NOT_ACTIVE; sensor.MeasureType = int.Parse("" + cboMeasureType.SelectedValue); if (sensor.MeasureType == clsConst.MeasureMode_Volt || sensor.MeasureType == clsConst.MeasureMode_Ion) { sensor.Alarm_Value = ConvertHelper.CnvNullToInt(txtAlaimValue.Text.Trim()); } if (sensor.MeasureType == clsConst.MeasureMode_Decay) { sensor.DecayUpperValue = ConvertHelper.CnvNullToInt(txtUpVal.Text); sensor.DecayLowerValue = ConvertHelper.CnvNullToInt(txtLowVal.Text); sensor.DecayTimeCheck = ConvertHelper.CnvNullToInt(txtDecayTime.Text); sensor.DecayStopTime = ConvertHelper.CnvNullToInt(txtDecayStopTime.Text); sensor.IonValueCheck = ConvertHelper.CnvNullToInt(txtIonCheck.Text); sensor.IonTimeCheck = ConvertHelper.CnvNullToInt(txtIonStopTimeCheck.Text); } } else { // Default setting data sensor.SensorName = txtSensorName.Text.Trim(); sensor.Active = clsConst.ACTIVE; sensor.MeasureType = int.Parse("" + cboMeasureType.SelectedValue); if (sensor.MeasureType == clsConst.MeasureMode_Volt) { sensor.Alarm_Value = pr.VoltAlarmValue; } else if (sensor.MeasureType == clsConst.MeasureMode_Ion) { sensor.Alarm_Value = pr.IonAlarmValue; } if (sensor.MeasureType == clsConst.MeasureMode_Decay) { sensor.AutoCheckFlag = pr.IsAuto ? 1 : 0; sensor.DecayUpperValue = pr.UpVal; sensor.DecayLowerValue = pr.LowVal; sensor.DecayTimeCheck = pr.DecayTimeCheck; sensor.DecayStopTime = pr.StopDecayTime; sensor.IonValueCheck = pr.IonBalanceCheck; sensor.IonTimeCheck = pr.IonStopTimeCheck; } } if (!validateSensor(sensor)) { return; } var stOrdinalDisplay = sensor.Ordinal_Display; var enOrdinalDisplay = (int)cboOrdinalDisplay.SelectedValue; var flag = true; this.SetModeWaiting(); try { flag = stOrdinalDisplay > enOrdinalDisplay ? true : false; using (var objDB = AppManager.GetConnection()) { if (objDB.UpdateSensor(sensor, stOrdinalDisplay, enOrdinalDisplay, flag)) { ShowMsg(MessageBoxIcon.Information, LanguageHelper.GetValueOf("MSG_SAVE_SETTING_SUCCESS")); this.ListSensorChange.Add(sensor); lblSensorSetting.Text = (txtSensorName.Text.Trim() + " " + LanguageHelper.GetValueOf("MSG_SETTING")).Trim(); var lst = objDB.GetListSensor().Where(i => i.OfBlock == sensor.OfBlock).OrderBy(i => i.Ordinal_Display).ToList(); BindingDataList(lst); this.dgvDevice_CellClick(dgvDevice, new DataGridViewCellEventArgs(colDeviceName.Index, enOrdinalDisplay - 1)); //AppManager.OnSensorSettingChanged?.Invoke(sensor, null); } else { var lst = objDB.GetListSensor().Where(i => i.OfBlock == sensor.OfBlock).OrderBy(i => i.Ordinal_Display).ToList(); BindingDataList(lst); this.dgvDevice_CellClick(dgvDevice, new DataGridViewCellEventArgs(colDeviceName.Index, stOrdinalDisplay - 1)); ShowMsg(MessageBoxIcon.Error, LanguageHelper.GetValueOf("MSG_SAVE_SETTING_ERR")); } } } catch (Exception ex) { } finally { this.SetModeWaiting(false); } }
public static object GetParam(string name, paramType type) { SettingParam sp = instance.GetSettingParam(name, type); return(sp.val); }
private void OnSettingChange(SettingParam param) { sp = param; StartCoroutine(ApplyChange()); }