public ConfigurationStore(IZipper zipper, IDeserializer deserializer, ISerializer serializer, IDialog dialog) { _zipper = zipper; _deserializer = deserializer; _serializer = serializer; _dialog = dialog; }
private void createStartDialog(IGameFactory factory, IDialog questionsDialog, IDialog shadersDialog) { StartDialog.StartupActions.AddPlayerText("Hello there!"); StartDialog.StartupActions.AddText(Characters.Beman, "Hello yourself!"); StartDialog.StartupActions.AddConditionalActions(() => Repeat.OnceOnly("BemanStartDialog")); StartDialog.StartupActions.AddText(Characters.Beman, "God, that's a relief.", "It's good to see I'm not alone in this place."); IDialogOption option1 = factory.Dialog.GetDialogOption("Who are you?", showOnce: true); option1.AddText(Characters.Beman, "I am Beman, and you are?"); option1.AddPlayerText("I am Cris."); IDialogOption option2 = factory.Dialog.GetDialogOption("What is this place?"); option2.AddText(Characters.Beman, "I have no idea. I just woke up here."); option2.AddPlayerText("Wow, seems like we share a similar story."); IDialogOption option3 = factory.Dialog.GetDialogOption("Tell me a little bit about yourself.", speakOption: false); option3.AddText(Characters.Beman, "What do you want to know?"); option3.ChangeDialogWhenFinished = questionsDialog; IDialogOption option4 = factory.Dialog.GetDialogOption("Can I set a shader?"); option4.AddText(Characters.Beman, "Sure, choose a shader..."); option4.ChangeDialogWhenFinished = shadersDialog; IDialogOption option5 = factory.Dialog.GetDialogOption("I'll be going now."); option5.AddText(Characters.Beman, "Ok, see you around."); option5.ExitDialogWhenFinished = true; StartDialog.AddOptions(option1, option2, option3, option4, option5); }
/// <summary> /// Initializes a new instance of the <see cref="SelfMediaDatabase.Core.Operations.Prune.PruneOperation"/> class. /// </summary> /// <param name="directory">Injection wrapper of <see cref="System.IO.Directory"/>.</param> /// <param name="file">Injection wrapper of <see cref="System.IO.File"/>.</param> /// <param name="path">Injection wrapper of <see cref="System.IO.Path"/>.</param> /// <param name="imageComparer">Image comparer.</param> /// <param name="fileSystemHelper">Helper to access to files.</param> public PruneOperation( IDirectory directory, IFile file, IPath path, IImageComparer imageComparer, IFileSystemHelper fileSystemHelper, IDialog dialog, IRenameOperation renameOperation) { if (directory == null) throw new ArgumentNullException("directory"); if (file == null) throw new ArgumentNullException("file"); if (imageComparer == null) throw new ArgumentNullException("imageComparer"); if (fileSystemHelper == null) throw new ArgumentNullException("fileSystemHelper"); if (path == null) throw new ArgumentNullException("path"); if (dialog == null) throw new ArgumentNullException("dialog"); if (renameOperation == null) throw new ArgumentNullException("renameOperation"); _directory = directory; _file = file; _path = path; _imageComparer = imageComparer; _fileSystemHelper = fileSystemHelper; _dialog = dialog; _renameOperation = renameOperation; }
public void Setup() { dialog1 = new Dialog(); dialog2 = Substitute.For<Dialog>(); dialog3 = Substitute.For<Dialog>(); dialog4 = Substitute.For<Dialog>(); }
public void AddNext(IDialog dialog) { if (dialog == null) throw new ArgumentException("Can't assign empty Dialog!"); if (dialog == this) throw new ArgumentException("Can't assign self as next!"); nextDialogs.Add(dialog); }
private void getDialogGraphics(IDialog dialog, HashSet<string> ids) { if (dialog == null) return; if (!ids.Add(dialog.Graphics.ID)) return; foreach (var option in dialog.Options) { option.Dispose(); ids.Add(option.Label.ID); getDialogGraphics(option.ChangeDialogWhenFinished, ids); } }
public void Answer(IDialog answer) { if (!isWaitingAnswer) throw new InvalidOperationException("Not waiting for an answer"); if (answer == null || !currentDialogs.Contains(answer)) throw new ArgumentException("Wrong answer passed!"); isWaitingAnswer = false; currentDialogs = new[] { answer }; Next(); }
//public bool ShowDialog(object vm) //{ // ContainerWindow w = new ContainerWindow(); // w.Owner = _wpfWindow; // w.DataContext = vm; // w.CommandBindings.Add(new CommandBinding(this.DialogAcceptCommand, (sender, e) => w.DialogResult = true)); // return w.ShowDialog().GetValueOrDefault(false); //} /// <summary> /// Shows a window containing the object passed /// </summary> /// <param name="vm">The object to show. e.g. the ViewModel</param> /// <returns></returns> public bool ShowDialog(IDialog vm) { ContainerWindow w = new ContainerWindow(); w.Owner = _wpfWindow; w.DataContext = vm; w.Content = vm; w.CommandBindings.Add(new CommandBinding(vm.DialogAcceptCommand, (sender, e) => { vm.DialogOkClicked(); w.DialogResult = true; })); return w.ShowDialog().GetValueOrDefault(false); }
public void Initialize() { _directory = Substitute.For<IDirectory>(); _file = Substitute.For<IFile>(); _path = Substitute.For<IPath>(); _imageComparer = Substitute.For<IImageComparer>(); _fileSystemHelper = Substitute.For<IFileSystemHelper>(); _dialog = Substitute.For<IDialog>(); _renameOperation = Substitute.For<IRenameOperation>(); _path.SetPathDefaultBehavior(); _target = new PruneOperation(_directory, _file, _path, _imageComparer, _fileSystemHelper, _dialog, _renameOperation); }
private async Task EchoDialogFlow(IDialog<object> echoDialog) { // arrange var toBot = DialogTestBase.MakeTestMessage(); toBot.Text = "Test"; Func<IDialog<object>> MakeRoot = () => echoDialog; // act: sending the message var toUser = await Conversation.SendAsync(toBot, MakeRoot); // assert: check if the dialog returned the right response Assert.IsTrue(toUser.Text.StartsWith("1")); Assert.IsTrue(toUser.Text.Contains("Test")); // act: send the message 10 times for(int i = 0; i < 10; i++) { // pretend we're the intercom switch, and copy the bot data from message to message toBot = toUser; // post the message toUser = await Conversation.SendAsync(toBot, MakeRoot); } // assert: check the counter at the end Assert.IsTrue(toUser.Text.StartsWith("11")); // act: send the reset toBot = toUser; toBot.Text = "reset"; toUser = await Conversation.SendAsync(toBot, MakeRoot); // assert: verify confirmation Assert.IsTrue(toUser.Text.ToLower().Contains("are you sure")); //send yes as reply toBot = toUser; toBot.Text = "yes"; toUser = await Conversation.SendAsync(toBot, MakeRoot); Assert.IsTrue(toUser.Text.ToLower().Contains("reset count")); //send a random message and check count toBot = toUser; toBot.Text = "test"; toUser = await Conversation.SendAsync(toBot, MakeRoot); Assert.IsTrue(toUser.Text.StartsWith("1")); }
/// <summary> /// Initializes a new instance of the <see cref="SelfMediaDatabase.Core.Operations.Rename.RenameOperation"/> class. /// </summary> /// <param name="fileSystemHelper">Helper for file system access.</param> /// <param name="file">Injection wrapper of <see cref="System.IO.File"/>.</param> /// <param name="path">Injection wrapper of <see cref="System.IO.Path"/>.</param> /// <param name="dialog">Dialog service to show dialogs.</param> public RenameOperation(IFileSystemHelper fileSystemHelper, IFile file, IPath path, IDialog dialog) { if (fileSystemHelper == null) throw new ArgumentNullException("fileSystemHelper"); if (file == null) throw new ArgumentNullException("file"); if (path == null) throw new ArgumentNullException("path"); if (dialog == null) throw new ArgumentNullException("dialog"); _fileSystemHelper = fileSystemHelper; _file = file; _path = path; _dialog = dialog; _scopeAnswer = DialogAnswer.None; }
private void initDialogs() { IGameFactory factory = _game.Factory; StartDialog = factory.Dialog.GetDialog("Dialog: Beman- Start"); createStartDialog(factory, createQuestionsDialog(factory), createShadersDialog(factory)); }
async Task IDialogStack.Forward <R, T>(IDialog <R> child, ResumeAfter <R> resume, T item, CancellationToken token) { await this.stack.Forward <R, T>(child, resume, item, token); }
public void ShowDialog(IDialog window) { window.Show(_View); }
/// <summary> /// Shows a window non-modally containing the object passed /// </summary> /// <param name="vm">The object to show. e.g. the ViewModel</param> /// <returns></returns> public void ShowDialogNonModal(IDialog vm) { ContainerWindow w = new ContainerWindow(); w.Owner = _wpfWindow; w.DataContext = vm; w.Content = vm; w.CommandBindings.Add(new CommandBinding(vm.DialogAcceptCommand, (sender, e) => { vm.DialogOkClicked(); w.DialogResult = true; })); w.Show(); }
public void SetDialog(IDialog <T> dialog) { _dialog = dialog; }
public void Show(IDialog ucContent) { //this.ContentArea2.Child = null; //ucContent.OnClose += new Action<object>(ucContent_OnClose); //var uc = ucContent as UserControl; //this.tBlurRadius = uc.Width + 30; //this.ContentArea2.Child = uc; //this.Visibility = Visibility.Visible; }
public static AABB CalculateBox(IDialog dialog) { Vector2 corner = dialog.Offset - dialog.Dimensions / 2; var aabb = new AABB(corner, corner + dialog.Dimensions); return aabb; }
public async Task <bool> ShowDialog(IDialog viewModel) { try { if (UseExperimentalPopup) { var tcs = new TaskCompletionSource <bool>(); var popup = new Popup(); popup.IsLightDismissEnabled = true; bool closed = false; popup.Height = viewModel.DesiredHeight; popup.Width = viewModel.DesiredWidth; popup.DataContext = viewModel; var pres = new ContentPresenter(); ViewBind.SetModel(pres, viewModel); popup.Child = new Border() { Child = pres, Background = Brushes.White, BorderThickness = new Thickness(1), BorderBrush = Brushes.DarkGray }; viewModel.CloseCancel += () => { closed = true; popup.Close(); tcs.SetResult(false); }; viewModel.CloseOk += () => { closed = true; popup.Close(); tcs.SetResult(true); }; popup.GetObservable(Popup.IsOpenProperty).Skip(1).SubscribeAction(@is => { if (!@is && !closed) { closed = true; tcs.SetResult(false); } }); if (FocusManager.Instance.Current is Control c) { popup.PlacementTarget = c; } ((DockPanel)mainWindowHolder.Window.GetVisualRoot().VisualChildren[0].VisualChildren[0].VisualChildren[0]).Children.Add(popup); popup.PlacementMode = PlacementMode.Pointer; popup.IsOpen = true; return(await tcs.Task); } else { DialogWindow view = new DialogWindow(); view.Height = viewModel.DesiredHeight; view.Width = viewModel.DesiredWidth; view.DataContext = viewModel; return(await view.ShowDialog <bool>(mainWindowHolder.Window)); } } catch (Exception e) { Console.WriteLine(e); throw; } }
/// <summary> /// When the antecedent <see cref="IDialog{T}"/> has completed, execute the continuation to produce the next <see cref="IDialog{R}"/>. /// </summary> /// <typeparam name="T">The type of the antecedent dialog.</typeparam> /// <typeparam name="R">The type of the next dialog.</typeparam> /// <param name="antecedent">The antecedent <see cref="IDialog{T}"/>.</param> /// <param name="continuation">The continuation to produce the next <see cref="IDialog{R}"/>.</param> /// <returns>The next <see cref="IDialog{R}"/>.</returns> public static IDialog <R> ContinueWith <T, R>(this IDialog <T> antecedent, Continutation <T, R> continuation) { return(new ContinueWithDialog <T, R>(antecedent, continuation)); }
/// <summary> /// When the antecedent <see cref="IDialog{T}"/> has completed, project the result into a new <see cref="IDialog{R}"/>. /// </summary> /// <typeparam name="T">The type of the antecedent dialog.</typeparam> /// <typeparam name="R">The type of the projected dialog.</typeparam> /// <param name="antecedent">The antecedent dialog <see cref="IDialog{T}"/>.</param> /// <param name="selector">The projection function from <typeparamref name="T"/> to <typeparamref name="R"/>.</param> /// <returns>The result <see cref="IDialog{R}"/>.</returns> public static IDialog <R> Select <T, R>(this IDialog <T> antecedent, Func <T, R> selector) { return(new SelectDialog <T, R>(antecedent, selector)); }
public virtual Gui.DialogResult ShowModalDialog(IDialog dlg) { return(ShowModalDialog((Form)dlg)); }
public ExceptionHandlerDialog(IDialog <T> dialog, bool displayException, int stackTraceLength = 500) { _dialog = dialog; _displayException = displayException; _stackTraceLength = stackTraceLength; }
public DialogContainer(IDialog dialog) { Dialog = dialog; }
private void OnExecuteShowRepetitionsWindowCommand() { if (this._repetitionsWindow == null) { this._repetitionsWindow = this.RepetitionsWindowFactory.GetInstance(); } this._repetitionsWindow.Show(); }
public DialogResult ShowModalDialog(IDialog dlg) { return ShowModalDialog((Form)dlg); }
/// <summary> /// When the antecedent <see cref="IDialog{IDialog{T}}"/> has completed, unwrap the result into a new <see cref="IDialog{T}"/>. /// </summary> /// <typeparam name="T">The type of the antecedent dialog.</typeparam> /// <param name="antecedent">The antecedent dialog <see cref="IDialog{IDialog{T}}"/>.</param> /// <returns>The result <see cref="IDialog{T}"/>.</returns> public static IDialog <T> Unwrap <T>(this IDialog <IDialog <T> > antecedent) { return(new UnwrapDialog <T>(antecedent)); }
public DialogResult ShowModalDialog(IDialog dlg) { throw new NotImplementedException(); }
/// <summary> /// When the antecedent <see cref="IDialog{T}"/> has completed, execute the next <see cref="IDialog{C}"/>, and use the projection to combine the results. /// </summary> /// <typeparam name="T">The type of the antecedent dialog.</typeparam> /// <typeparam name="C">The type of the intermediate dialog.</typeparam> /// <typeparam name="R">The type of the projected dialog.</typeparam> /// <param name="antecedent">The antecedent dialog <see cref="IDialog{T}"/>.</param> /// <param name="function">The factory method to create the next dialog <see cref="IDialog{C}"/>.</param> /// <param name="projection">The projection function for the combination of the two dialogs.</param> /// <returns>The result <see cref="IDialog{R}"/>.</returns> public static IDialog <R> SelectMany <T, C, R>(this IDialog <T> antecedent, Func <T, IDialog <C> > function, Func <T, C, R> projection) { return(new SelectManyDialog <T, C, R>(antecedent, function, projection)); }
/// <summary> /// Loop the <see cref="IDialog"/> forever. /// </summary> /// <param name="antecedent">The antecedent <see cref="IDialog"/>.</param> /// <returns>The looping dialog.</returns> public static IDialog <T> Loop <T>(this IDialog <T> antecedent) { return(new LoopDialog <T>(antecedent)); }
public virtual async Task ChoiceReceivedAsync(IDialog context, IAwaitable <TaskChoiceList> activity) { TaskChoiceList response = await activity; }
public DoDialog(IDialog <T> antecedent, Action <IAwaitable <T> > Action) { SetField.NotNull(out this.Antecedent, nameof(antecedent), antecedent); SetField.NotNull(out this.Action, nameof(Action), Action); }
public ExceptionHandlerDialog(IDialog <T> dialog) { _dialog = dialog; }
public PostToUserDialog(IDialog <T> antecedent) { SetField.NotNull(out this.Antecedent, nameof(antecedent), antecedent); }
public void addDialog(IDialog someDialog) { dialog = someDialog; }
public ContinueWithDialog(IDialog <T> antecedent, Continutation <T, R> continuation) { SetField.NotNull(out this.Antecedent, nameof(antecedent), antecedent); SetField.NotNull(out this.Continuation, nameof(continuation), continuation); }
public InstallDevMenu(string rootFilesPath, IPhone phone, IBcdInvokerFactory bcdInvokerFactory, IFileSystemOperations fileSystemOperations, IDialog dialog) { this.rootFilesPath = rootFilesPath; this.phone = phone; this.bcdInvokerFactory = bcdInvokerFactory; this.fileSystemOperations = fileSystemOperations; this.dialog = dialog; }
public SelectDialog(IDialog <T> antecedent, Func <T, R> selector) { SetField.NotNull(out this.Antecedent, nameof(antecedent), antecedent); SetField.NotNull(out this.Selector, nameof(selector), selector); }
public Dialog(IDialogForm dialogForm, IDialog cancelTarget) : this(dialogForm) { this.cancelTarget = cancelTarget; }
public SelectManyDialog(IDialog <T> antecedent, Func <T, IDialog <C> > function, Func <T, C, R> projection) { SetField.NotNull(out this.Antecedent, nameof(antecedent), antecedent); SetField.NotNull(out this.Function, nameof(function), function); SetField.NotNull(out this.Projection, nameof(projection), projection); }
public MyLongClickListener(OnDialogLongClickListener listener, IDialog dialog) { this.onDialogLongClickListener = listener; this.dialog = dialog; }
public LoopDialog(IDialog <T> antecedent) { SetField.NotNull(out this.Antecedent, nameof(antecedent), antecedent); }
public void Dispose() { if (this._repetitionsWindow != null) { this._repetitionsWindow.Close(); this._repetitionsWindow = null; } if (this._textHighlightWindow != null) { this._textHighlightWindow.Close(); this._textHighlightWindow = null; } }
protected Dialog (Generator g, Type type, bool initialize = true) : base(g, type, initialize) { handler = (IDialog)this.Handler; this.DialogResult = DialogResult.None; }
public void InvalidUserAlertHandler(IDialog dialog) { string txt = dialog.Window.AllChildren[dialog.Window.AllChildren.Count - 1].Caption; Assert.AreEqual<string>("�����a:\n����� ���������� �� ����������!\n", txt); Log.WriteLine("Dialog text: " + txt); Manager.Desktop.KeyBoard.KeyPress(Keys.Enter); dialog.HandleCount++; }
/// <summary> /// Shows a dialog. /// </summary> /// <param name="viewModel">The dialog view model.</param> /// <returns> /// the dialog result. /// </returns> public DialogResult ShowDialog(IDialog viewModel) { this._windowManager.ShowDialog(viewModel); return viewModel.DialogResult; }
void IDialogStack.Call <R>(IDialog <R> child, ResumeAfter <R> resume) { this.stack.Call <R>(child, resume); }
public RenameOperationTester (IFileSystemHelper fileSystemHelper, IFile file, IPath path, IDialog dialog, IRenameOperation self) : base(fileSystemHelper, file, path, dialog) { if (self == null) self = this; _self = self; }
public AppValidator(IDialog platformDialog) { Dialog = platformDialog; }
private void ShowEditModeDialog(object sender, RoutedEventArgs e, string title, bool isNotReturn) { HyperlinkButton btn = sender as HyperlinkButton; List <LendRequestItemVM> itemSource = this.dgProductList.ItemsSource as List <LendRequestItemVM>; LendRequestItemVM selected = this.dgProductList.SelectedItem as LendRequestItemVM; LendRequestVM RequestVM = this.DataContext as LendRequestVM; LendRequestItemVM seleced = RequestVM.LendItemInfoList.Where(p => p.ProductSysNo == selected.ProductSysNo).FirstOrDefault(); UCProductBatch batch = new UCProductBatch(seleced.ProductSysNo.Value.ToString(), seleced.ProductID, selected.HasBatchInfo, seleced.BatchDetailsInfoList); batch.StockSysNo = RequestVM.StockSysNo; if (seleced.ReturnDateETA.HasValue) { batch.ReturnDate = seleced.ReturnDateETA; } batch.OperationQuantity = seleced.LendQuantity.HasValue ? seleced.LendQuantity.Value : 0; batch.PType = Models.Request.PageType.Lend; batch.IsCreateMode = false; batch.IsNotLend_Return = isNotReturn; IDialog dialog = CurrentWindow.ShowDialog("添加明细", batch, (obj, args) => { ProductVMAndBillInfo productList = args.Data as ProductVMAndBillInfo; if (productList != null) { productList.ProductVM.ForEach(p => { LendRequestItemVM vm = null; #region 只允许添加自己权限范围内可以访问商品 string errorMessage = "对不起,您没有权限访问{0}商品!"; InventoryQueryFilter queryFilter = new InventoryQueryFilter(); queryFilter.ProductSysNo = p.SysNo; queryFilter.UserName = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.LoginUser.LoginName; queryFilter.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode; queryFilter.UserSysNo = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.LoginUser.UserSysNo; int?returnQuantity = null; int quantity = 1; if (p.IsHasBatch == 1) { quantity = (from s in p.ProductBatchLst select s.Quantity).Sum(); } else if (p.IsHasBatch == 0) { quantity = productList.Quantity; } if (!batch.IsNotLend_Return) { returnQuantity = (from s in p.ProductBatchLst select s.ReturnQuantity).Sum(); } if (!AuthMgr.HasFunctionAbsolute(AuthKeyConst.IM_SeniorPM_Query)) { new InventoryQueryFacade(CurrentPage).CheckOperateRightForCurrentUser(queryFilter, (Innerogj, innerArgs) => { if (!innerArgs.FaultsHandle()) { if (!innerArgs.Result) { CurrentWindow.Alert(string.Format(errorMessage, p.ProductID)); return; } else { vm = new LendRequestItemVM { ProductSysNo = p.SysNo, LendQuantity = quantity, ProductName = p.ProductName, ProductID = p.ProductID, PMUserName = p.PMUserName, ReturnDateETA = productList.ReturnDate, BatchDetailsInfoList = EntityConverter <BatchInfoVM, ProductBatchInfoVM> .Convert(p.ProductBatchLst), IsHasBatch = p.IsHasBatch }; RequestVM.LendItemInfoList.Remove((LendRequestItemVM)this.dgProductList.SelectedItem); RequestVM.LendItemInfoList.Add(vm); this.dgProductList.ItemsSource = RequestVM.LendItemInfoList; } } }); } else { vm = new LendRequestItemVM { ProductSysNo = p.SysNo, LendQuantity = quantity, ProductName = p.ProductName, ProductID = p.ProductID, PMUserName = p.PMUserName, ReturnDateETA = productList.ReturnDate, BatchDetailsInfoList = EntityConverter <BatchInfoVM, ProductBatchInfoVM> .Convert(p.ProductBatchLst), IsHasBatch = p.IsHasBatch }; RequestVM.LendItemInfoList.Remove((LendRequestItemVM)this.dgProductList.SelectedItem); RequestVM.LendItemInfoList.Add(vm); this.dgProductList.ItemsSource = RequestVM.LendItemInfoList; } #endregion }); } }); batch.DialogHandler = dialog; }
public DialogTest() { _container = _testContainerBuilder.Build(); _target = A.Fake <AbstractDialog>(); }
private void MyCustomAlertHandler(IDialog dialog) { dialogMessage = dialog.Window.AllChildren[dialog.Window.AllChildren.Count - 1].Caption; Telerik.Manager.Desktop.KeyBoard.KeyPress(Keys.Enter); dialog.HandleCount++; }
/// <summary> /// Execute a side-effect after a <see cref="IDialog{T}"/> completes. /// </summary> /// <typeparam name="T">The type of the dialog.</typeparam> /// <param name="antecedent">The antecedent <see cref="IDialog{T}"/>.</param> /// <param name="callback">The callback method.</param> /// <returns>The antecedent dialog.</returns> public static IDialog <T> Do <T>(this IDialog <T> antecedent, Action <IAwaitable <T> > callback) { return(new DoDialog <T>(antecedent, callback)); }
protected Dialog(Generator g, Type type) : base(g, type) { inner = (IDialog)this.Handler; this.DialogResult = DialogResult.None; }
public void Setup() { conversation = new Conversation(); dialog1 = Substitute.For<IDialog>(); dialog1.GetText().Returns("Dialog1"); dialog2 = Substitute.For<IDialog>(); dialog2.GetText().Returns("Dialog2"); dialog3 = Substitute.For<IDialog>(); dialog3.GetText().Returns("Dialog3"); dialog4 = Substitute.For<IDialog>(); dialog4.GetText().Returns("Dialog4"); dialog5 = Substitute.For<IDialog>(); dialog5.GetText().Returns("Dialog5"); //Make dialogs linies dialog1.GetNext().Returns(new[] { dialog3 }); dialog2.GetNext().Returns(new[] { dialog3 }); dialog3.GetNext().Returns(new[] { dialog4, dialog5 }); }
/// <summary> /// Post to the user the result of a <see cref="IDialog{T}"/>. /// </summary> /// <typeparam name="T">The type of the dialog.</typeparam> /// <param name="antecedent">The antecedent <see cref="IDialog{T}"/>.</param> /// <returns>The antecedent dialog.</returns> public static IDialog <T> PostToUser <T>(this IDialog <T> antecedent) { return(new PostToUserDialog <T>(antecedent)); }
public void Initialize() { _fileSystemHelper = Substitute.For<IFileSystemHelper>(); _file = Substitute.For<IFile>(); _path = Substitute.For<IPath>(); _path.SetPathDefaultBehavior(); _dialog = Substitute.For<IDialog>(); _target = new RenameOperation(_fileSystemHelper, _file, _path, _dialog); }
public static void Navigate(Type parentViewModelType, string container, Type viewModelType) { //get a mapping where there is a desired viewModel var mapping = Mappings. Where(m => m.Value == viewModelType).FirstOrDefault(); //checks if the type is a window //bind with a window binder if so if (Activator.CreateInstance(mapping.Key) is Page) { VVMBinder <Page> binder = new VVMBinder <Page>(mapping.Key, mapping.Value); //gets all the buttons with content or name starting with show or open. //making event subscribe to the click event, that will open the window with name specified after show or open. foreach (var bt in binder.ShowDialogButtons) { bt.Click += (sender, e) => { ShowWindowDialog_Click(sender, e); } } ; //same as of the buttons but here for the menuitems foreach (var mn in binder.ShowDialogMenuItems) { mn.Click += (sender, e) => { ShowWindowDialog_Click(sender, e); } } ; //add the mapping to the dictionary of open mappings // OpenDialogMappings.Add(binder.View as IDialog, viewModelType); //Navigate //pages can be hosted only within a frame or a window element Page page = binder.View; IDialog host = GetOpenedDialog(parentViewModelType); ///TODO TODO TODO HERE try { var frame = ElementService.FindElements <Frame>(host as Window).Single(s => s.Name == container); frame.Content = page; pageHistory.Add(new KeyValuePair <string, object>(container, frame.Content)); } catch { throw new Exception($"{host.GetType().FullName} does not contain a Frame with name '{container}'"); } } else { } //event handler void ShowWindowDialog_Click(object sender, RoutedEventArgs e) { string windowName = null; if (sender is Button but) { windowName = but.Name; } else if (sender is MenuItem mni) { windowName = mni.Name; } windowName = windowName.Replace("Open", "").Replace("Show", "").Replace("Window", "").Replace("Dialog", ""); Type type = Mappings.Where(m => m.Key.Name.StartsWith(windowName)).FirstOrDefault().Value; if (type != null) { } } }
public void AddNext_Throws_Argument_Exception_If_Null_Passed() { IDialog dialog = null; Assert.Throws <ArgumentException>(() => { dialog1.AddNext(dialog); }); }
public FilePicker(IDialog dialog) { _dialog = dialog; }