示例#1
0
        public EditMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Edit";
            Alias = "e";
        }
示例#2
0
        public WorkflowMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Workflow Command";
            Alias = "w";

            var context = commandy.Parameter as IItemSelectionContext;

            if (context == null)
            {
                IsReady = true;
                return;
            }

            if (!context.Items.Any())
            {
                IsReady = true;
                return;
            }

            var list        = string.Join("|", context.Items.Select(i => i.ItemUri.ItemId.ToString()));
            var databaseUri = context.Items.First().ItemUri.DatabaseUri;

            databaseUri.Site.DataService.ExecuteAsync("Workflows.GetWorkflowCommands", LoadWorkflowCommands, databaseUri.DatabaseName.ToString(), list);
        }
示例#3
0
 public override void Execute(object parameter)
 {
     if (parameter != null)
     {
         Commandy.Open(parameter);
     }
 }
示例#4
0
        public LanguageMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Language";
            Alias = "l";

            var context = commandy.Parameter as IDatabaseSelectionContext;

            if (context == null)
            {
                IsReady = true;
                return;
            }

            if (context.DatabaseUri == DatabaseUri.Empty)
            {
                IsReady = true;
                return;
            }

            var databaseUri = context.DatabaseUri;

            databaseUri.Site.DataService.ExecuteAsync("Languages.GetLanguages", LoadLanguages, databaseUri.DatabaseName.ToString());
        }
示例#5
0
        public SearchMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Search";
            Alias = "s";
        }
示例#6
0
        public CommandMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Execute Command";
            Alias = "c";

            Commands = CommandManager.CommandDescriptors.Where(c => c.Command.CanExecute(Commandy.Parameter) && !(c.Command is Submenu) && !c.ExcludeFromSearch).Select(c => new CommandHit(c.Command, GetText(c)));
            IsReady  = true;
        }
示例#7
0
        public InsertRenderingMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Insert Rendering";
            Alias = "r";

            var context = commandy.Parameter as LayoutDesignerContext;

            if (context == null)
            {
                IsReady = true;
            }
        }
示例#8
0
        public SetBaseTemplateMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Set Base Template";
            Alias = "b";

            var databaseSelectionContext = commandy.Parameter as IDatabaseSelectionContext;

            if (databaseSelectionContext != null)
            {
                AppHost.Server.GetTemplates(databaseSelectionContext.DatabaseUri, LoadTemplates);
            }
            else
            {
                IsReady = true;
            }
        }
示例#9
0
        public InsertMode([NotNull] Commandy commandy) : base(commandy)
        {
            Assert.ArgumentNotNull(commandy, nameof(commandy));

            Name  = "Insert Options";
            Alias = "i";

            var context = commandy.Parameter as IItemSelectionContext;

            if (context != null && context.Items.Count() == 1)
            {
                var item = context.Items.First();

                item.ItemUri.Site.DataService.GetInsertOptions(item.ItemUri, LoadInsertOptions);
            }
            else
            {
                IsReady = true;
            }
        }
示例#10
0
        protected ModeBase([NotNull] Commandy commandy)
        {
            Debug.ArgumentNotNull(commandy, nameof(commandy));

            Commandy = commandy;
        }
示例#11
0
        protected SearchBasedMode([NotNull] Commandy commandy) : base(commandy)
        {
            Debug.ArgumentNotNull(commandy, nameof(commandy));

            IsReady = true;
        }