void rotation_Load(object sender, EventArgs e) { result["result"] = "FAIL"; var jsonconfig = GetFullPath("config.json"); if (!File.Exists(jsonconfig)) { MessageBox.Show("config.json not founded"); Exit(); } dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig)); isRotationSupport = (bool)jobject.RotationSupport; IsAutoModeRotation = (bool)jobject.IsAutoModeRotation; MinAxisX = (double)jobject.MinAxisX; MinAxisY = (double)jobject.MinAxisY; MinAxisZ = (double)jobject.MinAxisZ; MaxAxisX = (double)jobject.MaxAxisX; MaxAxisY = (double)jobject.MaxAxisY; MaxAxisZ = (double)jobject.MaxAxisZ; ShowWindow = (bool)jobject.ShowWindow; if (ShowWindow) { this.Opacity = 100; this.ShowInTaskbar = true; } if (IsDebugMode) { Trace.WriteLine("Rotation_Load"); } if (isRotationSupport && isSensorHubExist) { if (isNotGraphicsDriverSupport && HotTabWMIInformation.IsWindows8or10) { TimerRotationWin8.Start(); } else { groupBoxRotationMode.Visible = true; TimerRotation.Start(); AccelerometerStableCount = 0; } } else { checkTestStatus("Not support Rotation Item."); } if (!IsAutoModeRotation) { Microsoft.Win32.SystemEvents.DisplaySettingsChanged += new EventHandler(DisplaySettingsChanged); IsRotationLocked(false); } DisplaySettingsChangedEvent(); }
void checkTestStatus(String testResult) { if (!IsAutoModeRotation) { IsRotationLocked(true); } // if (TimerRotationWin8.Enabled) TimerRotationWin8.Stop(); // if (TimerRotation.Enabled) TimerRotation.Stop(); buttonPASS.Enabled = false; buttonFAIL.Enabled = false; if (testResult.Equals("PASS")) { labelResult.Text = "PASS"; labelResult.ForeColor = Color.Green; result["result"] = "PASS"; result["EIPLog"] = new JObject { { "Rotation", "PASS" }, { "Rotation_Info", "PASS" } }; } else { labelResult.Text = "FAIL"; labelResult.ForeColor = Color.Red; result["result"] = "FAIL"; result["EIPLog"] = new JObject { { "Rotation", "FAIL" }, { "Rotation_Info", testResult } }; } File.WriteAllText(GetFullPath("result.json"), result.ToString()); Thread.Sleep(200); File.Create(GetFullPath("completed")); if (!ShowWindow) { Exit(); } }