示例#1
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //TODO: add basic and advanced combination on option flag
            c.BasicCPU       = txtBasicCPU.Text;
            c.BasicRAM       = txtBasicRAM.Text;
            c.BasicHDD       = txtBasicHDD.Text;
            c.BasicOS        = txtBasicOS.Text;
            c.CPUType        = txtCPUType.Text;
            c.RAMCapacity    = txtRAMCapacity.Text;
            c.RAMType        = txtRAMType.Text;
            c.HDDSize        = txtHDDSize.Text;
            c.CPUSpeed       = txtCPUSpeed.Text;
            c.CPUCores       = txtCPUCores.Text;
            c.CPUThreads     = txtCPUThreads.Text;
            c.HDDQuantity    = txtHDDQuantity.Text;
            c.HDDSpeed       = txtHDDSpeed.Text;
            c.GFX            = txtGFX.Text;
            c.ScreenSize     = txtScreenSize.Text;
            c.ScreenRes      = txtScreenRes.Text;
            c.ScreenType     = txtScreenType.Text;
            c.Battery        = txtBattery.Text;
            c.OSVersion      = txtOSVersion.Text;
            c.Webcam         = txtWebcam.Text;
            c.OtherDrives    = txtOtherDrives.Text;
            c.Nics           = txtNics.Text;
            c.ItemTitle      = txtItemTitle.Text;
            c.ItemLongDescP1 = txtItemLongDescP1.Text;
            c.ItemLongDescP2 = txtItemLongDescP2.Text;
            c.HDDInterface   = txtHDDInterface.Text;

            if (string.IsNullOrWhiteSpace(path))
            {
                path = AppService.ShowSaveDialog(opts, "txt", "computer");
            }

            if (!string.IsNullOrWhiteSpace(path))
            {
                FileIoService.SaveObjectToFile(c, path);
                AppService.RefreshItem(c, path);
                AppService.RefreshMainWindowOptions();
                AppService.LogLine($"Saved item to \"{path}\"");
                this.Close();
            }
        }
示例#2
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            part.ItemTitle      = txtItemTitle.Text;
            part.ItemLongDescP1 = txtItemLongDescP1.Text;
            part.ItemLongDescP2 = txtItemLongDescP2.Text;

            if (string.IsNullOrWhiteSpace(path))
            {
                path = AppService.ShowSaveDialog(opts, "txt", "part");
            }
            else
            {
                FileIoService.SaveObjectToFile(part, path);
                AppService.RefreshItem(part, path);
                AppService.RefreshMainWindowOptions();
                AppService.LogLine($"Saved item to \"{path}\"");
                this.Close();
            }
        }
示例#3
0
        /// <summary>
        /// saves current item in its present state to its present path and unloads from memory
        /// </summary>
        private void UnloadItem()
        {
            if (itemLoaded)
            {
                FileIoService.SaveObjectToFile(currentItem, lblActiveItem.Content.ToString());
                currentItem       = null;
                itemLoaded        = false;
                btnEdit.IsEnabled = false;
                btnOpenItemDirectory.IsEnabled = false;
                cboItemType.IsEnabled          = true;
                lblActiveItem.Content          = "None";
                btnUnload.IsEnabled            = false;

                CheckCanGenerate();
                UnloadGeneratedOutput();

                LogLine("Closed item");
            }
        }
示例#4
0
 public static void SaveProgramOptions(ProgramOptions opts)
 {
     FileIoService.SaveObjectToFile(opts, GlobalConstants.OptionsFilePath);
 }