public PrettierDisplayViewModel(ITweetService tweetService, IViewAwareStatus viewAwareStatus) : base(tweetService) { viewAwareStatus.ViewLoaded += () => { MessageBoxService.ShowInformation("You loaded the pretty view!"); _isLoaded = true; // use common if you want to loosely couple from the logger type Logger.Default.Debug("Pretty loaded"); }; viewAwareStatus.ViewUnloaded += () => _isLoaded = false; TweetSearchTweets.CurrentChanged += (s, e) => { if (!_isLoaded) { return; } var current = TweetSearchTweets.CurrentItem as LinqTweet; if (current != null) { Process.Start(current.Link); } }; }
private void ExecuteShowCommand(object x) { // Microsoft.TeamFoundation.MVVM.ViewModelBaseのMessageBoxServiceプロパティに、 // MessageBoxに関するものが設定されている var r = MessageBoxService.Show("Yes or No", "title", System.Windows.MessageBoxButton.YesNo); if (r == System.Windows.MessageBoxResult.Yes) { MessageBoxService.ShowInformation("Yes", "info"); } else { MessageBoxService.ShowError("No", "error"); } }
private void ExecuteOpenCommand() { // WindowsFormウィンドウを開く // WindowsFormを直接Show()できないので、 // WPFのView(WindowsFormView)のWindowsFormsHostの中にWindowsFormを貼付 //var f = new WindowsFormView(); //f.Show(); WindowDisplayService.Show("WindowsForm", new WindowsFormViewModel()); // WPFウィンドウを開く WindowDisplayService.Show("WPF", new WPFProject.MainViewModel()); // クラスライブラリのメソッドを使ってメッセージボックスを表示 MessageBoxService.ShowInformation(DllProject.Class1.Say()); }
/// <summary> /// Execute BillCommand /// </summary> /// <param name="item">Selected item to be processed.</param> private void ExecuteBillCommand(Order item) { try { if (this.MessageBoxService.ShowYesNo( "Would you like to bill order \"" + item.Code + "\"?", CustomDialogIcons.Question) == CustomDialogResults.Yes) { KeyPadViewModel viewModel = new KeyPadViewModel("Cash"); bool?result = this.UIVisualizerService.ShowDialog("KeyPadPopup", viewModel); if (result.HasValue && result.Value) { item.Cash = Convert.ToInt64(viewModel.ReturnedValue); if (item.Change < 0) { MessageBoxService.ShowInformation( "Payment for order " + item.Code + " is not enough !!! Please pay greater amount! Thank you."); } else { (ModelManager as IOrderManager).BillOrder(GlobalObjects.SystemUser, item); //SelectedItem = this.Items[0]; } // refresh item list this.ExecuteRefreshCommand(); // refresh table list RefreshTablesCommand.Execute(null); } } } catch (Exception ex) { this.MessageBoxService.ShowError(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message); } }
private async void LoadingView_Load(object sender, EventArgs e) { var botMgr = new BotManager(_keys, _logger); progressBar.Maximum = _bots.Count; int i = 0; foreach (var bot in _bots) { i++; progressBar.Value = i; decimal percentage = ((decimal)i / _bots.Count) * 100; lblPercentage.Text = $"{(int)percentage} %"; if (_cancelled) { lblProgress.Text = "Operation has been cancelled."; progressBar.Enabled = false; btnCancel.Visible = false; btnClose.Visible = true; _mbs.ShowError("Operation cancelled!", ""); return; } if (_newSettings.IsEnabled.HasValue) { if (_newSettings.IsEnabled.Value) { await botMgr.Enable(bot.Id); } else { await botMgr.Disable(bot.Id); } } var updateData = new BotUpdateData(bot); if (_newSettings.ActiveSafetyOrdersCount.HasValue) { updateData.ActiveSafetyOrdersCount = _newSettings.ActiveSafetyOrdersCount.Value; } if (_newSettings.BaseOrderVolume.HasValue) { updateData.BaseOrderVolume = _newSettings.BaseOrderVolume.Value; } if (_newSettings.Cooldown.HasValue) { updateData.Cooldown = _newSettings.Cooldown.Value; } if (_newSettings.MartingaleStepCoefficient.HasValue) { updateData.MartingaleStepCoefficient = _newSettings.MartingaleStepCoefficient.Value; } if (_newSettings.MartingaleVolumeCoefficient.HasValue) { updateData.MartingaleVolumeCoefficient = _newSettings.MartingaleVolumeCoefficient.Value; } if (_newSettings.MaxSafetyOrders.HasValue) { updateData.MaxSafetyOrders = _newSettings.MaxSafetyOrders.Value; } if (!string.IsNullOrWhiteSpace(_newSettings.Name)) { updateData.Name = BotManager.GenerateNewName(_newSettings.Name, bot.Strategy.ToString(), bot.Pairs.Single()); } if (_newSettings.SafetyOrderStepPercentage.HasValue) { updateData.SafetyOrderStepPercentage = _newSettings.SafetyOrderStepPercentage.Value; } if (_newSettings.StartOrderType.HasValue) { updateData.StartOrderType = _newSettings.StartOrderType.Value; } if (_newSettings.SafetyOrderVolume.HasValue) { updateData.SafetyOrderVolume = _newSettings.SafetyOrderVolume.Value; } if (_newSettings.TakeProfit.HasValue) { updateData.TakeProfit = _newSettings.TakeProfit.Value; } if (_newSettings.TrailingDeviation.HasValue) { updateData.TrailingDeviation = _newSettings.TrailingDeviation.Value; } if (_newSettings.TrailingEnabled.HasValue) { updateData.TrailingEnabled = _newSettings.TrailingEnabled.Value; } if (_newSettings.BaseOrderVolumeType.HasValue) { updateData.BaseOrderVolumeType = _newSettings.BaseOrderVolumeType.Value; } if (_newSettings.SafetyOrderVolumeType.HasValue) { updateData.SafetyOrderVolumeType = _newSettings.SafetyOrderVolumeType.Value; } if (_newSettings.DisableAfterDealsCountInfo != null) { if (_newSettings.DisableAfterDealsCountInfo.Enable) { updateData.DisableAfterDealsCount = _newSettings.DisableAfterDealsCountInfo.Value; } else { updateData.DisableAfterDealsCount = null; } } if (_newSettings.DealStartConditions.Any()) { updateData.Strategies.Clear(); updateData.Strategies.AddRange(_newSettings.DealStartConditions); } var res = await botMgr.SaveBot(bot.Id, updateData); if (res.IsSuccess) { _logger.LogInformation($"Bot {bot.Id} updated"); } else { _logger.LogError($"Could not update Bot {bot.Id}. Reason: {res.Error}"); } } _mbs.ShowInformation("Bulk Edit finished. See output section for details."); this.DialogResult = DialogResult.OK; this.Close(); }
private void ExecuteShowCommand(object x) { MessageBoxService.ShowInformation("権限があります"); }