private void contextRegistry_ContextAdded(object sender, ItemInsertedEventArgs <object> e)
        {
            EventSequenceContext context = e.Item.As <EventSequenceContext>();

            if (context != null)
            {
                context.ListView.DragOver += listView_DragOver;
                context.ListView.DragDrop += listView_DragDrop;
                context.ListView.MouseUp  += listView_MouseUp;

                context.ListViewAdapter.LabelEdited +=
                    listViewAdapter_LabelEdited;
            }
        }
Example #2
0
        private void contextRegistry_ContextAdded(object sender, ItemInsertedEventArgs <object> e)
        {
            EventSequenceContext context = Adapters.As <EventSequenceContext>(e.Item);

            if (context != null)
            {
                context.ListView.DragOver += new DragEventHandler(listView_DragOver);
                context.ListView.DragDrop += new DragEventHandler(listView_DragDrop);
                context.ListView.MouseUp  += new MouseEventHandler(listView_MouseUp);

                context.ListViewAdapter.LabelEdited +=
                    new EventHandler <LabelEditedEventArgs <object> >(listViewAdapter_LabelEdited);
            }
        }
Example #3
0
File: Editor.cs Project: zparr/ATF
        /// <summary>
        /// Opens or creates a document at the given URI</summary>
        /// <param name="uri">Document URI</param>
        /// <returns>Document, or null if the document couldn't be opened or created</returns>
        public IDocument Open(Uri uri)
        {
            DomNode node     = null;
            string  filePath = uri.LocalPath;
            string  fileName = Path.GetFileName(filePath);

            if (File.Exists(filePath))
            {
                // read existing document using standard XML reader
                using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    DomXmlReader reader = new DomXmlReader(m_schemaLoader);
                    node = reader.Read(stream, uri);
                }
            }
            else
            {
                // create new document by creating a Dom node of the root type defined by the schema
                node = new DomNode(Schema.eventSequenceType.Type, Schema.eventSequenceRootElement);
            }

            EventSequenceDocument document = null;

            if (node != null)
            {
                // Initialize Dom extensions now that the data is complete
                node.InitializeExtensions();

                EventSequenceContext context = node.As <EventSequenceContext>();

                ControlInfo controlInfo = new ControlInfo(fileName, filePath, StandardControlGroup.Center);
                context.ControlInfo = controlInfo;

                // set document URI
                document     = node.As <EventSequenceDocument>();
                document.Uri = uri;

                // set document GUIs for search and replace
                document.SearchUI  = new DomNodeSearchToolStrip();
                document.ReplaceUI = new DomNodeReplaceToolStrip();
                document.ResultsUI = new DomNodeSearchResultsListView(m_contextRegistry);

                context.ListView.Tag = document;

                // show the ListView control
                m_controlHostService.RegisterControl(context.ListView, controlInfo, this);
            }

            return(document);
        }
        private void UpdateControlInfo()
        {
            string filePath = Uri.LocalPath;
            string fileName = Path.GetFileName(filePath);

            if (Dirty)
            {
                fileName += "*";
            }

            EventSequenceContext context = this.As <EventSequenceContext>();

            context.ControlInfo.Name        = fileName;
            context.ControlInfo.Description = filePath;
        }
Example #5
0
File: Editor.cs Project: zparr/ATF
        /// <summary>
        /// Closes the document and removes any views of it from the UI</summary>
        /// <param name="document">Document to close</param>
        public void Close(IDocument document)
        {
            EventSequenceContext context = Adapters.As <EventSequenceContext>(document);

            m_controlHostService.UnregisterControl(context.ListView);
            context.ControlInfo = null;

            // close all active EditingContexts in the document
            foreach (DomNode node in context.DomNode.Subtree)
            {
                foreach (EditingContext editingContext in node.AsAll <EditingContext>())
                {
                    m_contextRegistry.RemoveContext(editingContext);
                }
            }

            // close the document
            m_documentRegistry.Remove(document);
        }
Example #6
0
        private void contextRegistry_ActiveContextChanged(object sender, EventArgs e)
        {
            // make sure we're always tracking the most recently active EventSequenceContext
            EventSequenceContext context = m_contextRegistry.GetMostRecentContext <EventSequenceContext>();

            if (m_eventSequenceContext != context)
            {
                if (m_eventSequenceContext != null)
                {
                    m_eventSequenceContext.SelectionChanged -= eventSequenceContext_SelectionChanged;
                }

                m_eventSequenceContext = context;

                if (m_eventSequenceContext != null)
                {
                    // track the most recently active EventSequenceContext's selection to get the most recently
                    //  selected event.
                    m_eventSequenceContext.SelectionChanged += eventSequenceContext_SelectionChanged;
                }

                UpdateEvent();
            }
        }
Example #7
0
File: Editor.cs Project: zparr/ATF
        /// <summary>
        /// Makes the document visible to the user</summary>
        /// <param name="document">Document to show</param>
        public void Show(IDocument document)
        {
            EventSequenceContext context = Adapters.As <EventSequenceContext>(document);

            m_controlHostService.Show(context.ListView);
        }