public void Init() { this.Visibility = Visibility.Hidden; this.IsVisibleChanged += new DependencyPropertyChangedEventHandler(this.DeviceProfileControl_IsVisibleChanged); this.mManufacturerTextBox.TextChanged += new TextChangedEventHandler(this.MManufacturerTextBox_TextChanged); this.mModelNumberTextBox.TextChanged += new TextChangedEventHandler(this.MManufacturerTextBox_TextChanged); this.mBrandTextBox.TextChanged += new TextChangedEventHandler(this.MManufacturerTextBox_TextChanged); if (PromotionObject.Instance.IsRootAccessEnabled || FeatureManager.Instance.IsCustomUIForNCSoft) { this.mRootAccessGrid.Visibility = Visibility.Visible; this.mCurrentRootAccessStatus = DeviceProfileControl.GetRootAccessStatusFromAndroid(this.ParentWindow?.mVmName); this.mEnableRootAccessCheckBox.IsChecked = new bool?(this.mCurrentRootAccessStatus); } this.mScrollBar.ScrollChanged += new ScrollChangedEventHandler(BluestacksUIColor.ScrollBarScrollChanged); this.mGettingProfilesFromCloud = false; }
private void SendDeviceProfileChangeToGuest(string json, JObject changedDeviceProfileObject) { if (!Utils.CheckIfDeviceProfileChanged(this.mCurrentDeviceProfileObject, changedDeviceProfileObject)) { return; } string command = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)"changeDeviceProfile", (object)json); Logger.Info("Command for device profile change: " + command); new Thread((ThreadStart)(() => { try { string a = VmCmdHandler.RunCommand(command, this.ParentWindow.mVmName, "bgp"); Logger.Info("Result for device profile change command: " + a); if (string.Equals(a, "ok", StringComparison.InvariantCulture)) { this.AddToastPopup(LocaleStrings.GetLocalizedString("STRING_CHANGES_SAVED", "")); DeviceProfileControl.SendStatsOfDeviceProfileChangeAsync("success", changedDeviceProfileObject, this.mCurrentDeviceProfileObject); this.mCurrentDeviceProfileObject = changedDeviceProfileObject; Utils.UpdateValueInBootParams("pcode", changedDeviceProfileObject["pcode"].ToString(), this.ParentWindow.mVmName, false, "bgp"); Utils.UpdateValueInBootParams("caSelector", changedDeviceProfileObject["caSelector"].ToString(), this.ParentWindow.mVmName, false, "bgp"); if (SecurityMetrics.SecurityMetricsInstanceList.ContainsKey(this.ParentWindow.mVmName)) { SecurityMetrics.SecurityMetricsInstanceList[this.ParentWindow.mVmName].AddSecurityBreach(SecurityBreach.DEVICE_PROFILE_CHANGED, string.Empty); } } else { this.AddToastPopup(LocaleStrings.GetLocalizedString("STRING_SWITCH_PROFILE_FAILED", "")); DeviceProfileControl.SendStatsOfDeviceProfileChangeAsync("failed", changedDeviceProfileObject, this.mCurrentDeviceProfileObject); } this.Dispatcher.Invoke((Delegate)(() => this.SetUIAccordingToCurrentDeviceProfile())); } catch (Exception ex) { Logger.Error("Exception in change to predefined Pcode call to android: " + ex.ToString()); } })) { IsBackground = true }.Start(); }