public MyPluginControl() { InitializeComponent(); SetTheme(); tv = new WebresourcesTreeView(this); tv.ResourceDisplayRequested += Tv_ResourceDisplayRequested; tv.ContextMenuRequested += Tv_ContextMenuRequested; tv.ResourceSelected += Tv_ResourceSelected; tv.ShowInvalidFilesRequested += Tv_ShowInvalidFilesRequested; tv.ShowPendingUpdatesRequested += Tv_ShowPendingUpdatesRequested; tv.Show(dpMain, Settings.Instance.TreeviewDockState); pud = new PendingUpdatesDialog(this); pud.Show(dpMain, Settings.Instance.PendingUpdatesDockState); rpd = new ResourcePropertiesDialog(); rpd.Show(dpMain, Settings.Instance.PropertiesDockState); sd = new SettingsDialog(); sd.Show(dpMain, Settings.Instance.SettingsDockState); tv.Show(dpMain, Settings.Instance.TreeviewDockState); }
public MyPluginControl() { InitializeComponent(); SetTheme(); tv = new WebresourcesTreeView(this); tv.ResourceDisplayRequested += Tv_ResourceDisplayRequested; tv.ContextMenuRequested += Tv_ContextMenuRequested; tv.ResourceSelected += Tv_ResourceSelected; tv.ShowInvalidFilesRequested += Tv_ShowInvalidFilesRequested; tv.ShowPendingUpdatesRequested += Tv_ShowPendingUpdatesRequested; pud = new PendingUpdatesDialog(this); rpd = new ResourcePropertiesDialog(); sd = new SettingsDialog(); sd.OnSettingsChanged += (sender, e) => { settings.Save(ConnectionDetail?.ConnectionId.ToString()); }; tv.Show(dpMain, DockState.DockLeft); pud.Show(dpMain, DockState.DockLeftAutoHide); rpd.Show(dpMain, DockState.DockRightAutoHide); sd.Show(dpMain, DockState.DockRightAutoHide); onTvItemClickedMap = InitializeOnTvItemClickedMap(); }
private void Tv_ResourceSelected(object sender, ResourceEventArgs e) { if (rpd == null) { rpd = new ResourcePropertiesDialog(); } rpd.Resource = e.Resource; }
public override void Execute(IActionContext context) { if (context.SelectedResources != null && context.SelectedResources.Count > 0) { foreach (IResource resource in context.SelectedResources) { ResourcePropertiesDialog dlg = new ResourcePropertiesDialog(); dlg.SetResource(resource); dlg.Show(); } } }
private static void ShowResource(IResource resource) { try { ResourcePropertiesDialog dlg = new ResourcePropertiesDialog(); dlg.SetResource(resource); dlg.Show(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public override void Run() { var wb = Workbench.Instance; var items = wb.ActiveSiteExplorer.SelectedItems; var connMgr = ServiceRegistry.GetService <ServerConnectionManager>(); var conn = connMgr.GetConnection(wb.ActiveSiteExplorer.ConnectionName); if (!IsValid(conn)) { MessageService.ShowError(string.Format(Strings.ConnectionDoesNotSupportRequiredInterfaces, conn.ProviderName)); return; } //Can only show properties of one selected item if (items.Length == 1) { var openMgr = ServiceRegistry.GetService <OpenResourceManager>(); var icons = ResourceIconCache.CreateDefault(); var dlg = new ResourcePropertiesDialog(icons, conn, items[0].ResourceId, openMgr, wb.ActiveSiteExplorer); dlg.ShowDialog(wb); } }
private void cmsWebresourceTreeview_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem != tsmiAddNewResource) { cmsWebresourceTreeview.Hide(); } if (e.ClickedItem == tsmiProperties) { if (rpd.IsDisposed) { rpd = new ResourcePropertiesDialog(); } rpd.Resource = contextStripResource; rpd.ShowDocked(); } else if (e.ClickedItem == tsmiSetDependencies) { var dialog = new DependencyDialog(contextStripResource, this); if (dialog.ShowDialog(this) == DialogResult.OK) { contextStripResource.DependencyXml = dialog.UpdatedDependencyXml; } } else if (e.ClickedItem == tsmiCopyNameToClipboard) { Clipboard.SetData(DataFormats.StringFormat, contextStripResource.Name); } else if (e.ClickedItem == tsmiOpenInCrm) { if (contextStripResource.Id == Guid.Empty) { MessageBox.Show(this, @"This web resource does not exist on the CRM organization or is not synced", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Process.Start($"{ConnectionDetail.WebApplicationUrl}/main.aspx?id={contextStripResource.Id}&etc=9333&pagetype=webresourceedit"); } else if (e.ClickedItem == tsmiDelete) { ExecuteMethod(DeleteWebresource, contextStripResource); } else if (e.ClickedItem == tsmiUpdate) { var us = new UpdateResourcesSettings { Webresources = new List <Webresource> { contextStripResource }, }; ExecuteMethod(UpdateWebResources, us); } else if (e.ClickedItem == tsmiUpdatePublish) { var us = new UpdateResourcesSettings { Webresources = new List <Webresource> { contextStripResource }, Publish = true }; ExecuteMethod(UpdateWebResources, us); } else if (e.ClickedItem == tsmiUpdatePublishAdd) { var us = new UpdateResourcesSettings { Webresources = new List <Webresource> { contextStripResource }, Publish = true, AddToSolution = true }; ExecuteMethod(UpdateWebResources, us); } else if (e.ClickedItem == tsmiGetLatest) { try { contextStripResource.GetLatestVersion(); } catch (Exception error) { MessageBox.Show(this, error.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (e.ClickedItem == tsmiRefreshFileFromDisk) { if (string.IsNullOrEmpty(contextStripResource.FilePath)) { MessageBox.Show(this, @"This webresource is not synced with a local file", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } contextStripResource.RefreshFromDisk(); } else if (e.ClickedItem == tsmiUpdateFolderFromDisk) { if (string.IsNullOrEmpty(contextFolderNode.FolderPath)) { MessageBox.Show(this, @"This folder node is not synced with a local folder. Cannot refresh from disk", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var invalidFileNames = new List <string>(); tv.RefreshFolderNodeContent(contextFolderNode, invalidFileNames, null); if (invalidFileNames.Any()) { if (ifnd == null || ifnd.IsDisposed) { ifnd = new InvalidFilenamesDialog(); } ifnd.InvalidFiles = invalidFileNames; ifnd.ShowDocked(DockState.DockBottom); } } else if (e.ClickedItem == tsmiRenameWebresource) { var renameDialog = new RenameWebResourceDialog(contextStripResource.Name, ConnectionDetail?.OrganizationMajorVersion ?? -1); if (renameDialog.ShowDialog(this) == DialogResult.OK) { if (contextStripResource.Name != renameDialog.WebResourceName) { ExecuteMethod(RenameWebresource, renameDialog.WebResourceName); } } } else if (e.ClickedItem == tsmiAddNewFolder) { var newFolderDialog = new NewFolderDialog(ConnectionDetail?.OrganizationMajorVersion ?? -1); if (newFolderDialog.ShowDialog(this) == DialogResult.OK) { tv.AddSingleFolder(contextFolderNode, newFolderDialog.FolderName); } } else if (e.ClickedItem == tsmiAddExistingFile) { var ofd = new OpenFileDialog { Multiselect = true, Title = @"Select file(s) to add as webresource(s)" }; if (ofd.ShowDialog(ParentForm) == DialogResult.OK) { var invalidFileNames = new List <string>(); tv.AddFilesAsNodes(contextFolderNode, ofd.FileNames.ToList(), invalidFileNames); if (invalidFileNames.Any()) { if (ifnd == null || ifnd.IsDisposed) { ifnd = new InvalidFilenamesDialog(); } ifnd.InvalidFiles = invalidFileNames; ifnd.ShowDocked(DockState.DockBottom); } } } else if (e.ClickedItem == tsmiNewCss) { tv.AddNewWebresource(contextFolderNode, WebresourceType.Css); } else if (e.ClickedItem == tsmiNewData) { tv.AddNewWebresource(contextFolderNode, WebresourceType.Data); } else if (e.ClickedItem == tsmiNewHtml) { tv.AddNewWebresource(contextFolderNode, WebresourceType.WebPage); } else if (e.ClickedItem == tsmiNewResx) { tv.AddNewWebresource(contextFolderNode, WebresourceType.Resx); } else if (e.ClickedItem == tsmiNewScript) { tv.AddNewWebresource(contextFolderNode, WebresourceType.Script); } else if (e.ClickedItem == tsmiNewXsl) { tv.AddNewWebresource(contextFolderNode, WebresourceType.Xsl); } else if (e.ClickedItem == tsmiExpand) { contextFolderNode.ExpandAll(); } else if (e.ClickedItem == tsmiCollapse) { contextFolderNode.Collapse(false); } }