public bool ExecuteHardDelete(CommandData data) { if (MessageBox.Show(Resources.Messages.EmptyDeleteWarning, Resources.Messages.AreYouSure, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(true); } IModelTree tree = data.Context as IModelTree; if (tree == null) { return(true); } bool success = false; try { CommonServices.Output.StartSection(Resources.Messages.HardDelete); List <KBObject> parents = new List <KBObject>(); foreach (KBObject obj in tree.SelectedObjects) { parents.Add(obj); } DeleteObjectAndReferences(UIServices.KB.CurrentModel, parents); success = true; } catch (Exception ex) { CommonServices.Output.AddErrorLine(ex.Message); } finally { CommonServices.Output.EndSection(Resources.Messages.HardDelete, success); } return(true); }
private bool QueryIsFolderSelected(CommandData data, ref CommandStatus status) { status.State = CommandState.Disabled; if (UIServices.KB != null && UIServices.KB.CurrentKB != null) { IModelTree tree = data.Context as IModelTree; if (tree == null || !(tree.SelectedObject is KBObject)) { return(true); } foreach (KBObject obj in tree.SelectedObjects) { if (obj.Type != typeof(Folder).GUID) { return(true); } } status.State = CommandState.Enabled; } return(true); }
private bool QueryIsModuleSelected(CommandData data, ref CommandStatus status) { status.State = CommandState.Invisible; if (UIServices.KB != null && UIServices.KB.CurrentKB != null) { IModelTree tree = data.Context as IModelTree; if (tree == null || !(tree.SelectedObject is KBObject)) { return(true); } foreach (KBObject obj in tree.SelectedObjects) { if (obj.Type != typeof(Artech.Architecture.Common.Objects.Module).GUID) { return(true); } } status.State = CommandState.Enabled; } return(true); }
public bool ExecuteRebuildFolder(CommandData data) { IModelTree tree = data.Context as IModelTree; if (tree == null) { return(true); } bool success = false; try { CommonServices.Output.StartSection(Resources.Messages.BuildFolder); List <EntityKey> keys = GetAllObjectsKeys(tree.SelectedObjects.OfType <KBObject>()); if (keys == null || keys.Count == 0) { return(true); } keys.ForEach(k => GenexusUIServices.Build.Rebuild(k)); success = true; } catch (Exception ex) { CommonServices.Output.AddErrorLine(ex.Message); } finally { CommonServices.Output.EndSection(Resources.Messages.BuildFolder, success); } return(true); }