Exemplo n.º 1
0
 public MruAction(IActionContext context, ConfigSource source)
     : base(context)
 {
     _source = source;
     this.Caption = _source.DisplayName;
     this.IconUri = _source.IconUri;
 }
Exemplo n.º 2
0
        public System.Action Initialize(IKernel container, string[] commandArgs)
        {
            object startView;

            if (commandArgs.Length > 0)
            {
                //First check if there are privileged actions to execute. If so we do that and no more and ask the application to close.
                if (_actionsManager.ExecuteCommandLine(commandArgs))
                {
                    return null;
                }

                var source = new ConfigSource(new FileConfigProvider(commandArgs[0]));

                startView = new ConfigRequest(
                    ConfigRequest.Action.Open,
                    source);
            }
            else
            {
                startView = new ConfigRequest(ConfigRequest.Action.StartScreen);
            }

            //Load plugins and update the assembly source cache accordingly
            var actionSources = LoadPlugins(container);

            //Build the action collections
            _actionsManager.BuildActions(actionSources);

            return () =>
                {
                    var msg = container.Get<IEventAggregator>();
                    msg.Publish(startView);
                };
        }
Exemplo n.º 3
0
        public ConfigRequest(Action a, ConfigSource source = null)
        {
            if (a == Action.Save || a == Action.New || a == Action.Refresh || a == Action.Delete || a == Action.StartScreen)
            {
                if (source != null)
                {
                    throw new ArgumentException(string.Format("The {0} request cannot have a source specified.", a));
                }
            }
            else if (source == null)
            {
                throw new ArgumentNullException("source", string.Format("The source must not be null for a {0} request.", a));
            }

            this.RequestedAction = a;
            this.Source = source;
        }
Exemplo n.º 4
0
        public void SelectSource(ConfigSource source)
        {
            var msg = new ConfigRequest(ConfigRequest.Action.Open, source);

            _messenger.Publish(msg);
        }
Exemplo n.º 5
0
 public void RemoveRecentSource(ConfigSource source)
 {
     EditorSettings.Instance.RecentSources.Remove(source);
     _messenger.Publish(new MruListChangedMessage());
 }
Exemplo n.º 6
0
 public void RemoveRecentSource(ConfigSource source)
 {
     EditorSettings.Instance.RecentSources.Remove(source);
     NotifyOfPropertyChange(() => this.RecentFiles);
     _messenger.Publish(new MruListChangedMessage());
 }