public SettingsWindow(Window window, string vmName, string startUpTab, bool isEcoModeEnabled)
        {
            this.mIsEcoModeEnabled = isEcoModeEnabled;
            this.vmNameWithSuffix  = vmName;
            this.VmName            = this.vmNameWithSuffix;
            this.ParentWindow      = window;
            this.SettingsControlNameList.Add("STRING_ENGINE_SETTING");
            this.SettingsControlNameList.Add("STRING_DISPLAY_SETTINGS");
            this.OEM = InstalledOem.GetOemFromVmnameWithSuffix(this.vmNameWithSuffix);
            string oldValue = this.OEM.Equals("bgp", StringComparison.InvariantCultureIgnoreCase) ? "" : "_" + this.OEM;

            if (!string.IsNullOrEmpty(oldValue))
            {
                this.VmName = this.vmNameWithSuffix?.Replace(oldValue, "");
            }
            this.Loaded += (RoutedEventHandler)((sender, e) => this.SettingsWindow_Loaded(sender, e));
            if (!string.IsNullOrEmpty(startUpTab))
            {
                this.StartUpTab = startUpTab;
            }
            this.CreateAllButtons(this.StartUpTab);
            UserControl control = this.GetUserControl(this.StartUpTab) ?? this.GetUserControl("STRING_ENGINE_SETTING");

            this.AddControlInGridAndDict(this.StartUpTab, control);
            this.BringToFront(control);
        }
Пример #2
0
        public CreateNewInstanceViewModel(
            NewInstanceType instanceType,
            AppPlayerModel appPlayerModel = null,
            string cloneFromVm            = null,
            string oem = "",
            string abi = null,
            bool isAndroidDownloaded = true)
        {
            this.InstanceType = instanceType;
            this.SetAppPlayerModel(appPlayerModel);
            this.OEM = oem;
            this.IsAndroidDownloaded = isAndroidDownloaded;
            string oldValue = string.Empty;

            this.CpuCorePerformanceWidth    = 320;
            this.CpuCoreCustomVisibility    = false;
            this.PerformanceRamComboWidth   = 320;
            this.CustomRamTextBoxVisibility = false;
            if (cloneFromVm != null)
            {
                this.OEM = InstalledOem.GetOemFromVmnameWithSuffix(cloneFromVm);
                oldValue = this.OEM.Equals("bgp", StringComparison.InvariantCultureIgnoreCase) ? "" : "_" + this.OEM;
                if (!string.IsNullOrEmpty(oldValue))
                {
                    cloneFromVm = cloneFromVm.Replace(oldValue, "");
                }
            }
            if (string.IsNullOrEmpty(this.OEM))
            {
                this.OEM = "bgp";
            }
            if (this.InstanceType == NewInstanceType.Clone && !RegistryManager.RegistryManagers[this.OEM].Guest.ContainsKey(cloneFromVm))
            {
                cloneFromVm = "Android";
            }
            this.InitCPUInfo();
            this.InitRAMInfo();
            this.BuildCPUCombinationList();
            this.BuildRAMCombinationList();
            this.BuildResolutionsList();
            this.BuildInstanceCountList();
            this.BuildCloneFromInstanceList();
            this.ResolutionType = this.ResolutionsList.First <ResolutionModel>((Func <ResolutionModel, bool>)(x => x.OrientationType == OrientationType.Landscape));
            this.InstanceCount  = 1;
            if (this.InstanceType == NewInstanceType.Clone)
            {
                this.CloneFromInstanceVmName = cloneFromVm + oldValue;
            }
            else
            {
                this.InitABISettings("Android", abi);
            }
            this.MaxResolutionWidth               = Math.Max(this.MaxResolutionWidth, Screen.PrimaryScreen.Bounds.Width);
            this.MaxResolutionHeight              = Math.Max(this.MaxResolutionHeight, Screen.PrimaryScreen.Bounds.Height);
            this.CloseWindowCommand               = (ICommand) new RelayCommand(new System.Action(this.CloseCreateNewInstanceWindow), false);
            this.ABIHelpSupportCommand            = (ICommand) new RelayCommand(new System.Action(this.ABIHelpSupport), false);
            this.CreateInstanceButtonClickCommand = (ICommand) new RelayCommand(new System.Action(this.CreateInstanceButtonClick), false);
        }