/// <summary>
        /// Initializes a new instance of the <see cref="DatasetDetailModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="progressTracker">The object that handles the progress notifications for the applications.</param>
        /// <param name="project">The project that holds all the data.</param>
        /// <param name="dataset">The dataset.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="progressTracker"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="project"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="dataset"/> is <see langword="null" />.
        /// </exception>
        public DatasetDetailModel(IContextAware context, ITrackSteppingProgress progressTracker, ILinkToProjects project, DatasetFacade dataset)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => progressTracker);
                Lokad.Enforce.Argument(() => project);
                Lokad.Enforce.Argument(() => dataset);
            }

            m_ProgressTracker        = progressTracker;
            m_Project                = project;
            m_Dataset                = dataset;
            m_Dataset.OnNameChanged += (s, e) =>
            {
                Notify(() => Name);
                Notify(() => DisplayName);
            };
            m_Dataset.OnSummaryChanged          += (s, e) => Notify(() => Summary);
            m_Dataset.OnProgressOfCurrentAction += HandleDatasetProgress;
            m_Dataset.OnDeactivated             += (s, e) =>
            {
                Notify(() => IsActivated);
                Notify(() => Endpoint);
                RaiseOnDeactivated();
            };
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetGraphModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="facade">The project that holds the graph of datasets.</param>
        /// <param name="datasetModelBuilder">The function that builds <see cref="DatasetModel"/> objects.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="facade"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="datasetModelBuilder"/> is <see langword="null" />.
        /// </exception>
        public DatasetGraphModel(
            IContextAware context,
            ProjectFacade facade,
            Func <DatasetFacade, DatasetModel> datasetModelBuilder)
            : base(context)
        {
            {
                Enforce.Argument(() => facade);
            }

            m_Project = facade;
            m_Project.OnDatasetCreated += (s, e) => AddDatasetToGraph();
            m_Project.OnDatasetDeleted += (s, e) => RemoveDatasetFromGraph();

            m_DatasetModelBuilder = datasetModelBuilder;

            LayoutType       = "Tree";
            LayoutParameters = new SimpleTreeLayoutParameters
            {
                LayerGap  = 250,
                VertexGap = 250,
                Direction = LayoutDirection.TopToBottom,
            };

            ReloadProject();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetGraphModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="facade">The project that holds the graph of datasets.</param>
        /// <param name="datasetModelBuilder">The function that builds <see cref="DatasetModel"/> objects.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="facade"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="datasetModelBuilder"/> is <see langword="null" />.
        /// </exception>
        public DatasetGraphModel(
            IContextAware context,
            ProjectFacade facade,
            Func<DatasetFacade, DatasetModel> datasetModelBuilder)
            : base(context)
        {
            {
                Enforce.Argument(() => facade);
            }

            m_Project = facade;
            m_Project.OnDatasetCreated += (s, e) => AddDatasetToGraph();
            m_Project.OnDatasetDeleted += (s, e) => RemoveDatasetFromGraph();

            m_DatasetModelBuilder = datasetModelBuilder;

            LayoutType = "Tree";
            LayoutParameters = new SimpleTreeLayoutParameters
                {
                    LayerGap = 250,
                    VertexGap = 250,
                    Direction = LayoutDirection.TopToBottom,
                };

            ReloadProject();
        }
Exemple #4
0
 private ICommand CreateCloseCommand(IContextAware context)
 {
     return(m_Container.Resolve <CloseViewCommand>(
                new TypedParameter(typeof(IEventAggregator), m_Container.Resolve <IEventAggregator>()),
                new TypedParameter(typeof(string), CommonRegionNames.Content),
                new TypedParameter(typeof(Parameter), new WelcomeParameter(context))));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetDetailModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="progressTracker">The object that handles the progress notifications for the applications.</param>
        /// <param name="project">The project that holds all the data.</param>
        /// <param name="dataset">The dataset.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="progressTracker"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="project"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="dataset"/> is <see langword="null" />.
        /// </exception>
        public DatasetDetailModel(IContextAware context, ITrackSteppingProgress progressTracker, ILinkToProjects project, DatasetFacade dataset)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => progressTracker);
                Lokad.Enforce.Argument(() => project);
                Lokad.Enforce.Argument(() => dataset);
            }

            m_ProgressTracker = progressTracker;
            m_Project = project;
            m_Dataset = dataset;
            m_Dataset.OnNameChanged += (s, e) =>
                {
                    Notify(() => Name);
                    Notify(() => DisplayName);
                };
            m_Dataset.OnSummaryChanged += (s, e) => Notify(() => Summary);
            m_Dataset.OnProgressOfCurrentAction += HandleDatasetProgress;
            m_Dataset.OnDeactivated += (s, e) =>
                {
                    Notify(() => IsActivated);
                    Notify(() => Endpoint);
                    RaiseOnDeactivated();
                };
        }
 /// <summary>
 /// Creates and stores the collection of known script languages.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 public static void StoreKnownLanguages(IContextAware context)
 {
     s_AvailableLanguages = new ObservableCollection <ScriptDescriptionModel>
     {
         new ScriptDescriptionModel(context, ScriptLanguage.IronPython),
         new ScriptDescriptionModel(context, ScriptLanguage.IronRuby),
     };
 }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Observable"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        protected Observable(IContextAware context)
        {
            {
                Enforce.Argument(() => context);
            }

            m_Context = context;
        }
 /// <summary>
 /// Creates and stores the collection of known script languages.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 public static void StoreKnownLanguages(IContextAware context)
 {
     s_AvailableLanguages = new ObservableCollection<ScriptDescriptionModel>
         {
             new ScriptDescriptionModel(context, ScriptLanguage.IronPython),
             new ScriptDescriptionModel(context, ScriptLanguage.IronRuby),
         };
 }
 /// <summary>
 /// Called when the command is executed.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <param name="eventAggregator">The event aggregator.</param>
 private static void ShowTab(IContextAware context, IEventAggregator eventAggregator)
 {
     eventAggregator.GetEvent <ShowViewEvent>().Publish(
         new ShowViewRequest(
             typeof(ProjectPresenter),
             CommonRegionNames.Content,
             new ProjectParameter(context)));
 }
Exemple #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Observable"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        protected Observable(IContextAware context)
        {
            {
                Enforce.Argument(() => context);
            }

            m_Context = context;
        }
Exemple #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="closeCommand">The command that closes the current project.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="closeCommand"/> is <see langword="null" />.
        /// </exception>
        public ProjectModel(IContextAware context, ICommand closeCommand)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => closeCommand);
            }

            CloseCommand = closeCommand;
        }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WelcomeModel"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public WelcomeModel(IContextAware context)
     : base(context)
 {
     var collection = new MostRecentlyUsedCollection();
     foreach (var mru in collection)
     {
         m_Mru.Add(new MostRecentlyUsedModel(context, mru));
     }
 }
Exemple #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="closeCommand">The command that closes the current project.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="closeCommand"/> is <see langword="null" />.
        /// </exception>
        public ProjectModel(IContextAware context, ICommand closeCommand)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => closeCommand);
            }

            CloseCommand = closeCommand;
        }
        public void SetContextAware(object value)
        {
            IContextAware contextAware = value as IContextAware;

            if (contextAware != null)
            {
                contextAware.Context = this;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MostRecentlyUsedModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="mostRecentlyUsed">The object that stores information about a most recently used file.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="mostRecentlyUsed"/> is <see langword="null" />.
        /// </exception>
        public MostRecentlyUsedModel(IContextAware context, MostRecentlyUsed mostRecentlyUsed)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => mostRecentlyUsed);
            }

            m_Mru = mostRecentlyUsed;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetDetailParameter"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="dataset">The dataset that should be passed to the presenter.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="dataset"/> is <see langword="null" />.
        /// </exception>
        public DatasetDetailParameter(IContextAware context, DatasetFacade dataset)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => dataset);
            }

            m_Dataset = dataset;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetDetailParameter"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="dataset">The dataset that should be passed to the presenter.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="dataset"/> is <see langword="null" />.
        /// </exception>
        public DatasetDetailParameter(IContextAware context, DatasetFacade dataset)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => dataset);
            }

            m_Dataset = dataset;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MostRecentlyUsedModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="mostRecentlyUsed">The object that stores information about a most recently used file.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="mostRecentlyUsed"/> is <see langword="null" />.
        /// </exception>
        public MostRecentlyUsedModel(IContextAware context, MostRecentlyUsed mostRecentlyUsed)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => mostRecentlyUsed);
            }

            m_Mru = mostRecentlyUsed;
        }
Exemple #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="notificationCollector">The object that collects notifications from all over the system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="notificationCollector"/> is <see langword="null" />.
        /// </exception>
        public NotificationModel(IContextAware context, ICollectNotifications notificationCollector)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => notificationCollector);
            }

            m_Notifications = notificationCollector;
            m_Notifications.OnNotification += (s, e) => Notification = e.Notification;
        }
Exemple #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfileModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="storage">The object that stores all the known timing reports.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="storage"/> is <see langword="null" />.
        /// </exception>
        public ProfileModel(IContextAware context, TimingReportCollection storage)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => storage);
            }

            m_Storage        = storage;
            m_ReadonlySource = CollectionViewSource.GetDefaultView(m_Storage);
        }
 /// <summary>
 /// Called when the command is executed.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <param name="eventAggregator">The event aggregator.</param>
 private static void OnExecute(IContextAware context, IEventAggregator eventAggregator)
 {
     eventAggregator.GetEvent <ShowViewEvent>().Publish(
         new ShowViewRequest(
             typeof(AboutPresenter),
             "AboutWindow",
             new AboutParameter(context),
             null,
             true));
 }
Exemple #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WelcomeModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        public WelcomeModel(IContextAware context)
            : base(context)
        {
            var collection = new MostRecentlyUsedCollection();

            foreach (var mru in collection)
            {
                m_Mru.Add(new MostRecentlyUsedModel(context, mru));
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="notificationCollector">The object that collects notifications from all over the system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="notificationCollector"/> is <see langword="null" />.
        /// </exception>
        public NotificationModel(IContextAware context, ICollectNotifications notificationCollector)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => notificationCollector);
            }

            m_Notifications = notificationCollector;
            m_Notifications.OnNotification += (s, e) => Notification = e.Notification;
        }
Exemple #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfileModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="storage">The object that stores all the known timing reports.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="storage"/> is <see langword="null" />.
        /// </exception>
        public ProfileModel(IContextAware context, TimingReportCollection storage)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => storage);
            }

            m_Storage = storage;
            m_ReadonlySource = CollectionViewSource.GetDefaultView(m_Storage);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetViewVertex"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="model">The model of the dataset.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="model"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        public DatasetViewVertex(IContextAware context, DatasetModel model)
            : base(context)
        {
            {
                Enforce.Argument(() => model);
            }

            m_Dataset = model;
            m_Dataset.OnActivated += (s, e) => Notify(() => IsDatasetActivated);
            m_Dataset.OnDeactivated += (s, e) => Notify(() => IsDatasetActivated);
        }
Exemple #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FeedbackModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="sendReportsCommand">The command that is used to send the feedback reports to the remote server.</param>
        /// <param name="builders">The function that is used to create new report builders.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="sendReportsCommand"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="builders"/> is <see langword="null" />.
        /// </exception>
        public FeedbackModel(IContextAware context, ICommand sendReportsCommand, Func<IBuildReports> builders)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => sendReportsCommand);
                Lokad.Enforce.Argument(() => builders);
            }

            m_SendReportsCommand = sendReportsCommand;
            m_Builders = builders;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FeedbackFileModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="path">The path to the file that contains the feedback file.</param>
        /// <param name="date">The date on which the feedback report was generated.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="path"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     Thrown if <paramref name="path"/> is an empty string.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        public FeedbackFileModel(IContextAware context, string path, DateTimeOffset date)
            : base(context)
        {
            {
                Enforce.Argument(() => path);
                Enforce.Argument(() => path, StringIs.NotEmpty);
            }

            m_FilePath   = path;
            m_ReportDate = date;
        }
Exemple #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FeedbackModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="sendReportsCommand">The command that is used to send the feedback reports to the remote server.</param>
        /// <param name="builders">The function that is used to create new report builders.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="sendReportsCommand"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="builders"/> is <see langword="null" />.
        /// </exception>
        public FeedbackModel(IContextAware context, ICommand sendReportsCommand, Func <IBuildReports> builders)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => sendReportsCommand);
                Lokad.Enforce.Argument(() => builders);
            }

            m_SendReportsCommand = sendReportsCommand;
            m_Builders           = builders;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetViewVertex"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="model">The model of the dataset.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="model"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        public DatasetViewVertex(IContextAware context, DatasetModel model)
            : base(context)
        {
            {
                Enforce.Argument(() => model);
            }

            m_Dataset                = model;
            m_Dataset.OnActivated   += (s, e) => Notify(() => IsDatasetActivated);
            m_Dataset.OnDeactivated += (s, e) => Notify(() => IsDatasetActivated);
        }
Exemple #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgressModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="progressReporter">The object that provides progress notifications for all the processes.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="progressReporter"/> is <see langword="null" />.
        /// </exception>
        public ProgressModel(IContextAware context, ICollectProgressReports progressReporter)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => progressReporter);
            }

            m_Reporter = progressReporter;
            m_Reporter.OnStartProgress += HandleOnStartProgress;
            m_Reporter.OnProgress      += HandleOnProgress;
            m_Reporter.OnStopProgress  += HandleOnStopProgress;
        }
Exemple #31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgressModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="progressReporter">The object that provides progress notifications for all the processes.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="progressReporter"/> is <see langword="null" />.
        /// </exception>
        public ProgressModel(IContextAware context, ICollectProgressReports progressReporter)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => progressReporter);
            }

            m_Reporter = progressReporter;
            m_Reporter.OnStartProgress += HandleOnStartProgress;
            m_Reporter.OnProgress += HandleOnProgress;
            m_Reporter.OnStopProgress += HandleOnStopProgress;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectDescriptionModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="facade">The project that holds all the data.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="facade"/> is <see langword="null" />.
        /// </exception>
        public ProjectDescriptionModel(IContextAware context, ProjectFacade facade)
            : base(context)
        {
            {
                Enforce.Argument(() => facade);
            }

            m_Project = facade;
            m_Project.OnNameChanged += (s, e) => Notify(() => Name);
            m_Project.OnSummaryChanged += (s, e) => Notify(() => Summary);
            m_Project.OnDatasetCreated += (s, e) => Notify(() => NumberOfDatasets);
            m_Project.OnDatasetDeleted += (s, e) => Notify(() => NumberOfDatasets);
        }
Exemple #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectDescriptionModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="facade">The project that holds all the data.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="facade"/> is <see langword="null" />.
        /// </exception>
        public ProjectDescriptionModel(IContextAware context, ProjectFacade facade)
            : base(context)
        {
            {
                Enforce.Argument(() => facade);
            }

            m_Project = facade;
            m_Project.OnNameChanged    += (s, e) => Notify(() => Name);
            m_Project.OnSummaryChanged += (s, e) => Notify(() => Summary);
            m_Project.OnDatasetCreated += (s, e) => Notify(() => NumberOfDatasets);
            m_Project.OnDatasetDeleted += (s, e) => Notify(() => NumberOfDatasets);
        }
Exemple #34
0
        private static bool AssertCompatible(ReflectedProperty reflectedProperty, Type newContextType)
        {
            IContextAware aware = reflectedProperty.Value as IContextAware;

            if (aware != null)
            {
                if (!aware.GetContextType().IsAssignableFrom(newContextType))
                {
                    Debug.Log($"Not compatible! {aware.GetContextType().Name} & {newContextType.Name}");
                    return(false);
                }
            }
            return(true);
        }
Exemple #35
0
        /// <summary>
        /// Shows the dataset detail view.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="dataset">The dataset.</param>
        private static void OnShow(IContextAware context, IEventAggregator eventAggregator, DatasetFacade dataset)
        {
            // If there is no facade then we're in design mode or something
            // else weird.
            if (dataset == null)
            {
                return;
            }

            eventAggregator.GetEvent <ShowViewEvent>().Publish(
                new ShowViewRequest(
                    typeof(DatasetDetailPresenter),
                    CommonRegionNames.Content,
                    new DatasetDetailParameter(context, dataset)));
        }
Exemple #36
0
        private IEnumerable <By> GetReturnRelevantBys(ISearchContext context)
        {
            IWebDriver driver = WebDriverUnpackUtility.UnpackWebdriver(context);

            if (!typeof(IContextAware).IsAssignableFrom(driver.GetType())) //it is desktop browser
            {
                return(map[ContentTypes.HTML]);
            }

            IContextAware contextAware   = driver as IContextAware;
            string        currentContext = contextAware.Context;

            if (currentContext.Contains(NATIVE_APP_PATTERN))
            {
                return(map[ContentTypes.NATIVE]);
            }

            return(map[ContentTypes.HTML]);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorReportsModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="sendReportsCommand">The command that is used to send the feedback reports to the remote server.</param>
        /// <param name="feedbackCollector">The object that collects the feedback reports that have been stored on the disk.</param>
        /// <param name="fileSystem">The object that provides access to the file system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="sendReportsCommand"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="feedbackCollector"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="fileSystem"/> is <see langword="null" />.
        /// </exception>
        public ErrorReportsModel(
            IContextAware context,
            ICommand sendReportsCommand,
            ICollectFeedbackReports feedbackCollector,
            IFileSystem fileSystem)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => sendReportsCommand);
                Lokad.Enforce.Argument(() => feedbackCollector);
                Lokad.Enforce.Argument(() => fileSystem);
            }

            SendReportsCommand  = sendReportsCommand;
            m_FeedbackCollector = feedbackCollector;
            m_FileSystem        = fileSystem;

            RelocateReports();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorReportsModel"/> class.
        /// </summary>
        /// <param name="context">The context that is used to execute actions on the UI thread.</param>
        /// <param name="sendReportsCommand">The command that is used to send the feedback reports to the remote server.</param>
        /// <param name="feedbackCollector">The object that collects the feedback reports that have been stored on the disk.</param>
        /// <param name="fileSystem">The object that provides access to the file system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="sendReportsCommand"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="feedbackCollector"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="fileSystem"/> is <see langword="null" />.
        /// </exception>
        public ErrorReportsModel(
            IContextAware context,
            ICommand sendReportsCommand,
            ICollectFeedbackReports feedbackCollector,
            IFileSystem fileSystem)
            : base(context)
        {
            {
                Lokad.Enforce.Argument(() => sendReportsCommand);
                Lokad.Enforce.Argument(() => feedbackCollector);
                Lokad.Enforce.Argument(() => fileSystem);
            }

            SendReportsCommand = sendReportsCommand;
            m_FeedbackCollector = feedbackCollector;
            m_FileSystem = fileSystem;

            RelocateReports();
        }
        public MachineSelectorModel(
            IContextAware context,
            IEnumerable<DistributionSuggestion> suggestions,
            TaskScheduler scheduler = null)
            : base(context)
        {
            {
                Enforce.Argument(() => suggestions);
            }

            Action action =
                () =>
                {
                    IsLoading = true;
                    foreach (var suggestion in suggestions)
                    {
                        var temp = suggestion;
                        if (context.IsSynchronized)
                        {
                            m_Proposals.Add(temp);
                        }
                        else
                        {
                            context.Invoke(() => m_Proposals.Add(temp));
                        }
                    }

                    IsLoading = false;
                };

            Task.Factory.StartNew(
                action,
                new CancellationToken(),
                TaskCreationOptions.LongRunning,
                scheduler ?? TaskScheduler.Default);
        }
Exemple #40
0
        public MachineSelectorModel(
            IContextAware context,
            IEnumerable <DistributionSuggestion> suggestions,
            TaskScheduler scheduler = null)
            : base(context)
        {
            {
                Enforce.Argument(() => suggestions);
            }

            Action action =
                () =>
            {
                IsLoading = true;
                foreach (var suggestion in suggestions)
                {
                    var temp = suggestion;
                    if (context.IsSynchronized)
                    {
                        m_Proposals.Add(temp);
                    }
                    else
                    {
                        context.Invoke(() => m_Proposals.Add(temp));
                    }
                }

                IsLoading = false;
            };

            Task.Factory.StartNew(
                action,
                new CancellationToken(),
                TaskCreationOptions.LongRunning,
                scheduler ?? TaskScheduler.Default);
        }
Exemple #41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuModel"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public MenuModel(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowAboutWindowCommand"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <param name="eventAggregator">The event aggregator.</param>
 public ShowAboutWindowCommand(IContextAware context, IEventAggregator eventAggregator)
     : base(obj => OnExecute(context, eventAggregator))
 {
 }
Exemple #43
0
 public ContextAwareBase(IContextAware declareOrigin)
 {
     DeclaredOrigin = declareOrigin;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ScriptParameter(IContextAware context)
     : base(context)
 {
 }
Exemple #45
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShellParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ShellParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MachineSelectorParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <param name="suggestions">The collection of suggestions.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public MachineSelectorParameter(IContextAware context, IEnumerable<DistributionSuggestion> suggestions)
     : base(context)
 {
     Suggestions = suggestions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowViewEventListener"/> class.
 /// </summary>
 /// <param name="container">The IOC container.</param>
 /// <param name="dispatcherContext">The dispatcher context.</param>
 public ShowViewEventListener(IDependencyInjectionProxy container, IContextAware dispatcherContext)
     : base(container, dispatcherContext)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowProjectsTabCommand"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <param name="projectFacade">
 ///     The object that contains the methods that allow interaction
 ///     with the project system.
 /// </param>
 /// <param name="eventAggregator">The event aggregator.</param>
 public ShowProjectsTabCommand(IContextAware context, ILinkToProjects projectFacade, IEventAggregator eventAggregator)
     : base(obj => ShowTab(context, eventAggregator), obj => CanShowTab(projectFacade))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProjectDescriptionParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ProjectDescriptionParameter(IContextAware context)
     : base(context)
 {
 }
Exemple #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventListener"/> class.
 /// </summary>
 /// <param name="container">The IOC container.</param>
 /// <param name="dispatcherContext">The dispatcher context.</param>
 protected EventListener(IDependencyInjectionProxy container, IContextAware dispatcherContext)
 {
     m_Container = container;
     m_Context = dispatcherContext;
 }
Exemple #51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StatusBarModel"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public StatusBarModel(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WelcomeParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public WelcomeParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectScriptLanguageParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public SelectScriptLanguageParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProgressParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ProgressParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProfileParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ProfileParameter(IContextAware context)
     : base(context)
 {
 }
Exemple #56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProjectParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ProjectParameter(IContextAware context)
     : base(context)
 {
 }
Exemple #57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AboutParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public AboutParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProjectParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ProjectParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectScriptLanguageParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public SelectScriptLanguageParameter(IContextAware context)
     : base(context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorReportsParameter"/> class.
 /// </summary>
 /// <param name="context">The context that is used to execute actions on the UI thread.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="context"/> is <see langword="null" />.
 /// </exception>
 public ErrorReportsParameter(IContextAware context)
     : base(context)
 {
 }