public SurveyTests() { var userProfileAccessor = new Mock <IStatePropertyAccessor <UserProfile> >(); var userProfile = new UserProfile(); userProfileAccessor.Setup(x => x.GetAsync(It.IsAny <ITurnContext>(), It.IsAny <Func <UserProfile> >(), It.IsAny <CancellationToken>())).ReturnsAsync(userProfile); var surveyState = new SurveyState(); _features = new Features { CollateResponses = true, RealisticTypingDelay = false }; var botSettings = new BotSettings(); _feedbackServiceMock = new Mock <IFeedbackService>(); _feedbackBotStateMock = new Mock <IFeedbackBotStateRepository>(); _feedbackBotStateMock.SetupGet(x => x.UserProfile).Returns(userProfileAccessor.Object); var dialogFactory = new DialogFactory(new List <IComponentBuilder <ComponentDialog> > { new FreeTextDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings)), new MultipleChoiceDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings), _feedbackServiceMock.Object), new SurveyStartDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings)), new SurveyEndDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings), _feedbackServiceMock.Object) }); _dialog = dialogFactory.Create <SurveyDialog>(new InMemoryApprenticeFeedbackSurveyV6()); }
/// <summary> /// Сообщения об ошибках /// </summary> public async Task ShowErrors(IEnumerable <IErrorCommon> fileErrors) { if (fileErrors == null) { return; } var fileErrorsCollection = fileErrors.ToList(); switch (fileErrorsCollection.Count) { case 0: return; case 1: await ShowError(fileErrorsCollection[0]); return; default: await DialogFactory.GetErrorDialog("Ошибки записаны в системный журнал"); return; } }
/// <summary> /// Once the user has made a selection then direct the user to the relevant dialog /// </summary> /// <param name="context"></param> /// <param name="argument"></param> /// <returns></returns> private async Task UserMadeSelection(IDialogContext context, IAwaitable <Triggers> argument) { // Await the user's interaction var arg = await argument; switch (arg) { case Triggers.Root: await context.PostAsync("Returning to the root menu"); this.GiveUserChoices(context); break; case Triggers.Calculator: await context.PostAsync("Welcome to the calculator"); await context.PostAsync("Please post your calculation in the form X + Y"); var calculatorDialog = DialogFactory.MakeInstance <CalculatorDialog>(); context.Wait(calculatorDialog.PerformCalculation); break; default: break; } }
/// <summary> /// Upload file into browser via dialog window /// </summary> /// <param name="file">Full path to file</param> public static void Upload(string file) { var dialog = DialogFactory.GetOpenFileDialog(); dialog.FilePath = file; dialog.Open(); }
public OtitEuropa(botWindow botwindow) { #region общие this.botwindow = botwindow; this.xx = botwindow.getX(); this.yy = botwindow.getY(); #endregion //this.server = botwindow.getserver(); ServerFactory serverFactory = new ServerFactory(botwindow); this.server = serverFactory.create(); // создали конкретный экземпляр класса server по паттерну "простая Фабрика" (Америка, Европа или Синг) this.town = server.getTown(); DialogFactory dialogFactory = new DialogFactory(this.botwindow); dialog = dialogFactory.createDialog(); this.pointOldMan1 = new PointColor(907 - 5 + xx, 675 - 5 + yy, 7800000, 5); this.pointOldMan2 = new PointColor(907 - 5 + xx, 676 - 5 + yy, 7800000, 5); this.pointTask1 = new PointColor(928 - 5 + xx, 360 - 5 + yy, 8200000, 5); this.pointTask2 = new PointColor(928 - 5 + xx, 361 - 5 + yy, 8200000, 5); this.pointGetTask1 = new PointColor(854 - 5 + xx, 379 - 5 + yy, 258, 0); this.pointGetTask2 = new PointColor(854 - 5 + xx, 380 - 5 + yy, 258, 0); this.pointIsOpenMap1 = new PointColor(484 - 30 + xx, 129 - 30 + yy, 8549475, 0); this.pointIsOpenMap2 = new PointColor(490 - 30 + xx, 129 - 30 + yy, 8549475, 0); this.pointIsNearOldMan = new PointColor(951 - 5 + xx, 127 - 5 + yy, 3819200, 0); this.pointMamons = new Point(526 - 5 + xx, 262 - 5 + yy); this.pointOldMan = new Point(531 - 5 + xx, 343 - 5 + yy); this.pointOldManOnMap = new Point(740 - 5 + xx, 212 - 5 + yy); this.pointButtonMoveOnMap = new Point(835 - 5 + xx, 635 - 5 + yy); }
/// <summary> /// Lets the user choose a file to upload, and then transfers it /// </summary> /// <param name="owner">The owner form</param> /// <param name="con">The connection to use</param> /// <returns>A DialogResult object that indicates the upload result</returns> public static DialogResult UploadPackage(Form owner, IServerConnection con) { OpenFileDialog dlg = DialogFactory.OpenFile(); //Mono does NOT like this one //dlg.AutoUpgradeEnabled = true; dlg.CheckFileExists = true; dlg.CheckPathExists = true; dlg.DefaultExt = ".mgp"; //NOXLATE dlg.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickMgp, "mgp") + "|" + //NOXLATE string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickZip, "zip") + "|" + //NOXLATE StringConstants.AllFilesFilter; dlg.FilterIndex = 0; dlg.Multiselect = false; dlg.ValidateNames = true; dlg.Title = Strings.UploadPackageDialogTitle; if (dlg.ShowDialog(owner) == DialogResult.OK) { var optDiag = new PackageUploadOptionDialog(); optDiag.ShowDialog(); if (optDiag.Method == PackageUploadMethod.Transactional) { return UploadPackage(owner, con, dlg.FileName); } else { return StartNonTransactionalUploadLoop(owner, con, dlg.FileName); } } else return DialogResult.Cancel; }
/// <summary> /// Load connections from a source. <see cref="connectionFileName"/> is ignored if /// <see cref="useDatabase"/> is true. /// </summary> /// <param name="useDatabase"></param> /// <param name="import"></param> /// <param name="connectionFileName"></param> public void LoadConnections(bool useDatabase, bool import, string connectionFileName) { var oldConnectionTreeModel = ConnectionTreeModel; var oldIsUsingDatabaseValue = UsingDatabase; var newConnectionTreeModel = useDatabase ? new SqlConnectionsLoader().Load() : new XmlConnectionsLoader(connectionFileName).Load(); if (newConnectionTreeModel == null) { DialogFactory.ShowLoadConnectionsFailedDialog(connectionFileName, "Decrypting connection file failed", IsConnectionsFileLoaded); return; } IsConnectionsFileLoaded = true; ConnectionFileName = connectionFileName; UsingDatabase = useDatabase; if (!import) { _puttySessionsManager.AddSessions(); newConnectionTreeModel.RootNodes.AddRange(_puttySessionsManager.RootPuttySessionsNodes); } ConnectionTreeModel = newConnectionTreeModel; UpdateCustomConsPathSetting(connectionFileName); RaiseConnectionsLoadedEvent(oldConnectionTreeModel, newConnectionTreeModel, oldIsUsingDatabaseValue, useDatabase, connectionFileName); }
private async void ShowDarkTheme(object sender, RoutedEventArgs e) { await DialogFactory .Alert("Dark dialog independent of application resources") .With(dialog => dialog.Theme = DialogTheme.Dark) .Show("RootDialog", LargeModalWidth); }
public override void Run() { var wb = Workbench.Instance; var exp = wb.ActiveSiteExplorer; var connMgr = ServiceRegistry.GetService <ServerConnectionManager>(); var conn = connMgr.GetConnection(exp.ConnectionName); using (var open = DialogFactory.OpenFile()) { open.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickMgp, "mgp"); //NOXLATE if (open.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK) { var optDiag = new PackageUploadOptionDialog(); optDiag.ShowDialog(); DialogResult res; if (optDiag.Method == PackageUploadMethod.Transactional) { res = PackageProgress.UploadPackage(wb, conn, open.FileName); } else { res = PackageProgress.StartNonTransactionalUploadLoop(wb, conn, open.FileName); } if (res == System.Windows.Forms.DialogResult.OK) { exp.RefreshModel(conn.DisplayName); } } } }
private void lnkLoadImage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { using (var open = DialogFactory.OpenFile()) { open.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickPng, "png"); //NOXLATE if (open.ShowDialog() == DialogResult.OK) { byte[] content = File.ReadAllBytes(open.FileName); //HACK: Leaky Abstraction. The impl of IImageGraphic.Item returns a new instance //So these are not the same reference _imageInline.Content = content; if (_image.Item.Type == ImageType.Inline) { _image.Item = _imageInline; } txtImageBase64.Text = Convert.ToBase64String(content); txtImageBase64.Tag = content; using (var ms = new MemoryStream(content)) { Image img = Image.FromStream(ms); symSizeX.Content = $"'{PxToMM(img.Width, 96).ToString(System.Globalization.CultureInfo.InvariantCulture)}'"; //NOXLATE symSizeY.Content = $"'{PxToMM(img.Height, 96).ToString(System.Globalization.CultureInfo.InvariantCulture)}'"; //NOXLATE } } } }
public OtitSing(botWindow botwindow) { #region общие this.botwindow = botwindow; this.xx = botwindow.getX(); this.yy = botwindow.getY(); #endregion //this.server = botwindow.getserver(); ServerFactory serverFactory = new ServerFactory(botwindow); this.server = serverFactory.create(); // создали конкретный экземпляр класса server по паттерну "простая Фабрика" (Америка, Европа или Синг) this.town = server.getTown(); DialogFactory dialogFactory = new DialogFactory(this.botwindow); dialog = dialogFactory.createDialog(); this.pointOldMan1 = new PointColor(907 - 5 + xx, 675 - 5 + yy, 7800000, 5); this.pointOldMan2 = new PointColor(907 - 5 + xx, 676 - 5 + yy, 7800000, 5); this.pointTask1 = new PointColor(928 - 5 + xx, 360 - 5 + yy, 8200000, 5); this.pointTask2 = new PointColor(928 - 5 + xx, 361 - 5 + yy, 8200000, 5); this.pointMamons = new Point(526 - 5 + xx, 262 - 5 + yy); }
public void OnPointerClick(PointerEventData e) { if (gameObject.scene.name == "Game" && _item.IsItem) { var factroy = new DialogFactory(); var dialog = factroy.Create().GetComponent <Dialog>(); dialog.Show(DialogType.AgreeOnly, _item.Name + "を使用しますか?", () => { var player = GameObject.FindWithTag("Player").GetComponent <Treasure>(); }); } else if (gameObject.scene.name == "ItemSelect") { var selectorOrder = Resources.Load("Datas/Order/SelectorOrder") as SelectorOrder; if (selectorOrder.Results.Contains(_item, new ObjectCompare <Object>())) { _image.color = Color.white; selectorOrder.Results.Remove(_item); } else { _image.color = Color.gray; selectorOrder.Results.Add(_item); } } }
/// <summary> /// Shows the modal dialog. /// </summary> /// <param name="owner"></param> /// <returns></returns> public static SalNumber ModalDialog(Control owner) { dlgReceiveItem dlg = DialogFactory.CreateInstance <dlgReceiveItem>(); SalNumber ret = dlg.ShowDialog(owner); return(ret); }
private void mMenFileSaveAs_Click(object sender, EventArgs e) { using (var saveFileDialog = DialogFactory.ConnectionsSaveAsDialog()) { if (saveFileDialog.ShowDialog(FrmMain.Default) != DialogResult.OK) { return; } var newFileName = saveFileDialog.FileName; Runtime.ConnectionsService.SaveConnections(Runtime.ConnectionsService.ConnectionTreeModel, false, new SaveFilter(), newFileName); if (newFileName == Runtime.ConnectionsService.GetDefaultStartupConnectionFileName()) { Settings.Default.LoadConsFromCustomLocation = false; } else { Settings.Default.LoadConsFromCustomLocation = true; Settings.Default.CustomConsPath = newFileName; } } }
/// <summary> /// Affiche la liste des scénarios impactés à l'utilisateur. /// </summary> /// <param name="currentScenario">The current scenario.</param> /// <param name="allScenarios">All scenarios.</param> /// <param name="delete"><c>true</c> si l'action est une suppression.</param> /// <param name="actionsToDelete">Les actions à supprimer.</param> /// <param name="whenNoScenarioImpacted">Action à exécuter lorsqu'aucun scénario n'est impacté.</param> /// <param name="actionsWithUpdatedWBS">The actions with updated WBS.</param> protected async Task <bool> ShowImpactedScenarios( Scenario currentScenario, Scenario[] allScenarios, bool delete, KAction[] actionsToDelete, Action whenNoScenarioImpacted, KAction[] actionsWithUpdatedWBS = null) { Scenario[] scenarios = await ServiceBus.Get <IAnalyzeService>().PredictImpactedScenarios(currentScenario, allScenarios, actionsToDelete, actionsWithUpdatedWBS); bool ok = true; // Informer des scénarios impactés if (scenarios != null && scenarios.Any()) { string messageKey = delete ? "VM_AnalyzeCommon_DeleteImpactedScenarios" : "VM_AnalyzeCommon_ImpactedScenarios"; string scenariosJoint = string.Join(Environment.NewLine, scenarios.Select(s => s.Label)); string message = string.Format( LocalizationManager.GetString(messageKey), scenariosJoint); MessageDialogResult res = DialogFactory.GetDialogView <IMessageDialog>() .Show(message, null, MessageDialogButton.YesNoCancel, MessageDialogImage.Warning); ok = res == MessageDialogResult.Yes; } else { whenNoScenarioImpacted?.Invoke(); } return(ok); }
public TrainingSessionDialogViewModel(DialogFactory dialogs) { _dialogs = dialogs; OpenAddSessionExerciseCommand = new Command(OpenAddSessionExerciseDialogAsync); OpenEditSessionExerciseCommand = new Command <SessionExercise>(OpenEditSessionExerciseDialogAsync); RemoveExerciseCommand = new Command <SessionExercise>(DeleteExercise); }
private IDialog SolutionNameDialog() { IDialog dialog = DialogFactory.NewDialog(); dialog.Message = SolutionNameMessage; dialog.Title = NameSolutionTitle; return(dialog); }
private void OnAddItem() { IItem item = this.itemFactory.CreateItem().Result; Dialogs.DialogItem.DialogItemViewModel vm = new Dialogs.DialogItem.DialogItemViewModel(item); DialogFactory dialogFactory = new DialogFactory(); DialogResult dialogResult = dialogFactory.ShowDialog("Item", vm); }
public void CreateCitizens(ISector sector, IBotPlayer botPlayer, IEnumerable <MapRegion> citizenRegions) { var map = sector.Map; foreach (var region in citizenRegions) { // 1 к 9, потому что это наиболее удобное соотношение // для размещения неподвижных блокирующих объектов // без преграждения выходов. var citizenCount = region.Nodes.Count() / 9f; var availableNodes = from node in region.Nodes where !map.Transitions.Keys.Contains(node) select node; var openNodes = new List <IMapNode>(availableNodes); for (var i = 0; i < citizenCount; i++) { //TODO Объединить этот блок с генератором сундуков, как дубликат // Выбрать из коллекции доступных узлов var rollIndex = _citizenGeneratorRandomSource.RollNodeIndex(openNodes.Count); var objectNode = MapRegionHelper.FindNonBlockedNode(openNodes[rollIndex], map, openNodes); if (objectNode == null) { // В этом случае будет сгенерировано на одного жителя меньше. // Узел, с которого не удаётся найти подходящий узел, удаляем, // Чтобы больше его не анализировать, т.к. всё равно будет такой же неудачный исход. openNodes.Remove(openNodes[rollIndex]); continue; } openNodes.Remove(objectNode); var traderDropTable = _schemeService.GetScheme <IDropTableScheme>("trader"); var rollCitizenType = _citizenGeneratorRandomSource.RollCitizenType(); switch (rollCitizenType) { case CitizenType.Unintresting: CreateCitizen(objectNode, botPlayer); break; case CitizenType.Trader: CreateCitizen(traderDropTable, objectNode, botPlayer); break; case CitizenType.QuestGiver: CreateCitizen(DialogFactory.Create(), objectNode, botPlayer); break; default: //TODO Завести тип исключения на генерацию персонажей мирных жителей. throw new System.Exception(); } } } }
public StateGT168(botWindow botwindow) { this.botwindow = botwindow; this.serverFactory = new ServerFactory(botwindow); this.server = serverFactory.create(); // создали конкретный экземпляр класса server по паттерну "простая Фабрика" (Америка, Европа или Синг) this.dialogFactory = new DialogFactory(botwindow); this.dialog = dialogFactory.createDialog(); this.tekStateInt = 168; }
private async void ShowModalPrompt(object sender, RoutedEventArgs e) { bool?result = await DialogFactory.Prompt("Delete item?").Show("RootDialog", ModalWidth); if (result == true) { await DialogFactory.Alert("Item deleted.").Show("RootDialog", ModalWidth); } }
private void RestartApplicationWithError() { this.TraceDebug("Redemarage de l'application en erreur"); SqlMessages.Add(new SqlOutput("Restarting the application...")); DialogFactory.GetDialogView <IMessageDialog>().Show( "The database restoration failed. Please contact K-process support at [email protected]", "Restoration failed", MessageDialogButton.OK, MessageDialogImage.Error); Application.Current.Restart(); }
public MealDialogViewModel(DialogFactory dialogs) { _dialogs = dialogs; OpenAddMealFoodDialogCommand = new Command(OpenAddMealFoodDialogAsync); OpenEditMealFoodDialogCommand = new Command <MealFood>(OpenEditMealFoodDialogAsync); RemoveMealFood = new Command <MealFood>(food => Meal.Foods.List.RemoveByReference(food)); }
private void Death() { var factory = new DialogFactory(); var dialog = factory.Create().GetComponent <Dialog>(); dialog.Show(DialogType.AgreeOnly, "力尽きてしまった。\nメニュー画面に戻ります。", () => { MultiSceneManagement.MultiSceneManager.LoadScene("StageSelect"); }); }
public static void Main(string[] args) { IFactory <AlertType, Severity> factory = new DialogFactory(); IDialog dialog = factory.CreateDialog(AlertType.Warning, Severity.High); System.Console.WriteLine(dialog.Title); System.Console.WriteLine(dialog.Content); System.Console.ReadLine(); }
private void App_OnStartup(object sender, StartupEventArgs e) { var dialogFactory = new DialogFactory(); var dialogService = new DialogService(dialogFactory, new DialogTypeLocator()); var mainViewModel = new MainViewModel(dialogService); MainWindow = new MainWindow(mainViewModel); dialogFactory.Owner = MainWindow; MainWindow.Show(); }
public EatingDayDialogViewModel(DialogFactory dialogs) { _dialogs = dialogs; OpenAddDayMealDialogCommand = new Command(OpenAddDayMealDialogAsync); OpenEditDayMealDialogCommand = new Command <DayMeal>(OpenEditDayMealDialogAsync); RemoveDayMealCommand = new Command <DayMeal>(RemoveMeal); }
public FoodDialogViewModel(DialogFactory dialogs) { _dialogs = dialogs; OpenAddUnitDialogCommand = new Command(OpenAddUnitDialogAsync); OpenEditUnitDialogCommand = new Command <FoodUnit>(OpenEditUnitDialogAsync); RemoveUnitCommand = new Command <FoodUnit>(RemoveUnit); }
private void RestartApplication() { this.TraceDebug("Redemarage de l'application"); SqlMessages.Add(new SqlOutput("Restarting the application...")); DialogFactory.GetDialogView <IMessageDialog>().Show( LocalizationManager.GetString("View_BackupRestore_Restart"), LocalizationManager.GetString("View_BackupRestore_RestartTitle"), MessageDialogButton.OK, MessageDialogImage.Information); Application.Current.Restart(); }
public StateGT751(botWindow botwindow) { this.botwindow = botwindow; OtitFactory otitFactory = new OtitFactory(botwindow); this.otit = otitFactory.createOtit(); DialogFactory dialogFactory = new DialogFactory(botwindow); this.dialog = dialogFactory.createDialog(); this.tekStateInt = 751; }
public DocumentProviderImpl(NetDocumentsModule module) { _dialogHelper = InjectionContainer.Current.Resolve<NdDialogHelper>(); _dialogfactiry = InjectionContainer.Current.Resolve<DialogFactory>(); _adapter = InjectionContainer.Current.Resolve<INetDocumentsAdapter>(); }