/// <summary>
        /// Initializes a new instance of the <see cref="RelationshipManagementWindow"/> class.
        /// </summary>
        /// <param name="relationship">The relationship.</param>
        public RelationshipManagementWindow(modelEntityRelationship relationship, VsDesignerControl parent)
        {
            InitializeComponent();

            parentWindow = parent;

            this.EntityRelationshipModel = relationship;

            if (this.EntityRelationshipModel != null)
            {
                this.RelationshipNameTextBox.Text            = this.EntityRelationshipModel.name;
                this.MultipleRelationshipsCheckBox.IsChecked = Helper.ValidateBoolFromString(this.EntityRelationshipModel.toMany == null ? "False" : EntityRelationshipModel.toMany);
                this.LoadComboBoxes();
                this.RelationshipNameTextBox.SelectAll();
                this.RelationshipNameTextBox.Focus();
                this.ClientKeyRelationsDataGrid.ItemsSource = clientKeys;
            }
        }
示例#2
0
        /// <summary>
        /// Called after the WindowPane has been sited with an IServiceProvider from the environment
        ///
        protected override void Initialize()
        {
            base.Initialize();

            // Create and initialize the editor
            #region Register with IOleComponentManager
            IOleComponentManager componentManager = (IOleComponentManager)GetService(typeof(SOleComponentManager));
            if (this._componentId == 0 && componentManager != null)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize            = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf            = (uint)_OLECRF.olecrfNeedIdleTime | (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                crinfo[0].grfcadvf          = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff;
                crinfo[0].uIdleTimeInterval = 100;
                int hr = componentManager.FRegisterComponent(this, crinfo, out this._componentId);
                ErrorHandler.Succeeded(hr);
            }
            #endregion

            ComponentResourceManager resources = new ComponentResourceManager(typeof(EditorPane));

            #region Hook Undo Manager
            // Attach an IOleUndoManager to our WindowFrame. Merely calling QueryService
            // for the IOleUndoManager on the site of our IVsWindowPane causes an IOleUndoManager
            // to be created and attached to the IVsWindowFrame. The WindowFrame automaticall
            // manages to route the undo related commands to the IOleUndoManager object.
            // Thus, our only responsibilty after this point is to add IOleUndoUnits to the
            // IOleUndoManager (aka undo stack).
            _undoManager = (IOleUndoManager)GetService(typeof(SOleUndoManager));

            // In order to use the IVsLinkedUndoTransactionManager, it is required that you
            // advise for IVsLinkedUndoClient notifications. This gives you a callback at
            // a point when there are intervening undos that are blocking a linked undo.
            // You are expected to activate your document window that has the intervening undos.
            if (_undoManager != null)
            {
                IVsLinkCapableUndoManager linkCapableUndoMgr = (IVsLinkCapableUndoManager)_undoManager;
                if (linkCapableUndoMgr != null)
                {
                    linkCapableUndoMgr.AdviseLinkedUndoClient(this);
                }
            }
            #endregion

            // hook up our
            XmlEditorService es = GetService(typeof(XmlEditorService)) as XmlEditorService;
            _store             = es.CreateXmlStore();
            _store.UndoManager = _undoManager;

            _model = _store.OpenXmlModel(new Uri(_fileName));

#if DEBUG
            var uriAbsolutePath = Path.GetFullPath(@".\DefaultMBEntities.dbx");
#else
            var uriAbsolutePath = Path.GetFullPath(@"..\..\MSBuild\WPFDesigner_Resources\DefaultMBEntities.dbx");
#endif
            var newUri_DefaultTables = new Uri(uriAbsolutePath);
            _defaultTables = _store.OpenXmlModel(newUri_DefaultTables);

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            _vsDesignerControl = new VsDesignerControl(new ViewModel(_store, _model, this, _textBuffer, _fileName, _defaultTables));
            Content            = _vsDesignerControl;

            RegisterIndependentView(true);

            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;
            if (null != mcs)
            {
                // Now create one object derived from MenuCommnad for each command defined in
                // the CTC file and add it to the command service.

                // For each command we have to define its id that is a unique Guid/integer pair, then
                // create the OleMenuCommand object for this command. The EventHandler object is the
                // function that will be called when the user will select the command. Then we add the
                // OleMenuCommand to the menu service.  The addCommand helper function does all this for us.
                AddCommand(mcs, VSConstants.GUID_VSStandardCommandSet97, (int)VSStd97CmdID.NewWindow,
                           new EventHandler(OnNewWindow), new EventHandler(OnQueryNewWindow));
                AddCommand(mcs, VSConstants.GUID_VSStandardCommandSet97, (int)VSStd97CmdID.ViewCode,
                           new EventHandler(OnViewCode), new EventHandler(OnQueryViewCode));
            }
        }
 public MBSyncServerConfiguration(VsDesignerControl parent) : this()
 {
     parentWindow = parent;
 }