public void BuyPlatform() { if (Platform >= PlatformNames.Length - 1) { return; } if (!_wallet.MaySubsctact(NextPlatform.Cost)) { MessageBox.Show($"Не хватает денег!", "Обломинго!", MessageBoxButton.OK, MessageBoxImage.Information); return; } _wallet.Substract(NextPlatform.Cost); Platform++; _score.Add(1); }
public async Task BuyOsAsync() { if (Os >= OsNames.Length - 1) { return; } if (!_wallet.MaySubsctact(NextOs.Cost)) { MessageBox.Show($"Не хватает денег!", "Обломинго!", MessageBoxButton.OK, MessageBoxImage.Information); return; } bool needs = false; StringBuilder sb = new StringBuilder(); if (Os >= _infoComputer.GetLevel(Components.Platform)) { needs = AppendTextToNeeds(sb, "более мощная платформа"); } if (Os >= _infoComputer.GetLevel(Components.Ram) + 1 || _infoComputer.GetLevel(Components.Ram) <= 0) { needs = AppendTextToNeeds(sb, "более мощная оперативная память"); } if (Os >= _infoComputer.GetLevel(Components.Hdd) + 1 || _infoComputer.GetLevel(Components.Hdd) <= 0) { needs = AppendTextToNeeds(sb, "более мощный жесткий диск"); } if (Os >= _infoComputer.GetLevel(Components.Video) + 2 || _infoComputer.GetLevel(Components.Video) <= 0) { needs = AppendTextToNeeds(sb, "более мощная видеокарта"); } if (needs) { MessageBox.Show($"Для установки ОС {NextOs.Name} взамен {OsName} требуется:\n" + sb.ToString(), "Апгрейд недоступен", MessageBoxButton.OK, MessageBoxImage.Information); return; } _wallet.Substract(NextOs.Cost); await Task.Run(InstallProgramm()); InstallProgress = 0; Changed(nameof(InstallProgress)); Os++; _score.Add(1); }
public async Task DoUploadAsync() { await Task.Run(LoadProcess()); LoadProgress = 0; Changed(nameof(LoadProgress)); Upload += 1; _score.Add(1); Rating++; _mayUpload = false; }