Пример #1
0
        public void StartCheckoutDialog()
        {
            var rev      = GetFocusedRevisionPointer();
            var revision = rev as Revision;

            if (revision != null)
            {
                foreach (var branch in revision.References.GetBranches())
                {
                    if (!branch.IsRemote && !branch.IsCurrent)
                    {
                        rev = branch;
                        break;
                    }
                }
            }
            using (var dlg = new CheckoutDialog(_repository))
            {
                if (rev != null)
                {
                    dlg.Revision.Value = rev.Pointer;
                }
                dlg.Run(_environment.MainForm);
            }
        }
Пример #2
0
        void Checkout_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new CheckoutDialog {
                Owner = this
            };

            dialog.ShowDialog();
        }
Пример #3
0
        private async void ExecuteRunCheckOutDialog(object o)
        {
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            //this.ShoppingCart = (CartList)o;
            var view = new CheckoutDialog()
            {
                DataContext = new AppDialogViewModel()
            };
            //view.ShoppingCart = shoppingCart;
            //view.showTotalPrice();
            //show the dialog
            var result = await DialogHost.Show(view, "RootDialog", ExtendedOpenedEventHandler, ExtendedClosingEventHandler);

            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
        public async Task Test_ValidateCheckoutNoDiscountDialog()
        {
            userState = new UserState(new MemoryStorage());

            var checkoutDialog = new CheckoutDialog(userState);
            //var mainDialog = new MainDialog(checkoutDialog);
            var testClient = new DialogTestClient(Channels.Msteams, checkoutDialog);

            var reply = await testClient.SendActivityAsync <IMessageActivity>("hi");

            Assert.AreEqual("Do you have membership with us?", ((HeroCard)reply.Attachments[0].Content).Text);

            reply = await testClient.SendActivityAsync <IMessageActivity>("no");

            Assert.AreEqual("Do you want to shop and check some offers today?", reply.Text);

            reply = await testClient.SendActivityAsync <IMessageActivity>("Yes");

            Assert.AreEqual("No discount for you at this moment.", ((HeroCard)reply.Attachments[0].Content).Text);
        }
        public async Task Test_CheckoutWithDiscountDialog()
        {
            userState = new UserState(new MemoryStorage());

            var checkoutDialog = new CheckoutDialog(userState);
            //var mainDialog= new MainDialog(checkoutDialog);
            var testClient = new DialogTestClient(Channels.Msteams, checkoutDialog);

            var reply = await testClient.SendActivityAsync <IMessageActivity>("hi");

            Assert.AreEqual("Do you have membership with us?", ((HeroCard)reply.Attachments[0].Content).Text);

            reply = await testClient.SendActivityAsync <IMessageActivity>("yes");

            Assert.AreEqual("Great! we have special offers for you.", reply.Text);
            reply = testClient.GetNextReply <IMessageActivity>();
            Assert.AreEqual("Do you want to shop and check some offers today?", ((HeroCard)reply.Attachments[0].Content).Text);

            reply = await testClient.SendActivityAsync <IMessageActivity>("Yes");

            Assert.AreEqual("You will receive a coupon shortly.", ((HeroCard)reply.Attachments[0].Content).Text);
        }
Пример #6
0
        public override void OnExecute(CommandEventArgs e)
        {
            ISvnRepositoryItem selected = EnumTools.GetSingle(e.Selection.GetSelection <ISvnRepositoryItem>());

            if (selected == null)
            {
                return;
            }

            Uri    uri  = selected.Uri;
            string name = selected.Origin.Target.FileName;

            IAnkhSolutionSettings ss = e.GetService <IAnkhSolutionSettings>();

            using (CheckoutDialog dlg = new CheckoutDialog())
            {
                dlg.Context        = e.Context;
                dlg.Uri            = uri;
                dlg.RepositoryRoot = selected.Origin.RepositoryRoot;
                dlg.LocalPath      = System.IO.Path.Combine(ss.NewProjectLocation, name);

                if (dlg.ShowDialog(e.Context) != DialogResult.OK)
                {
                    return;
                }

                e.GetService <IProgressRunner>().RunModal(CommandStrings.CheckingOut,
                                                          delegate(object sender, ProgressWorkerArgs a)
                {
                    SvnCheckOutArgs args = new SvnCheckOutArgs();
                    args.Revision        = dlg.Revision;
                    args.Depth           = dlg.Recursive ? SvnDepth.Infinity : SvnDepth.Files;
                    args.IgnoreExternals = dlg.IgnoreExternals;

                    a.Client.CheckOut(dlg.Uri, dlg.LocalPath, args);
                });
            }
        }