コード例 #1
0
        /// <summary>
        /// Sets the root resource folder, registers events and refreshes controls</summary>
        /// <param name="rootFolder">Resource folder</param>
        public void SetRootFolder(IResourceFolder rootFolder)
        {
            if (m_watcher == null)
            {
                m_uiThreadContext               = SynchronizationContext.Current;
                m_watcher                       = new FileSystemWatcher();
                m_watcher.SynchronizingObject   = m_mainForm;
                m_watcher.IncludeSubdirectories = true;
                m_watcher.EnableRaisingEvents   = false;
                m_watcher.Created              += Watcher_FileChanged;
                m_watcher.Deleted              += Watcher_FileChanged;
                m_watcher.Renamed              += Watcher_Renamed;

                // We need to shut down the watcher before the dispose phase begins
                // this is because file events can occur while disposing other MEF objects
                // (eg, flushing out a cached file). When this happens, we can get a
                // callback that can end up accessing MEF objects that have already
                // been disposed.
                Application.ApplicationExit += ShutdownWatcher;
            }

            IFileSystemResourceFolder rootDirectory = rootFolder as IFileSystemResourceFolder;

            if (rootDirectory != null)
            {
                m_watcher.Path = rootDirectory.FullPath;
                m_watcher.EnableRaisingEvents = true;
            }
            else
            {
                m_watcher.Path = null;
                m_watcher.EnableRaisingEvents = false;
            }

            if (m_treeContext != null)
            {
                m_treeContext.SelectionChanged -= TreeSelectionChanged;
            }

            m_treeContext = new TreeViewContext(rootFolder);
            m_treeContext.SelectionChanged += TreeSelectionChanged;
            m_treeControlAdapter.TreeView   = m_treeContext;

            if (m_listContext != null)
            {
                m_listContext.SelectionChanged -= listSelectionContext_SelectionChanged;
            }

            m_listContext = new ListViewContext();
            m_listContext.SelectionChanged += listSelectionContext_SelectionChanged;
            m_listViewAdapter.ListView      = m_listContext;

            m_treeControlAdapter.Refresh(rootFolder);
        }
コード例 #2
0
        /// <summary>
        /// Sets the root resource folder, registers events and refreshes controls</summary>
        /// <param name="rootFolder">Resource folder</param>
        public void SetRootFolder(IResourceFolder rootFolder)
        {
            m_treeContext          = new TreeViewContext(rootFolder);
            m_treeSelectionContext = m_treeContext.As <ISelectionContext>();
            m_treeSelectionContext.SelectionChanged += TreeSelectionChanged;
            m_treeControlAdapter.TreeView            = m_treeContext;

            m_listContext = new ListViewContext();
            m_listViewAdapter.ListView = m_listContext;

            m_treeControlAdapter.Refresh(rootFolder);
        }
コード例 #3
0
ファイル: ListGridForm.cs プロジェクト: rfellers/pwiz
        public ListGridForm(IDocumentContainer documentContainer, string listName)
        {
            var skylineDataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer());

            ListViewContext                   = ListViewContext.CreateListViewContext(skylineDataSchema, listName);
            BindingListSource.QueryLock       = ListViewContext.SkylineDataSchema.QueryLock;
            BindingListSource.ListChanged    += BindingListSourceOnListChanged;
            ListViewContext.BoundDataGridView = DataGridView;
            DataboundGridControl.BindingListSource.SetViewContext(ListViewContext);
            DataboundGridControl.BindingListSource.NewRowHandler = ListViewContext;
            Text = TabText = TextUtil.SpaceSeparate(Text + ':', listName);
        }
コード例 #4
0
ファイル: ResourceLister.cs プロジェクト: pbiswal/LevelEditor
        /// <summary>
        /// Sets the root resource folder, registers events and refreshes controls</summary>
        /// <param name="rootFolder">Resource folder</param>
        public void SetRootFolder(IResourceFolder rootFolder)
        {
            if (m_watcher == null)
            {
                m_watcher = new FileSystemWatcher();
                m_watcher.SynchronizingObject   = m_mainForm;
                m_watcher.IncludeSubdirectories = true;
                m_watcher.EnableRaisingEvents   = false;
                m_watcher.Created += Watcher_FileChanged;
                m_watcher.Deleted += Watcher_FileChanged;
                m_watcher.Renamed += Watcher_Renamed;
            }

            IFileSystemResourceFolder rootDirectory = rootFolder as IFileSystemResourceFolder;

            if (rootDirectory != null)
            {
                m_watcher.Path = rootDirectory.FullPath;
                m_watcher.EnableRaisingEvents = true;
            }
            else
            {
                m_watcher.Path = null;
                m_watcher.EnableRaisingEvents = false;
            }

            if (m_treeContext != null)
            {
                m_treeContext.SelectionChanged -= TreeSelectionChanged;
            }

            m_treeContext = new TreeViewContext(rootFolder);
            m_treeContext.SelectionChanged += TreeSelectionChanged;
            m_treeControlAdapter.TreeView   = m_treeContext;

            if (m_listContext != null)
            {
                m_listContext.SelectionChanged -= listSelectionContext_SelectionChanged;
            }

            m_listContext = new ListViewContext();
            m_listContext.SelectionChanged += listSelectionContext_SelectionChanged;
            m_listViewAdapter.ListView      = m_listContext;

            m_treeControlAdapter.Refresh(rootFolder);
        }