public async Task <ButtonResult> Open() { var showDialog = ShowDialog(WindowTool.GetMainWindow()); Cancel.Focus(); await showDialog; return(_result); }
private void Sync(WorkerTasks task, bool interactive = true) { // don't do nothin' if we're already syncing if (Worker.IsBusy) { if (interactive) { Notifications.ShowBalloonTip((int)BalloonTimeout.TotalMilliseconds, Text, Resources.SettingsForm_WorkerIsBusy, ToolTipIcon.Info); } return; } // ensure the settings aren't dirty if (Settings.Default.IsDirty) { if (interactive) { // activate the form and the most appropriate button and show a message to the user Activate(); if (Save.Enabled) { Save.Focus(); } else { Cancel.Focus(); } Notifications.ShowBalloonTip((int)BalloonTimeout.TotalMilliseconds, Text, Resources.SettingsForm_UnsavedSettings, ToolTipIcon.Info); } return; } // only continue if a user name was provided if (string.IsNullOrEmpty(Settings.Default.UserName)) { if (interactive) { // show and activate the form, focus the user name input and show a message to the user Show(); Activate(); UserName.Focus(); Notifications.ShowBalloonTip((int)BalloonTimeout.TotalMilliseconds, Text, Resources.SettingsForm_SettingsIncomplete, ToolTipIcon.Info); } return; } // start the worker and update the UI Worker.RunWorkerAsync(new SyncContext(Settings.Default, task, interactive)); UpdateWorkerStatus(); }