示例#1
0
 internal void OnRequestTaskDialog(object sender, TaskDialogEventArgs args)
 {
     if (RequestTaskDialog != null)
     {
         RequestTaskDialog(sender, args);
     }
 }
        public void TestTaskDialogEventArgs()
        {
            //Act
            const string imageUri = "/DynamoCoreWpf;component/UI/Images/task_dialog_future_file.png";
            //Using the constructor of TaskDialogEventArgs, the properties ImageUri, DialogTitle, Summary and Description will be populated
            var args = new TaskDialogEventArgs(new Uri(imageUri, UriKind.Relative),
                                               "SymbolWarningTitle", "Summary", "Description");

            //In this section is adding two buttons in the IEnumerable Buttons
            args.AddLeftAlignedButton(1000, "OK Button");
            args.AddLeftAlignedButton(1001, "Cancel Button");

            //This will execute the Set method of the Exception property
            args.Exception = new Exception("Testing Exception");

            //Assert
            //This will validate that the values of the properties ImageUri, DialogTitle, Summary and Description were stored correctly
            Assert.AreEqual(args.ImageUri.ToString(), imageUri);
            Assert.AreEqual(args.DialogTitle, "SymbolWarningTitle");
            Assert.AreEqual(args.Summary, "Summary");
            Assert.AreEqual(args.Description, "Description");

            Assert.IsNotNull(args.Exception);                                //This will execute the Get method of the Exception property
            Assert.AreEqual(args.Buttons.ToObservableCollection().Count, 2); //This will execute the Get of the Buttons property
        }
        internal GenericTaskDialog(TaskDialogEventArgs taskDialogParams)
        {
            this.taskDialogParams = taskDialogParams;
            InitializeComponent();
            ClearDefaultContents();

            this.DialogIcon.Source = new BitmapImage(taskDialogParams.ImageUri);
            this.Title = taskDialogParams.DialogTitle;
            this.SummaryText.Text = taskDialogParams.Summary;
            this.DescriptionText.Text = taskDialogParams.Description;

            InitializeButtons();
            InitializeDetailedContent();
        }
示例#4
0
        public void TestOnRequestTaskDialog()
        {
            //Arrange
            //This will subscribe our local method to the RequestTaskDialog event
            CurrentDynamoModel.RequestTaskDialog += CurrentDynamoModel_RequestTaskDialog;
            var args = new TaskDialogEventArgs(
                new Uri("localhost", UriKind.Relative), "Test Dialog", "Summary", "Description");

            //Act
            CurrentDynamoModel.OnRequestTaskDialog(null, args);

            //Assert
            CurrentDynamoModel.RequestTaskDialog -= CurrentDynamoModel_RequestTaskDialog;
            //This will validate that the local handler was executed and set the flag in true
            Assert.IsTrue(requestTaskDialog);
        }
示例#5
0
 internal void OnRequestTaskDialog(object sender, TaskDialogEventArgs args)
 {
     if (RequestTaskDialog != null)
         RequestTaskDialog(sender, args);
 }
示例#6
0
        void Controller_RequestTaskDialog(object sender, TaskDialogEventArgs e)
        {
            var taskDialog = new UI.Prompts.GenericTaskDialog(e);

            taskDialog.ShowDialog();
        }
示例#7
0
 private void CurrentDynamoModel_RequestTaskDialog(object sender, TaskDialogEventArgs e)
 {
     requestTaskDialog = true;
 }