using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using Tango.SharedUI; namespace Tango.Scripting.IDE.Notifications { /// /// Represents the IDE notification manager. /// public interface INotificationManager { /// /// Displays the specified TView as a dialog and TViewModel as it's data context. /// /// The type of the view model. /// The type of the view. /// The view model. /// The view. /// Task ShowDialog(TViewModel viewModel, TView view) where TViewModel : IDEDialogViewModel where TView : FrameworkElement; /// /// Finds (by convention )the appropriate view by the specified TViewModel name. /// The search pattern is ViewVM - VM + View. /// /// The type of the view model. /// The view model. /// Task ShowDialog(TViewModel viewModel) where TViewModel : IDEDialogViewModel; /// /// Finds (by convention )the appropriate view by the specified TViewModel name. /// The search pattern is ViewVM - VM + View. /// The view model instance will be created automatically and must contain a parameterless constructor. /// /// The type of the view model. /// The view model. /// Task ShowDialog() where TViewModel : IDEDialogViewModel; /// /// Displays an error message. /// /// The title. /// The message. /// Task ShowError(String title, String message); /// /// Displays an error message. /// /// The title. /// The message. /// Task ShowInfo(String title, String message); /// /// Displays a warning message. /// /// The title. /// The message. /// Task ShowWarning(String title, String message); /// /// Displays a positive message. /// /// The title. /// The message. /// Task ShowSuccess(String title, String message); /// /// Displays a question and returns the result. /// /// The title. /// The message. /// Task ShowQuestion(String title, String message); /// /// Displays an intermediate progress dialog and returns an instance of . /// Once the progress notification handler will be disposed the dialog will close. /// /// The title. /// The message. /// if set to true the dialog will contain a cancel button. /// ProgressNotificationHandler ShowProgress(String title, String message, bool canCancel = false); } }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
using Tango.Core.ExtensionMethods;

namespace Tango.MachineStudio.Statistics.Models
{
    public class JobRunStatisticsModel : JobRun
    {
        private static Dictionary<String, Machine> _machines = new Dictionary<string, Machine>();

        public JobRunStatisticsModel()
        {

        }

        public JobRunStatisticsModel(JobRun run)
        {
            run.MapPropertiesTo(this, MappingFlags.NoReferenceTypes);
        }

        public Task LoadMachine(ObservablesContext context)
        {
            return Task.Factory.StartNew(() =>
            {
                if (!_machines.ContainsKey(MachineGuid))
                {
                    Machine = context.Machines.SingleOrDefault(x => x.Guid == MachineGuid);
                    _machines.Add(MachineGuid, Machine);
                }
                else
                {
                    Machine = _machines[MachineGuid];
                }
            });
        }

        public Machine Machine { get; set; }
    }
}