示例#1
0
        public void HandlePluginConfigurationPluginAssemblyDescription()
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            List <SelectedFile> selectedFiles = GetSelectedFilesAll(FileOperations.SupportsXmlType, false).Take(2).ToList();

            string filePath = string.Empty;

            if (selectedFiles.Count == 1)
            {
                filePath = selectedFiles[0].FilePath;
            }

            if (commonConfig != null && Directory.Exists(commonConfig.FolderForExport))
            {
                ActivateOutputWindow(null);
                WriteToOutputEmptyLines(null, commonConfig);

                try
                {
                    Controller.StartShowingPluginConfigurationAssemblyDescriptionWindow(commonConfig, filePath);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(null, ex);
                }
            }
        }
示例#2
0
        private void GetConnectionConfigEntityPropertiesAndExecute(ConnectionData connectionData, string windowTitleFormat1, Action <ConnectionData, CommonConfiguration, string, int?, Guid> action)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                var thread = new System.Threading.Thread(() =>
                {
                    try
                    {
                        string windowTitle = string.Format(windowTitleFormat1, connectionData.Name);

                        var dialog = new WindowSelectEntityIdToFind(commonConfig, connectionData, windowTitle);

                        if (dialog.ShowDialog().GetValueOrDefault())
                        {
                            string entityName  = dialog.EntityTypeName;
                            int?entityTypeCode = dialog.EntityTypeCode;
                            Guid entityId      = dialog.EntityId;

                            connectionData = dialog.GetConnectionData();

                            ActivateOutputWindow(connectionData);
                            WriteToOutputEmptyLines(connectionData, commonConfig);

                            CheckWishToChangeCurrentConnection(connectionData);

                            try
                            {
                                action(connectionData, commonConfig, entityName, entityTypeCode, entityId);
                            }
                            catch (Exception ex)
                            {
                                WriteErrorToOutput(connectionData, ex);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToOutput(connectionData, ex);
                    }
                });

                thread.SetApartmentState(System.Threading.ApartmentState.STA);

                thread.Start();
            }
        }
示例#3
0
        public void OpenCommonConfiguration()
        {
            CommonConfiguration config = CommonConfiguration.Get();

            if (config != null)
            {
                var thread = new System.Threading.Thread(() =>
                {
                    try
                    {
                        var form = new WindowCommonConfiguration(config);

                        form.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToOutput(null, ex);
                    }
                });

                thread.SetApartmentState(System.Threading.ApartmentState.STA);

                thread.Start();
            }
        }
        public void HandleWebResourceOpenFilesCommand(List <SelectedFile> selectedFiles, OpenFilesType openFilesType, bool inTextEditor)
        {
            if (selectedFiles.Count == 0)
            {
                return;
            }

            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (inTextEditor && !File.Exists(commonConfig.TextEditorProgram))
            {
                return;
            }

            if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
            {
                return;
            }

            var connectionData = crmConfig.CurrentConnectionData;

            if (connectionData != null && commonConfig != null)
            {
                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                Controller.StartWebResourceOpeningFiles(connectionData, commonConfig, selectedFiles, openFilesType, inTextEditor);
            }
        }
示例#5
0
        private async void mICreateNewSolutionInEditor_Click(object sender, RoutedEventArgs e)
        {
            var commonConfig = CommonConfiguration.Get();

            var repositoryPublisher = new PublisherRepository(_service);

            var publisherDefault = await repositoryPublisher.GetDefaultPublisherAsync();

            var newSolution = new Solution()
            {
                FriendlyName = string.Empty,
                UniqueName   = string.Empty,
                Version      = "1.0.0.0",
                PublisherId  = null,
            };

            if (publisherDefault != null)
            {
                newSolution.PublisherId = new Microsoft.Xrm.Sdk.EntityReference(publisherDefault.LogicalName, publisherDefault.Id)
                {
                    Name = publisherDefault.FriendlyName
                };
            }

            WindowHelper.OpenEntityEditor(_iWriteToOutput, _service, commonConfig, Solution.EntityLogicalName, newSolution);
        }
示例#6
0
        public WindowCrmConnectionList(IWriteToOutput iWriteToOutput, ConnectionConfiguration crmConfig, bool currentConnectionChoosing = false)
        {
            this._crmConfig                 = crmConfig;
            this._iWriteToOutput            = iWriteToOutput;
            this._currentConnectionChoosing = currentConnectionChoosing;

            BindingOperations.EnableCollectionSynchronization(this._crmConfig.Connections, sysObjectConnections);
            BindingOperations.EnableCollectionSynchronization(this._crmConfig.ArchiveConnections, sysObjectArchiveConnections);
            BindingOperations.EnableCollectionSynchronization(this._crmConfig.Users, sysObjectUsers);

            InitializeComponent();

            InputLanguageManager.SetInputLanguage(this, CultureInfo.CreateSpecificCulture("en-US"));

            var commonConfig = CommonConfiguration.Get();

            WindowCrmConnectionHandler.InitializeConnectionMenuItems(miConnection, this._iWriteToOutput, commonConfig, GetSelectedConnection);

            lstVwConnections.ItemsSource = this._crmConfig.Connections;

            lstVwArchiveConnections.ItemsSource = this._crmConfig.ArchiveConnections;

            lstVwUsers.ItemsSource = this._crmConfig.Users;

            lstVwOrganizations.ItemsSource = this._itemsSource = new ObservableCollection <OrganizationDetailViewItem>();

            UpdateCurrentConnectionInfo();

            LoadConfiguration();

            UpdateButtonsConnection();
            UpdateButtonsConnectionArchive();
            UpdateButtonsUsers();
            UpdateButtonsDiscoveryOrganization();
        }
        public void HandleOpenWebResourceInExplorer(ConnectionData connectionData, SelectedFile selectedFile, ActionOnComponent actionOnComponent)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                CheckWishToChangeCurrentConnection(connectionData);

                try
                {
                    Controller.StartOpeningWebResourceInExplorer(connectionData, commonConfig, selectedFile, actionOnComponent);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
示例#8
0
        private void GetConnectionConfigAndExecute(ConnectionData connectionData, Action <ConnectionData, CommonConfiguration> action)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                CheckWishToChangeCurrentConnection(connectionData);

                try
                {
                    action(connectionData, commonConfig);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
示例#9
0
        private void GetConnectionConfigOpenOptionsAndExecute(ConnectionData connectionData, Action <ConnectionData, CommonConfiguration, bool> action)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                CheckWishToChangeCurrentConnection(connectionData);

                bool openOptions = (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != 0;

                try
                {
                    action(connectionData, commonConfig, openOptions);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
        public void HandleShowingWebResourcesDependentComponents(List <SelectedFile> selectedFiles)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
            {
                return;
            }

            var connectionData = crmConfig.CurrentConnectionData;

            if (connectionData != null && commonConfig != null && selectedFiles.Count > 0)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                var thread = new System.Threading.Thread(() =>
                {
                    try
                    {
                        var form = new WindowSelectFolderForExport(connectionData, commonConfig.FolderForExport, commonConfig.DefaultFileAction);

                        if (form.ShowDialog().GetValueOrDefault())
                        {
                            commonConfig.FolderForExport   = form.SelectedFolder;
                            commonConfig.DefaultFileAction = form.GetFileAction();

                            connectionData = form.GetConnectionData();

                            if (connectionData != null)
                            {
                                commonConfig.Save();

                                ActivateOutputWindow(connectionData);
                                WriteToOutputEmptyLines(connectionData, commonConfig);

                                CheckWishToChangeCurrentConnection(connectionData);

                                try
                                {
                                    Controller.ShowingWebResourcesDependentComponents(connectionData, commonConfig, selectedFiles);
                                }
                                catch (Exception ex)
                                {
                                    WriteErrorToOutput(connectionData, ex);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToOutput(connectionData, ex);
                    }
                });

                thread.SetApartmentState(System.Threading.ApartmentState.STA);

                thread.Start();
            }
        }
        public void HandleExportDefaultSiteMap(string selectedSiteMap)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (commonConfig != null)
            {
                string fileName = string.Format("SiteMap.{0}.xml", selectedSiteMap);

                var dialog = new Microsoft.Win32.SaveFileDialog()
                {
                    DefaultExt = ".xml",

                    Filter      = "SiteMap (.xml)|*.xml",
                    FilterIndex = 1,

                    RestoreDirectory = true,
                    FileName         = fileName,

                    InitialDirectory = commonConfig.FolderForExport,
                };

                if (dialog.ShowDialog().GetValueOrDefault())
                {
                    commonConfig.Save();

                    ActivateOutputWindow(null);
                    WriteToOutputEmptyLines(null, commonConfig);

                    try
                    {
                        Uri uri = FileOperations.GetSiteMapResourceUri(selectedSiteMap);
                        StreamResourceInfo info = Application.GetResourceStream(uri);

                        var doc = XDocument.Load(info.Stream);
                        info.Stream.Dispose();

                        var filePath = dialog.FileName;

                        doc.Save(filePath, SaveOptions.OmitDuplicateNamespaces);

                        this.WriteToOutput(null, string.Empty);
                        this.WriteToOutput(null, string.Empty);
                        this.WriteToOutput(null, string.Empty);

                        this.WriteToOutput(null, "{0} exported.", fileName);

                        this.WriteToOutput(null, string.Empty);

                        this.WriteToOutputFilePathUri(null, filePath);

                        PerformAction(null, filePath, true);
                    }
                    catch (Exception ex)
                    {
                        WriteErrorToOutput(null, ex);
                    }
                }
            }
        }
示例#12
0
        private void GetConnectionConfigTextAndExecute(ConnectionData connectionData, string windowTitle, string labelTitle, Action <ConnectionData, CommonConfiguration, string> action)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                var thread = new System.Threading.Thread(() =>
                {
                    try
                    {
                        var dialog = new WindowSelectFolderAndText(commonConfig, connectionData, windowTitle, labelTitle);

                        if (dialog.ShowDialog().GetValueOrDefault())
                        {
                            connectionData = dialog.GetConnectionData();

                            if (connectionData != null)
                            {
                                ActivateOutputWindow(connectionData);
                                WriteToOutputEmptyLines(connectionData, commonConfig);

                                CheckWishToChangeCurrentConnection(connectionData);

                                string text = dialog.GetText();

                                try
                                {
                                    action(connectionData, commonConfig, text);
                                }
                                catch (Exception ex)
                                {
                                    WriteErrorToOutput(connectionData, ex);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToOutput(connectionData, ex);
                    }
                });

                thread.SetApartmentState(System.Threading.ApartmentState.STA);

                thread.Start();
            }
        }
示例#13
0
        public void HandleSelectAndPublishEntityCommand(ConnectionData connectionData)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                string selection = GetSelectedText();

                var thread = new System.Threading.Thread(() =>
                {
                    try
                    {
                        var dialog = new WindowSelectEntityName(connectionData, "EntityName", selection);

                        if (dialog.ShowDialog().GetValueOrDefault())
                        {
                            string entityName  = dialog.EntityTypeName;
                            int?entityTypeCode = dialog.EntityTypeCode;

                            connectionData = dialog.GetConnectionData();

                            CheckWishToChangeCurrentConnection(connectionData);

                            ActivateOutputWindow(connectionData);
                            WriteToOutputEmptyLines(connectionData, commonConfig);

                            try
                            {
                                Controller.StartPublishEntityMetadata(connectionData, commonConfig, entityName, entityTypeCode);
                            }
                            catch (Exception ex)
                            {
                                WriteErrorToOutput(connectionData, ex);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToOutput(connectionData, ex);
                    }
                });

                thread.SetApartmentState(System.Threading.ApartmentState.STA);

                thread.Start();
            }
        }
示例#14
0
        private void GetConnectionConfigConfirmActionAndExecute(ConnectionData connectionData, Func <ConnectionData, string> getMessage, string title, Action <ConnectionData, CommonConfiguration> action)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                bool canMakeAction = false;

                if (commonConfig.DoNotPromtPublishMessage)
                {
                    canMakeAction = true;
                }
                else
                {
                    string message = getMessage(connectionData);
                    var    dialog  = new WindowConfirmPublish(message, title, false);

                    if (dialog.ShowDialog().GetValueOrDefault())
                    {
                        commonConfig.DoNotPromtPublishMessage = dialog.DoNotPromtPublishMessage;

                        commonConfig.Save();

                        canMakeAction = true;
                    }
                }

                if (canMakeAction)
                {
                    ActivateOutputWindow(connectionData);
                    WriteToOutputEmptyLines(connectionData, commonConfig);

                    CheckWishToChangeCurrentConnection(connectionData);

                    try
                    {
                        action(connectionData, commonConfig);
                    }
                    catch (Exception ex)
                    {
                        WriteErrorToOutput(connectionData, ex);
                    }
                }
            }
        }
示例#15
0
        public void HandlePluginConfigurationCreate(ConnectionData connectionData)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                var thread = new System.Threading.Thread(() =>
                {
                    try
                    {
                        var form = new WindowPluginConfiguration(commonConfig, connectionData, true);

                        if (form.ShowDialog().GetValueOrDefault())
                        {
                            connectionData = form.GetConnectionData();

                            ActivateOutputWindow(connectionData);
                            WriteToOutputEmptyLines(connectionData, commonConfig);

                            CheckWishToChangeCurrentConnection(connectionData);

                            try
                            {
                                Controller.StartExportPluginConfiguration(connectionData, commonConfig);
                            }
                            catch (Exception ex)
                            {
                                WriteErrorToOutput(connectionData, ex);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToOutput(connectionData, ex);
                    }
                });

                thread.SetApartmentState(System.Threading.ApartmentState.STA);

                thread.Start();
            }
        }
示例#16
0
        public void OpenEntityMetadataCommand(ConnectionData connectionData, string entityName, ActionOnComponent actionOnComponent)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                if (actionOnComponent == ActionOnComponent.OpenListInWeb)
                {
                    connectionData.OpenEntityInstanceListInWeb(entityName);
                    return;
                }

                var idEntityMetadata = connectionData.GetEntityMetadataId(entityName);

                if (idEntityMetadata.HasValue)
                {
                    switch (actionOnComponent)
                    {
                    case ActionOnComponent.OpenInWeb:
                        connectionData.OpenEntityMetadataInWeb(idEntityMetadata.Value);
                        return;

                    case ActionOnComponent.OpenDependentComponentsInWeb:
                        connectionData.OpenSolutionComponentDependentComponentsInWeb(Entities.ComponentType.Entity, idEntityMetadata.Value);
                        return;
                    }
                }

                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                try
                {
                    Controller.StartEntityMetadataOpenInWeb(connectionData, commonConfig, entityName, actionOnComponent);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
示例#17
0
        public void HandleOpenReportCommand(ConnectionData connectionData, SelectedFile selectedFile, ActionOnComponent actionOnComponent)
        {
            if (selectedFile == null)
            {
                return;
            }

            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                var objectId = connectionData.GetLastLinkForFile(selectedFile.FriendlyFilePath);

                if (objectId.HasValue)
                {
                    switch (actionOnComponent)
                    {
                    case ActionOnComponent.OpenInWeb:
                        connectionData.OpenEntityInstanceInWeb(Entities.Report.EntityLogicalName, objectId.Value);
                        return;

                    case ActionOnComponent.OpenDependentComponentsInWeb:
                        connectionData.OpenSolutionComponentDependentComponentsInWeb(Entities.ComponentType.Report, objectId.Value);
                        return;
                    }
                }

                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                try
                {
                    Controller.StartOpeningReport(connectionData, commonConfig, selectedFile, actionOnComponent);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
        private void btnOpenComponentsInExplorer_Click(object sender, RoutedEventArgs e)
        {
            var entity = GetSelectedEntity();

            if (entity == null)
            {
                return;
            }

            var commonConfig = CommonConfiguration.Get();

            WindowHelper.OpenSolutionComponentDependenciesWindow(this._iWriteToOutput, _service, null, commonConfig, entity.UniqueName, null);
        }
示例#19
0
        private void mIAttributeOpenDependentComponentsInExplorer_Click(object sender, RoutedEventArgs e)
        {
            var attribute = GetSelectedAttribute();

            if (attribute == null)
            {
                return;
            }

            var commonConfig = CommonConfiguration.Get();

            WindowHelper.OpenSolutionComponentDependenciesWindow(_iWriteToOutput, _service, null, commonConfig, (int)ComponentType.Attribute, attribute.AttributeMetadata.MetadataId.Value, null);
        }
        public void HandleShowDifferenceWithDefaultSiteMap(SelectedFile selectedFile, string selectedSiteMap)
        {
            if (selectedFile == null || !File.Exists(selectedFile.FilePath))
            {
                return;
            }

            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (commonConfig == null)
            {
                return;
            }

            ActivateOutputWindow(null);
            WriteToOutputEmptyLines(null, commonConfig);

            try
            {
                Uri uri = FileOperations.GetSiteMapResourceUri(selectedSiteMap);
                StreamResourceInfo info = Application.GetResourceStream(uri);

                var doc = XDocument.Load(info.Stream);
                info.Stream.Dispose();

                string fileName = string.Format("SiteMap.{0}.xml", selectedSiteMap);

                var filePath = Path.Combine(FileOperations.GetTempFileFolder(), fileName);

                doc.Save(filePath, SaveOptions.OmitDuplicateNamespaces);

                this.WriteToOutput(null, string.Empty);
                this.WriteToOutput(null, string.Empty);
                this.WriteToOutput(null, string.Empty);

                this.WriteToOutput(null, "{0} exported.", fileName);

                this.WriteToOutput(null, string.Empty);

                this.WriteToOutputFilePathUri(null, filePath);

                var task = this.ProcessStartProgramComparerAsync(null, selectedFile.FilePath, filePath, selectedFile.FileName, fileName);
            }
            catch (Exception ex)
            {
                WriteErrorToOutput(null, ex);
            }
        }
示例#21
0
        protected override void CommandBeforeQueryStatus(EnvDTE80.DTE2 applicationObject, Tuple <ConnectionData, ConnectionData> connectionDataPair, OleMenuCommand menuCommand)
        {
            if (this._differenceType == ShowDifferenceThreeFileType.ThreeWay)
            {
                var commonConfig = CommonConfiguration.Get();

                if (!commonConfig.DifferenceThreeWayAvaliable())
                {
                    menuCommand.Enabled = menuCommand.Visible = false;

                    return;
                }
            }

            CommonHandlers.ActionBeforeQueryStatusActiveDocumentWebResourceText(applicationObject, menuCommand);
        }
示例#22
0
        public void OpenGlobalOptionSetMetadataCommand(ConnectionData connectionData, string optionSetName, ActionOnComponent actionOnComponent)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                CheckWishToChangeCurrentConnection(connectionData);

                //var idOptionSetMetadata = connectionData.GetEntityMetadataId(optionSetName);

                //if (idOptionSetMetadata.HasValue)
                //{
                //    switch (actionOnComponent)
                //    {
                //        case ActionOnComponent.OpenInWeb:
                //            connectionData.OpenEntityMetadataInWeb(idOptionSetMetadata.Value);
                //            return;

                //        case ActionOnComponent.OpenDependentComponentsInWeb:
                //            connectionData.OpenSolutionComponentDependentComponentsInWeb(Entities.ComponentType.Entity, idOptionSetMetadata.Value);
                //            return;
                //    }
                //}

                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                try
                {
                    Controller.StartGlobalOptionSetMetadataOpenInWeb(connectionData, commonConfig, optionSetName, actionOnComponent);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
        public void HandleOpenApplicationRibbonOrganizationComparerCommand(ConnectionData connectionData1, ConnectionData connectionData2)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData1 != null && connectionData2 != null && connectionData1 != connectionData2 && commonConfig != null)
            {
                ActivateOutputWindow(null);
                WriteToOutputEmptyLines(null, commonConfig);

                try
                {
                    Controller.OpenApplicationRibbonOrganizationComparer(connectionData1, connectionData2, commonConfig);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(null, ex);
                }
            }
        }
示例#24
0
        private void GetConfigAndExecute(Action <CommonConfiguration> action)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (commonConfig != null)
            {
                ActivateOutputWindow(null);
                WriteToOutputEmptyLines(null, commonConfig);

                try
                {
                    action(commonConfig);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(null, ex);
                }
            }
        }
示例#25
0
        protected override void CommandAction(DTEHelper helper, Tuple <ConnectionData, ConnectionData> connectionDataPair)
        {
            if (this._differenceType == ShowDifferenceThreeFileType.ThreeWay)
            {
                var commonConfig = CommonConfiguration.Get();

                if (!commonConfig.DifferenceThreeWayAvaliable())
                {
                    return;
                }
            }

            List <SelectedFile> selectedFiles = _sourceSelectedFiles.GetSelectedFiles(helper, SelectedFileType.WebResourceText).Take(2).ToList();

            if (selectedFiles.Count == 1)
            {
                helper.HandleWebResourceThreeFileDifferenceCommand(connectionDataPair.Item1, connectionDataPair.Item2, selectedFiles.FirstOrDefault(), _differenceType);
            }
        }
        public void HandleWebResourceCheckOpenFilesWithoutUTF8EncodingCommand(List <SelectedFile> selectedFiles)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (commonConfig != null && selectedFiles.Count > 0)
            {
                ActivateOutputWindow(null);
                WriteToOutputEmptyLines(null, commonConfig);

                try
                {
                    Controller.StartWebResourceOpenFilesWithouUTF8Encoding(selectedFiles);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(null, ex);
                }
            }
        }
        public void HandleOpenLinkedSystemForm(ConnectionData connectionData, ActionOnComponent actionOnComponent, string entityName, Guid formId, int formType)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            if (connectionData != null && commonConfig != null)
            {
                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                CheckWishToChangeCurrentConnection(connectionData);

                switch (actionOnComponent)
                {
                case ActionOnComponent.OpenInWeb:
                    connectionData.OpenSystemFormInWeb(entityName, formId, formType);
                    return;

                case ActionOnComponent.OpenDependentComponentsInWeb:
                    connectionData.OpenSolutionComponentDependentComponentsInWeb(Entities.ComponentType.SystemForm, formId);
                    return;
                }

                try
                {
                    Controller.StartOpeningLinkedSystemForm(connectionData, commonConfig, actionOnComponent, entityName, formId, formType);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }
示例#28
0
        public void HandleConnectionOrganizationComparer()
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            ConnectionConfiguration crmConfig = ConnectionConfiguration.Get();

            if (commonConfig != null)
            {
                ActivateOutputWindow(null);
                WriteToOutputEmptyLines(null, commonConfig);

                try
                {
                    Controller.StartOrganizationComparer(crmConfig, commonConfig);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(null, ex);
                }
            }
        }
示例#29
0
        public void HandleReportThreeFileDifferenceCommand(ConnectionData connectionData1, ConnectionData connectionData2, string fieldName, string fieldTitle, ShowDifferenceThreeFileType differenceType)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            List <SelectedFile> selectedFiles = GetSelectedFilesAll(FileOperations.SupportsReportType, false).Take(2).ToList();

            if (connectionData1 != null && connectionData2 != null && connectionData1 != connectionData2 && commonConfig != null && selectedFiles.Count == 1)
            {
                ActivateOutputWindow(null);
                WriteToOutputEmptyLines(null, commonConfig);

                try
                {
                    Controller.StartReportThreeFileDifference(connectionData1, connectionData2, commonConfig, selectedFiles[0], fieldName, fieldTitle, differenceType);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(null, ex);
                }
            }
        }
示例#30
0
        public void HandlePluginConfigurationTree(ConnectionData connectionData)
        {
            CommonConfiguration commonConfig = CommonConfiguration.Get();

            if (connectionData == null)
            {
                if (!HasCurrentCrmConnection(out ConnectionConfiguration crmConfig))
                {
                    return;
                }

                connectionData = crmConfig.CurrentConnectionData;
            }

            List <SelectedFile> selectedFiles = GetSelectedFilesAll(FileOperations.SupportsXmlType, false).Take(2).ToList();

            string filePath = string.Empty;

            if (selectedFiles.Count == 1)
            {
                filePath = selectedFiles[0].FilePath;
            }

            if (connectionData != null && commonConfig != null && Directory.Exists(commonConfig.FolderForExport))
            {
                ActivateOutputWindow(connectionData);
                WriteToOutputEmptyLines(connectionData, commonConfig);

                CheckWishToChangeCurrentConnection(connectionData);

                try
                {
                    Controller.StartShowingPluginConfigurationTree(connectionData, commonConfig, filePath);
                }
                catch (Exception ex)
                {
                    WriteErrorToOutput(connectionData, ex);
                }
            }
        }