Ejemplo n.º 1
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id == Constants.System.Root.ToInvariantString())
            {
                //set the default to create
                menu.DefaultMenuAlias = ActionNew.Instance.Alias;

                // root actions
                menu.Items.Add <ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)))
                .ConvertLegacyMenuItem(null, Constants.Trees.Macros, queryStrings.GetValue <string>("application"));

                menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
                return(menu);
            }

            //TODO: This is all hacky ... don't have time to convert the tree, views and dialogs over properly so we'll keep using the legacy dialogs
            var menuItem          = menu.Items.Add(ActionDelete.Instance, Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
            var legacyConfirmView = LegacyTreeDataConverter.GetLegacyConfirmView(ActionDelete.Instance);

            if (legacyConfirmView == false)
            {
                throw new InvalidOperationException("Could not resolve the confirmation view for the legacy action " + ActionDelete.Instance.Alias);
            }
            menuItem.LaunchDialogView(
                legacyConfirmView.Result,
                Services.TextService.Localize(string.Format("general/{0}", ActionDelete.Instance.Alias)));

            return(menu);
        }
        protected override MenuItemCollection GetMenuForFile(string path, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            //TODO: This is all hacky ... don't have time to convert the tree, views and dialogs over properly so we'll keep using the legacy dialogs
            var menuItem          = menu.Items.Add(ActionDelete.Instance, Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
            var legacyConfirmView = LegacyTreeDataConverter.GetLegacyConfirmView(ActionDelete.Instance);

            if (legacyConfirmView == false)
            {
                throw new InvalidOperationException("Could not resolve the confirmation view for the legacy action " + ActionDelete.Instance.Alias);
            }
            menuItem.LaunchDialogView(
                legacyConfirmView.Result,
                Services.TextService.Localize("general/delete"));

            return(menu);
        }