예제 #1
0
        public WindowOrganizationComparerGlobalOptionSets(
            IWriteToOutput iWriteToOutput
            , CommonConfiguration commonConfig
            , ConnectionData connection1
            , ConnectionData connection2
            , string filter
            , string filterEntityName
            ) : base(iWriteToOutput, commonConfig, connection1)
        {
            this.IncreaseInit();

            InitializeComponent();

            SetInputLanguageEnglish();

            LoadEntityNames(cmBEntityName, connection1, connection2);

            cmBEntityName.Text = filterEntityName;

            _optionsControl = new FileGenerationGlobalOptionSetMetadataOptionsControl();
            _optionsControl.CloseClicked += Child_CloseClicked;
            this._optionsPopup            = new Popup
            {
                Child = _optionsControl,

                PlacementTarget = toolBarHeader,
                Placement       = PlacementMode.Bottom,
                StaysOpen       = false,
                Focusable       = true,
            };

            this.Resources["ConnectionName1"] = connection1.Name;
            this.Resources["ConnectionName2"] = connection2.Name;

            LoadFromConfig();

            txtBFilter.Text = filter;

            txtBFilter.SelectionLength = 0;
            txtBFilter.SelectionStart  = txtBFilter.Text.Length;

            txtBFilter.Focus();

            this._itemsSource = new ObservableCollection <LinkedOptionSetMetadata>();

            this.lstVwOptionSets.ItemsSource = _itemsSource;

            cmBConnection1.ItemsSource  = connection1.ConnectionConfiguration.Connections;
            cmBConnection1.SelectedItem = connection1;

            cmBConnection2.ItemsSource  = connection1.ConnectionConfiguration.Connections;
            cmBConnection2.SelectedItem = connection2;

            FillExplorersMenuItems();

            this.DecreaseInit();

            var task = ShowExistingOptionSets();
        }
        public WindowExplorerGlobalOptionSets(
            IWriteToOutput iWriteToOutput
            , CommonConfiguration commonConfig
            , IOrganizationServiceExtented service
            , IEnumerable <OptionSetMetadata> optionSetMetadataEnum
            , string filterEntityName
            , string filter
            , string filePath
            , bool isJavaScript
            , EnvDTE.SelectedItem selectedItem
            ) : base(iWriteToOutput, commonConfig, service)
        {
            this.IncreaseInit();

            InitializeComponent();

            SetInputLanguageEnglish();

            this._filePath     = filePath;
            this._isJavaScript = isJavaScript;
            this._selectedItem = selectedItem;

            if (optionSetMetadataEnum != null)
            {
                _cacheOptionSetMetadata[service.ConnectionData.ConnectionId] = optionSetMetadataEnum;
            }

            LoadEntityNames(cmBEntityName, service.ConnectionData);

            _optionsControl = new FileGenerationGlobalOptionSetMetadataOptionsControl();
            _optionsControl.CloseClicked += Child_CloseClicked;
            this._optionsPopup            = new Popup
            {
                Child = _optionsControl,

                PlacementTarget = toolBarHeader,
                Placement       = PlacementMode.Bottom,
                StaysOpen       = false,
                Focusable       = true,
            };

            LoadFromConfig();

            if (!string.IsNullOrEmpty(_filePath))
            {
                txtBFolder.IsReadOnly = true;
                txtBFolder.Background = SystemColors.InactiveSelectionHighlightBrush;
                txtBFolder.Text       = Path.GetDirectoryName(_filePath);
            }
            else if (this._selectedItem != null)
            {
                string exportFolder = string.Empty;

                if (_selectedItem.ProjectItem != null)
                {
                    exportFolder = _selectedItem.ProjectItem.FileNames[1];
                }
                else if (_selectedItem.Project != null)
                {
                    string relativePath = DTEHelper.GetRelativePath(_selectedItem.Project);

                    string solutionPath = Path.GetDirectoryName(_selectedItem.DTE.Solution.FullName);

                    exportFolder = Path.Combine(solutionPath, relativePath);
                }

                if (!Directory.Exists(exportFolder))
                {
                    Directory.CreateDirectory(exportFolder);
                }

                txtBFolder.IsReadOnly = true;
                txtBFolder.Background = SystemColors.InactiveSelectionHighlightBrush;
                txtBFolder.Text       = exportFolder;
            }
            else
            {
                Binding binding = new Binding
                {
                    Path = new PropertyPath(nameof(CommonConfiguration.FolderForExport)),
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                    Mode = BindingMode.TwoWay,
                };
                BindingOperations.SetBinding(txtBFolder, TextBox.TextProperty, binding);

                txtBFolder.DataContext = _commonConfig;
            }

            cmBEntityName.Text = filterEntityName;

            txtBFilter.Text            = filter;
            txtBFilter.SelectionLength = 0;
            txtBFilter.SelectionStart  = txtBFilter.Text.Length;

            txtBFilter.Focus();

            _itemsSource = new ObservableCollection <OptionSetMetadataListViewItem>();

            lstVwOptionSets.ItemsSource = _itemsSource;

            UpdateButtonsEnable();

            cmBCurrentConnection.ItemsSource  = service.ConnectionData.ConnectionConfiguration.Connections;
            cmBCurrentConnection.SelectedItem = service.ConnectionData;

            FillExplorersMenuItems();

            this.DecreaseInit();

            var task = ShowExistingOptionSets();
        }