示例#1
0
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            Action webAction = (Action)lsbWebActions.SelectedItem;

            if (ConfirmAlert.Show($"Web action '{webAction.Name}' will be removed.").DialogResult.Value)
            {
                webActions.Remove(webAction);
            }
        }
示例#2
0
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            Behaviour webbehaviour = (Behaviour)lsbBehaviours.SelectedItem;

            if (ValidateWebBehaviourRemoval(webbehaviour))
            {
                if (ConfirmAlert.Show($"Web behaviour '{webbehaviour.Name}' will be removed.").DialogResult.Value)
                {
                    behaviours.Remove((Behaviour)lsbBehaviours.SelectedItem);
                    Studio.GetBehaviourConfiguration().Behaviours.Remove((Behaviour)lsbBehaviours.SelectedItem);
                }
            }
            else
            {
                WarningAlert.Show("This web behaviour cannot be removed because it's used in the project.");
            }
        }
示例#3
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            bool valid = true;

            if (tbName.Text == string.Empty)
            {
                valid            = false;
                lbNameError.Text = "Enter name";
            }
            else
            {
                lbNameError.Text = string.Empty;
            }

            if (valid == true)
            {
                if (!edit)
                {
                    Page          = new Models.Page();
                    Page.Name     = tbName.Text;
                    Page.Type     = ((ComboBoxItem)cbbType.SelectedItem).Tag.ToString();
                    Page.Sections = new ObservableCollection <Models.Section>();
                    Page.IsLoaded = Page.Type == Models.Page.PAGE_TYPE_TEXT;
                    Close();
                }
                else
                {
                    Page.Name = tbName.Text;
                    string type = ((ComboBoxItem)cbbType.SelectedItem).Tag.ToString();
                    if (type != Page.Type)
                    {
                        ConfirmAlert alert = ConfirmAlert.Show("Changing the page type will remove any content on the page.");
                        if (alert.Result == true)
                        {
                            Page.Type        = type;
                            Page.Sections    = new ObservableCollection <Models.Section>();
                            Page.Description = string.Empty;
                        }
                    }
                    Close();
                }
            }
        }
示例#4
0
        private async void ExecuteTasks()
        {
            while (!complete)
            {
                taskCounter++;
                TaskToExecute = TasksToExecute[taskCounter];
                if (!TaskToExecute.IsCanceled)
                {
                    lbTaskName.Text        = TaskToExecute.TaskName;
                    lbTaskDescription.Text = TaskToExecute.TaskDescription;

                    pbTotalProgress.Value     = taskCounter;
                    TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/ArrowRightBold.png", UriKind.RelativeOrAbsolute));
                    lbTitle.Text         = String.Format("Processing task {0} of {1}", (taskCounter + 1).ToString(), TasksToExecute.Count.ToString());
                    Title                = lbTitle.Text + ": " + lbTaskName.Text;
                    TaskToExecute.Dialog = this;
                    TaskToExecute.BeforeExecution();
                    pbProgress.IsIndeterminate = TaskToExecute.IsIndeterminate;

                    if (TaskToExecute.IsCancelable)
                    {
                        TaskToExecute.CancellationTokenSource = new CancellationTokenSource();
                        try
                        {
                            executingInnerTask = TaskToExecute.Execute();
                            await executingInnerTask;
                            PassThrough();
                            TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/CheckmarkGreen.png", UriKind.RelativeOrAbsolute));
                        }
                        catch (OperationCanceledException)
                        {
                            TaskToExecute.IsCanceled = true;
                            TaskToExecute.FireCanceledEvent(this);
                            TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/FailRed.png", UriKind.RelativeOrAbsolute));
                            if (taskCounter != TasksToExecute.Count - 1)
                            {
                                ConfirmAlert alert = new ConfirmAlert("Task canceled./nThe next task will now execute.");
                                if (alert.ShowDialog() == false)
                                {
                                    complete = true;
                                    Close();
                                }
                            }
                        }
                        if (!executingInnerTask.IsCanceled)
                        {
                            TaskToExecute.AfterExecution();
                            TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/CheckmarkGreen.png", UriKind.RelativeOrAbsolute));
                            TaskToExecute.FireExecutedEvent(this);
                        }
                        else
                        {
                            TaskToExecute.AfterExecution();
                            TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/FailRed.png", UriKind.RelativeOrAbsolute));
                            TaskToExecute.FireCanceledEvent(this);
                        }
                    }
                    else
                    {
                        executingInnerTask = TaskToExecute.Execute();
                        await executingInnerTask;

                        TaskToExecute.AfterExecution();
                        PassThrough();
                        if (!TaskToExecute.IsCanceled)
                        {
                            TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/CheckmarkGreen.png", UriKind.RelativeOrAbsolute));
                            TaskToExecute.FireExecutedEvent(this);
                        }
                        else
                        {
                            TaskToExecute.Icon.Source = new BitmapImage(new Uri("/Interpic.UI;component/Icons/FailRed.png", UriKind.RelativeOrAbsolute));
                            TaskToExecute.FireCanceledEvent(this);
                        }
                    }

                    if (taskCounter == TasksToExecute.Count - 1)
                    {
                        if (TasksToExecute.Any(task => task.IsCanceled == true))
                        {
                            WarningAlert.Show("One or more tasks where canceled!");
                        }
                        complete = true;
                        Close();
                    }
                }
                else
                {
                    if (taskCounter == TasksToExecute.Count - 1)
                    {
                        if (TasksToExecute.Any(task => task.IsCanceled == true))
                        {
                            WarningAlert.Show("One or more tasks where canceled!");
                        }
                        complete = true;
                        Close();
                    }
                }
            }
        }
示例#5
0
 private bool AskUserPermissionForPackage(string path, Extension requestingExtension)
 {
     return(ConfirmAlert.Show("Extension " + requestingExtension.GetName() + " wants to load the following package:\n\n" + path + "\n\n" + "Press OK to load the assembly", true).Result);
 }