Esempio n. 1
0
 /// <summary>
 /// For each item in a list, close it, and if its parent is set to the given parent, clear that parent
 /// </summary>
 /// <typeparam name="T">Type of conductor</typeparam>
 /// <param name="parent">Parent</param>
 /// <param name="items">List of items to close and clean up</param>
 /// <param name="dispose">True to dispose children as well as close them</param>
 public static void CloseAndCleanUp <T>(this IConductor <T> parent, IEnumerable items, bool dispose)
 {
     foreach (var item in items.OfType <T>())
     {
         parent.CloseAndCleanUp(item, dispose);
     }
 }
Esempio n. 2
0
 public ConductorValidator(IConductor conductor)
 {
     if (conductor == null)
     {
         throw new ArgumentNullException("conductor");
     }
     _Conductor = conductor;
 }
Esempio n. 3
0
        public DetalleConductor(int idConductorSeleccionado, IConductor itActualizar)
        {
            InitializeComponent();
            this.idConductorSeleccionado = idConductorSeleccionado;
            llenarTablaVehiculos();
            llenarInformacion();

            this.itActualizar = itActualizar;
        }
 public AgregarConductor(int idConductor, IConductor itActualizar)
 {
     InitializeComponent();
     this.idConductor = idConductor;
     if (idConductor > 0)
     {
         CargarConductores();
     }
     this.itActualizar = itActualizar;
 }
 public bool Equals(IConductor <T> other)
 {
     if (other != null && other.HasValue)
     {
         return(this.Equals(other.Value));
     }
     else
     {
         return(!this.HasValue);
     }
 }
        public FinaleQuizVragenViewModel(ShellViewModel conductor, SimpleContainer container)
        {
            this.conductor = conductor;
            this.container = container;

            QuizVraagViewModelFactory = vraagCode =>
            {
                var vraag = Util.GetVraagFromCode(vraagCode);
                return(new QuizVraagViewModel(vraag, vraagCode));
            };
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of <see cref="Trigger"/>
 /// </summary>
 /// <param name="serializer">The <see cref="ISerializer"/> to use for deserialization of configuration and payloads</param>
 /// <param name="conductor">The <see cref="IConductor"/> of the score></param>
 /// <param name="logger">The <see cref="ILogger"/> used for logging</param>
 /// <param name="scoreConfigurator">The <see cref="IScoreConfigurator"/> for configuring the score</param>
 public Trigger(
     ISerializer serializer,
     IConductor conductor,
     ILogger logger,
     IScoreConfigurator scoreConfigurator)
 {
     _serializer        = serializer;
     _conductor         = conductor;
     _logger            = logger;
     _scoreConfigurator = scoreConfigurator;
 }
Esempio n. 8
0
        public void Show()
        {
            IConductor conductor = this.Parent as IConductor;

            if (conductor == null)
            {
                return;
            }

            conductor.ActivateItem(this);
        }
Esempio n. 9
0
 public TestWorker(
     IBuilder <Report> reportBuilder,
     IConfigurationService configurationService,
     IConductor conductor,
     IReportRender reportRender,
     IRepository <Report> reportRepository)
 {
     _reportBuilder        = reportBuilder;
     _configurationService = configurationService;
     _conductor            = conductor;
     _reportRender         = reportRender;
     _reportRepository     = reportRepository;
 }
Esempio n. 10
0
        private IEnumerable <IResult> ActivateItem(IConductor parent, TItem item)
        {
            if (OpenResult.BeforeActivation != null)
            {
                yield return(new SequentialResult(OpenResult.BeforeActivation(item).GetEnumerator()));
            }

            yield return(new DelegateResult(() => parent.ActivateItem(item)));

            if (OpenResult.AfterActivation != null)
            {
                yield return(new SequentialResult(OpenResult.AfterActivation(item).GetEnumerator()));
            }
        }
Esempio n. 11
0
        public UIMain(IConductor conductor, IDesigner designer)
        {
            // TODO: This should move into the Designer.
            AgentBlueprint = new AgentBlueprint();
            AgentBlueprint.Brain.Regions.Add(new Region
            {
                Location = new PointF(100, 100)
            });

            FileStatus = new FileStatus();
            Conductor  = conductor;
            Designer   = designer;
            Observers  = new HashSet <ObserverHandle>();

            Designer.BlueprintChanged += DesignerOnBlueprintChanged;
        }
Esempio n. 12
0
        public override void Execute(ActionExecutionContext context)
        {
            IConductor conductor = _locateConductor(context);
            TItem      item      = _locateItem(context);

            if (_initialize != null)
            {
                _initialize(item);
            }

            AddCloseHandlers(item, context);

            Coroutine.BeginExecute(ActivateItem(conductor, item).GetEnumerator(),
                                   context,
                                   (sender, args) => OnCompleted(args.Error, args.WasCancelled));
        }
Esempio n. 13
0
        /// <summary>
        /// Close an item, and clear its parent if it's set to the current parent
        /// </summary>
        /// <typeparam name="T">Type of conductor</typeparam>
        /// <param name="parent">Parent</param>
        /// <param name="item">Item to close and clean up</param>
        /// <param name="dispose">True to dispose children as well as close them</param>
        public static void CloseAndCleanUp <T>(this IConductor <T> parent, T item, bool dispose)
        {
            ScreenExtensions.TryClose(item);

            var itemAsChild = item as IChild;

            if (itemAsChild != null && itemAsChild.Parent == parent)
            {
                itemAsChild.Parent = null;
            }

            if (dispose)
            {
                ScreenExtensions.TryDispose(item);
            }
        }
Esempio n. 14
0
        public Scene(GLControl glControl, UIMain uiMain)
        {
            m_control   = glControl;
            m_uiMain    = uiMain;
            m_conductor = m_uiMain.Conductor;
            m_conductor.ModelProvider.ModelUpdated += OnModelUpdated;

            m_camera = new Camera
            {
                Position    = new Vector3(5, 100, 100),
                Orientation = new Vector3((float)Math.PI, (float)(-Math.PI / 4), 0)
            };

            m_gridModel = new GridModel(GridWidth, GridDepth, GridCellSize);

            //InjectCamera();
        }
        public void Execute(ActionExecutionContext context)
        {
            if (_locateParent == null)
            {
                _locateParent = c => (IConductor)c.Target;
            }

            IConductor parent = _locateParent(context);
            TChild     child  = _locateChild(context);

            if (_onConfigure != null)
            {
                _onConfigure(child);
            }

            parent.ActivateItem(child);
            Completed(this, new ResultCompletionEventArgs());
        }
Esempio n. 16
0
        /// <summary>
        /// For each item in a list, set the parent to the current conductor
        /// </summary>
        /// <typeparam name="T">Type of conductor</typeparam>
        /// <param name="parent">Parent to set the items' parent to</param>
        /// <param name="items">Items to manipulate</param>
        /// <param name="active">True to active the item, false to deactive it</param>
        public static void SetParentAndSetActive <T>(this IConductor <T> parent, IEnumerable items, bool active)
        {
            foreach (var item in items)
            {
                var itemAsChild = item as IChild;
                if (itemAsChild != null)
                {
                    itemAsChild.Parent = parent;
                }

                if (active)
                {
                    ScreenExtensions.TryActivate(item);
                }
                else
                {
                    ScreenExtensions.TryDeactivate(item);
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Opens the specified screen.
        /// </summary>
        /// <param name="conductor">The conductor.</param>
        /// <param name="subjectSpecification">The subject.</param>
        /// <param name="callback">Is called with true if the screen is activated.</param>
        public static void ActivateSubject(this IConductor conductor, ISubjectSpecification subjectSpecification, Action <bool> callback)
        {
            var found = conductor.GetChildren()
                        .OfType <IHaveSubject>()
                        .FirstOrDefault(subjectSpecification.Matches);

            EventHandler <ActivationProcessedEventArgs> processed = null;

            processed = (s, e) => {
                conductor.ActivationProcessed -= processed;
                callback(e.Success);
            };

            conductor.ActivationProcessed += processed;

            if (found != null)
            {
                conductor.ActivateItem(found);
            }
            else
            {
                subjectSpecification.CreateSubjectHost(viewModelFactory, conductor.ActivateItem);
            }
        }
Esempio n. 18
0
 public StartPageViewModel(IConductor conductor)
 {
     this.conductor = conductor;
 }
 /// <summary>
 /// Declares the parent to open the child in.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <returns></returns>
 public OpenScreenSubjectResult In(IConductor parent)
 {
     locateParent = c => parent;
     return(this);
 }
 /// <summary>
 /// Called when the child is opened.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="child">The child.</param>
 protected virtual void OnOpened(IConductor parent, object child)
 {
 }
 /// <summary>
 /// Closes the specified item.
 /// </summary>
 /// <param name="conductor">The conductor.</param>
 /// <param name="item">The item to close.</param>
 /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
 /// <returns>A task that represents the asynchronous operation.</returns>
 public static Task CloseItemAsync(this IConductor conductor, object item, CancellationToken cancellationToken)
 => conductor.DeactivateItemAsync(item, true, cancellationToken);
Esempio n. 22
0
 public OpenChildResult <TChild> In(IConductor parent)
 {
     locateParent = c => parent;
     return(this);
 }
Esempio n. 23
0
        public ShellViewModel(IWindowManager windowManager
                              , IEventAggregator eventAggregator
                              , RibbonViewModel ribbonViewModel
                              , StatusBarViewModel statusBar
                              , IConductor conductor
                              , IDaxStudioHost host
                              , IVersionCheck versionCheck
                              , IGlobalOptions options
                              , IAutoSaver autoSaver
                              )
        {
            Ribbon           = ribbonViewModel;
            Ribbon.Shell     = this;
            StatusBar        = statusBar;
            Options          = options;
            AutoSaver        = autoSaver;
            _windowManager   = windowManager;
            _eventAggregator = eventAggregator;
            _eventAggregator.Subscribe(this);
            Tabs = (DocumentTabViewModel)conductor;
            Tabs.ConductWith(this);
            //Tabs.CloseStrategy = new ApplicationCloseStrategy();
            Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>();
            _host = host;
            _app  = Application.Current;
            var recoveringFiles = false;

            // get master auto save indexes and only get crashed index files...
            var autoSaveInfo   = AutoSaver.LoadAutoSaveMasterIndex();
            var filesToRecover = autoSaveInfo.Values.Where(idx => idx.IsCurrentVersion && idx.ShouldRecover).SelectMany(entry => entry.Files);

            // check for auto-saved files and offer to recover them
            if (filesToRecover.Any())
            {
                recoveringFiles = true;
                RecoverAutoSavedFiles(autoSaveInfo);
            }
            else
            {
                // if there are no auto-save files to recover, start the auto save timer
                eventAggregator.PublishOnUIThreadAsync(new StartAutoSaveTimerEvent());
            }

            // if a filename was passed in on the command line open it
            if (!string.IsNullOrEmpty(_host.CommandLineFileName))
            {
                Tabs.NewQueryDocument(_host.CommandLineFileName);
            }

            // if no tabs are open at this point and we are not recovering autosave file then, open a blank document
            if (Tabs.Items.Count == 0 && !recoveringFiles)
            {
                NewDocument();
            }


            VersionChecker = versionCheck;

#if PREVIEW
            DisplayName = string.Format("DaxStudio - {0} (PREVIEW)", Version.ToString(4));
#else
            DisplayName = string.Format("DaxStudio - {0}", Version.ToString(3));
#endif
            Application.Current.Activated += OnApplicationActivated;
            Log.Verbose("============ Shell Started - v{version} =============", Version.ToString());

            AutoSaveTimer          = new Timer(Constants.AutoSaveIntervalMs);
            AutoSaveTimer.Elapsed += new ElapsedEventHandler(AutoSaveTimerElapsed);
        }
Esempio n. 24
0
 /// <summary>
 /// Closes the specified item.
 /// </summary>
 /// <param name="conductor">The conductor.</param>
 /// <param name="item">The item to close.</param>
 /// <param name="cancellationToken"></param>
 public static Task CloseItem(this IConductor conductor, object item, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(conductor.DeactivateItem(item, true, cancellationToken));
 }
Esempio n. 25
0
 protected virtual void OnOpened(IConductor parent, TChild child)
 {
 }
Esempio n. 26
0
        public ShellViewModel(IWindowManager windowManager
                              , IEventAggregator eventAggregator
                              , RibbonViewModel ribbonViewModel
                              , StatusBarViewModel statusBar
                              , IConductor conductor
                              , IDaxStudioHost host
                              , IVersionCheck versionCheck
                              , ISettingProvider settingProvider)
        {
            Ribbon           = ribbonViewModel;
            Ribbon.Shell     = this;
            StatusBar        = statusBar;
            SettingProvider  = settingProvider;
            _windowManager   = windowManager;
            _eventAggregator = eventAggregator;
            _eventAggregator.Subscribe(this);
            Tabs = (DocumentTabViewModel)conductor;
            Tabs.ConductWith(this);
            //Tabs.CloseStrategy = new ApplicationCloseStrategy();
            Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>();
            _host = host;
            _app  = Application.Current;

            // TODO - get master auto save indexes and only get crashed index files...

            // check for auto-saved files and offer to recover them
            var autoSaveInfo = AutoSaver.LoadAutoSaveMasterIndex();

            if (autoSaveInfo.Values.Where(idx => idx.ShouldRecover).Count() > 0)
            {
                RecoverAutoSavedFiles(autoSaveInfo);
            }
            else
            {
                // if a filename was passed in on the command line open it
                if (_host.CommandLineFileName != string.Empty)
                {
                    Tabs.NewQueryDocument(_host.CommandLineFileName);
                }

                // if no tabs are open at this point open a blank one
                if (Tabs.Items.Count == 0)
                {
                    NewDocument();
                }

                // if there are no auto-save files to recover, start the auto save timer
                eventAggregator.PublishOnUIThreadAsync(new StartAutoSaveTimerEvent());
            }

            VersionChecker = versionCheck;

#if PREVIEW
            DisplayName = string.Format("DaxStudio - {0} (PREVIEW)", Version.ToString(4));
#else
            DisplayName = string.Format("DaxStudio - {0}", Version.ToString(3));
#endif
            Application.Current.Activated += OnApplicationActivated;
            Log.Verbose("============ Shell Started - v{version} =============", Version.ToString());

            _autoSaveTimer          = new Timer(Constants.AutoSaveIntervalMs);
            _autoSaveTimer.Elapsed += new ElapsedEventHandler(AutoSaveTimerElapsed);
        }
Esempio n. 27
0
 public ShellViewModel(IWindowManager windowManager, IEventAggregator eventAggregator, RibbonViewModel ribbonViewModel, StatusBarViewModel statusBar, IConductor conductor, IDaxStudioHost host, IVersionCheck versionCheck)
 {
     Ribbon           = ribbonViewModel;
     Ribbon.Shell     = this;
     StatusBar        = statusBar;
     _windowManager   = windowManager;
     _eventAggregator = eventAggregator;
     _eventAggregator.Subscribe(this);
     Tabs = (DocumentTabViewModel)conductor;
     Tabs.ConductWith(this);
     //Tabs.CloseStrategy = new ApplicationCloseStrategy();
     Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>();
     _host = host;
     if (_host.CommandLineFileName != string.Empty)
     {
         Tabs.NewQueryDocument(_host.CommandLineFileName);
     }
     else
     {
         Tabs.NewQueryDocument();
     }
     VersionChecker = versionCheck;
     DisplayName    = string.Format("DaxStudio - {0}", Version.ToString(3));
     Application.Current.Activated += OnApplicationActivated;
     Log.Verbose("============ Shell Started - v{version} =============", Version.ToString());
     //Execute.OnUIThread(() => { notifyIcon = new NotifyIcon(); });
 }
Esempio n. 28
0
        public ShellViewModel(IEventAggregator eventAggregator
                              , RibbonViewModel ribbonViewModel
                              , StatusBarViewModel statusBar
                              , IConductor conductor
                              , IDaxStudioHost host
                              , IVersionCheck versionCheck
                              , IGlobalOptions options
                              , IAutoSaver autoSaver
                              , IThemeManager themeManager)
        {
            Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Starting Constructor");
            _utcSessionStart = DateTime.UtcNow;
            Ribbon           = ribbonViewModel;
            Ribbon.Shell     = this;
            StatusBar        = statusBar;
            Options          = options;
            AutoSaver        = autoSaver;
            ThemeManager     = themeManager;
            _eventAggregator = eventAggregator;
            _eventAggregator.Subscribe(this);

            Tabs = (DocumentTabViewModel)conductor;
            Tabs.ConductWith(this);
            //Tabs.CloseStrategy = new ApplicationCloseStrategy();
            Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>();
            _host     = host;
            _username = UserHelper.GetUser();
            var recoveringFiles = false;

            // get master auto save indexes and only get crashed index files...
            var autoSaveInfo   = AutoSaver.LoadAutoSaveMasterIndex();
            var filesToRecover = autoSaveInfo.Values.Where(idx => idx.IsCurrentVersion && idx.ShouldRecover).SelectMany(entry => entry.Files);

            // check for auto-saved files and offer to recover them
            if (filesToRecover.Any())
            {
                Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Found auto-save files, beginning recovery");
                recoveringFiles = true;
                RecoverAutoSavedFiles(autoSaveInfo);
            }
            else
            {
                // if there are no auto-save files to recover, start the auto save timer
                Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Starting auto-save timer");
                eventAggregator.PublishOnUIThreadAsync(new StartAutoSaveTimerEvent());
            }

            // if a filename was passed in on the command line open it
            if (!string.IsNullOrEmpty(_host.CommandLineFileName))
            {
                Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", $"Opening file from command line: '{_host.CommandLineFileName}'");
                Tabs.NewQueryDocument(_host.CommandLineFileName);
            }

            // if no tabs are open at this point and we are not recovering auto-save file then, open a blank document
            if (Tabs.Items.Count == 0 && !recoveringFiles)
            {
                Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Opening a new blank query window");
                NewDocument();
            }


            VersionChecker = versionCheck;

            DisplayName = AppTitle;

            Application.Current.Activated += OnApplicationActivated;


            AutoSaveTimer          = new Timer(Constants.AutoSaveIntervalMs);
            AutoSaveTimer.Elapsed += AutoSaveTimerElapsed;

            Log.Debug("============ Shell Started - v{version} =============", Version.ToString());
        }
Esempio n. 29
0
 /// <summary>
 /// Closes the specified item.
 /// </summary>
 /// <param name="conductor">The conductor.</param>
 /// <param name="item">The item to close.</param>
 public static void CloseItem(this IConductor conductor, object item)
 {
     conductor.DeactivateItem(item, true);
 }
Esempio n. 30
0
 public WorkspacePageViewModel(IConductor conductor, string fileName)
 {
     this.conductor = conductor;
     this.fileName  = fileName;
     this.Roots     = new BindableCollection <FileItemViewModel>();
 }