Exemple #1
0
 internal void OnRequestTaskDialog(object sender, TaskDialogEventArgs args)
 {
     if (RequestTaskDialog != null)
     {
         RequestTaskDialog(sender, args);
     }
 }
Exemple #2
0
        /// <summary>
        /// Displays file open error dialog if the file is of a future version than the currently installed version
        /// </summary>
        /// <param name="fullFilePath"></param>
        /// <param name="fileVersion"></param>
        /// <param name="currVersion"></param>
        /// <returns> true if the file must be opened and false otherwise </returns>
        private bool DisplayFutureFileMessage(string fullFilePath, Version fileVersion, Version currVersion)
        {
            var fileVer = ((fileVersion != null) ? fileVersion.ToString() : Resources.UnknownVersion);
            var currVer = ((currVersion != null) ? currVersion.ToString() : Resources.UnknownVersion);

            Logging.Analytics.LogPiiInfo("FutureFileMessage", fullFilePath +
                " :: fileVersion:" + fileVer + " :: currVersion:" + currVer);

            string summary = Resources.FutureFileSummary;
            var description = string.Format(Resources.FutureFileDescription, fullFilePath, fileVersion, currVersion);

            const string imageUri = "/DynamoCoreWpf;component/UI/Images/task_dialog_future_file.png";
            var args = new TaskDialogEventArgs(
                new Uri(imageUri, UriKind.Relative),
                Resources.FutureFileTitle, summary, description) { ClickedButtonId = (int)ButtonId.Cancel };

            args.AddRightAlignedButton((int)ButtonId.Cancel, Resources.CancelButton);
            args.AddRightAlignedButton((int)ButtonId.DownloadLatest, Resources.DownloadLatestButton);
            args.AddRightAlignedButton((int)ButtonId.Proceed, Resources.ProceedButton);

            OnRequestTaskDialog(null, args);
            if (args.ClickedButtonId == (int)ButtonId.DownloadLatest)
            {
                // this should be an event on DynamoModel
                OnRequestDownloadDynamo();
                return false;
            }

            return args.ClickedButtonId == (int)ButtonId.Proceed;
        }
Exemple #3
0
        /// <summary>
        /// Call this method to display an error message in an event when live
        /// runner throws an exception that is not handled anywhere else. This
        /// message instructs user to save their work and restart Dynamo.
        /// </summary>
        /// <param name="exception">The exception to display.</param>
        private TaskDialogEventArgs DisplayEngineFailureMessage(Exception exception)
        {
            Dynamo.Logging.Analytics.TrackEvent(Actions.EngineFailure, Categories.Stability);

            if (exception != null)
            {
                Dynamo.Logging.Analytics.TrackException(exception, false);
            }

            string summary = Resources.UnhandledExceptionSummary;

            string description = Resources.DisplayEngineFailureMessageDescription;

            const string imageUri = "/DynamoCoreWpf;component/UI/Images/task_dialog_crash.png";
            var args = new TaskDialogEventArgs(
                new Uri(imageUri, UriKind.Relative),
                Resources.UnhandledExceptionTitle,
                summary,
                description);

            args.AddRightAlignedButton((int)ButtonId.Submit, Resources.SubmitBugButton);
            args.AddRightAlignedButton((int)ButtonId.Ok, Resources.ArggOKButton);
            args.Exception = exception;

            OnRequestTaskDialog(null, args);
            if (args.ClickedButtonId == (int)ButtonId.Submit)
                OnRequestBugReport();

            return args;
        }
Exemple #4
0
        /// <summary>
        /// Call this method to display a message box when a file of an older
        /// version cannot be opened by the current version of Dynamo.
        /// </summary>
        /// <param name="fullFilePath"></param>
        /// <param name="fileVersion">Version of the input file.</param>
        /// <param name="currVersion">Current version of the Dynamo.</param>
        private void DisplayObsoleteFileMessage(string fullFilePath, Version fileVersion, Version currVersion)
        {
            var fileVer = ((fileVersion != null) ? fileVersion.ToString() : "Unknown");
            var currVer = ((currVersion != null) ? currVersion.ToString() : "Unknown");

            Logging.Analytics.LogPiiInfo(
                "ObsoleteFileMessage",
                fullFilePath + " :: fileVersion:" + fileVer + " :: currVersion:" + currVer);

            string summary = Resources.FileCannotBeOpened;
            var description =
                string.Format(
                    Resources.ObsoleteFileDescription,
                    fullFilePath,
                    fileVersion,
                    currVersion);

            const string imageUri = "/DynamoCoreWpf;component/UI/Images/task_dialog_obsolete_file.png";
            var args = new TaskDialogEventArgs(
                new Uri(imageUri, UriKind.Relative),
                Resources.ObsoleteFileTitle,
                summary,
                description);

            args.AddRightAlignedButton((int)ButtonId.Ok, Resources.OKButton);

            OnRequestTaskDialog(null, args);
        }
 void Controller_RequestTaskDialog(object sender, TaskDialogEventArgs e)
 {
     var taskDialog = new UI.Prompts.GenericTaskDialog(e);
     taskDialog.ShowDialog();
 }
Exemple #6
0
        /// <summary>
        /// Call this method to display an error message in an event when live 
        /// runner throws an exception that is not handled anywhere else. This 
        /// message instructs user to save their work and restart Dynamo.
        /// </summary>
        /// <param name="exception">The exception to display.</param>
        private TaskDialogEventArgs DisplayEngineFailureMessage(Exception exception)
        {
            StabilityTracking.GetInstance().NotifyCrash();
            InstrumentationLogger.LogAnonymousEvent("EngineFailure", "Stability");

            if (exception != null)
            {
                InstrumentationLogger.LogException(exception);
            }

            string summary = Resources.UnhandledExceptionSummary;

            string description = (exception is HeapCorruptionException)
                ? exception.Message
                : Resources.DisplayEngineFailureMessageDescription;

            const string imageUri = "/DynamoCoreWpf;component/UI/Images/task_dialog_crash.png";
            var args = new TaskDialogEventArgs(
                new Uri(imageUri, UriKind.Relative),
                Resources.UnhandledExceptionTitle,
                summary,
                description);

            args.AddRightAlignedButton((int)ButtonId.Submit, Resources.SubmitBugButton);
            args.AddRightAlignedButton((int)ButtonId.Ok, Resources.ArggOKButton);
            args.Exception = exception;

            OnRequestTaskDialog(null, args);
            if (args.ClickedButtonId == (int)ButtonId.Submit)
                OnRequestBugReport();

            return args;
        }
 internal void OnRequestTaskDialog(object sender, TaskDialogEventArgs args)
 {
     if (RequestTaskDialog != null)
         RequestTaskDialog(sender, args);
 }