示例#1
0
 private void DoDirChanged(object o, DirectoryWatcherEventArgs e)
 {
     foreach (string path in e.Paths)
         DoAddFiles(path);
 }
示例#2
0
        private void DoDirChanged(object sender, DirectoryWatcherEventArgs e)
        {
            foreach (string p in e.Paths)
            {
                NSString path = NSString.Create(p).stringByResolvingSymlinksInPath();

                if (Paths.AreEqual(path.description(), m_dir.description()))
                {
                    var reload = m_boss.Get<IReload>();
                    reload.Reload();
                    break;
                }
            }
        }
示例#3
0
        private static void DoFilesChanged(object sender, DirectoryWatcherEventArgs e)
        {
            Log.WriteLine(TraceLevel.Info, "App", "Updating languages");

            DoLoadLanguages();

            Broadcaster.Invoke("languages changed", null);
        }
示例#4
0
        private void DoFilesChanged(object sender, DirectoryWatcherEventArgs e)
        {
            DateTime time = System.IO.File.GetLastWriteTime(ms_stylesPath);
            if (time > m_stylesWriteTime)
            {
                m_stylesWriteTime = time;

                NSAttributedString text = DoLoadStyles();
                if (!NSObject.IsNullOrNil(text))
                {
                    DoSetAttributes(text);
                    DoUpdateAttributes("*", true);
                }
            }
        }
        private void DoDirChanged(object sender, DirectoryWatcherEventArgs e)
        {
            // Remember whatever we have selected. Note that we can't simply
            // use the IEnumerable result because it will be lazily computed which
            // won't work in this context.
            TableItem[] oldSelections = DoGetSelectedItems().ToArray();

            // Update which ever items are open.
            bool changed = false;
            var added = new List<TableItem>();
            foreach (string path in e.Paths)
            {
                NSString spath = NSString.Create(path).stringByStandardizingPath();
                TableItem item = m_root.Find(spath);
                if (item != null)
                {
                    if (item.Reload(added))
                    {
                        m_table.reloadItem_reloadChildren(item == m_root ? null : item, true);
                        changed = true;
                    }
                }
            }

            // If an item has changed then we'll need to fixup the table selections.
            if (changed)
            {
                m_table.deselectAll(this);

                // Note that the refcounts of the items in oldSelections may be zero at
                // this point (so we can't use things like Name).
                NSMutableIndexSet newSelections = NSMutableIndexSet.Create();
                if (oldSelections.Any())
                {
                    // Selections are based on row index instead of the item so if we
                    // don't do this then the selection will switch to a different item.
                    foreach (TableItem item in oldSelections)
                    {
                        int row = m_table.rowForItem(item);
                        if (row >= 0)											// item may no longer exist
                        {
                            newSelections.addIndex((uint) row);
                        }
                    }
                }
                else
                {
                    // If there were no old selections then we'll select whatever was
                    // added (this is a nice thing to do for duplicate and hopefully
                    // will not prove annoying elsewhere).
                    foreach (TableItem item in added)
                    {
                        int row = m_table.rowForItem(item);
                        if (row >= 0)
                        {
                            newSelections.addIndex((uint) row);
                        }
                    }
                }

                // Select the new items or fixup the selections for old selections.
                if (newSelections.count() > 0)
                {
                    m_table.selectRowIndexes_byExtendingSelection(newSelections, false);

                    if (newSelections.count() == 1)
                        m_table.scrollRowToVisible((int) newSelections.First());
                }

                Broadcaster.Invoke("directory changed", m_boss);
            }
        }
示例#6
0
        // Note that this is also called if a file in the directory is modified.
        private void DoFilesChanged(object sender, DirectoryWatcherEventArgs e)
        {
            var scripts = new List<string>();
            scripts.AddRange(DoGetFiles("standard"));
            scripts.AddRange(DoGetFiles("user"));

            bool changed = scripts.Count != m_scripts.Count || scripts.Union(m_scripts).Count() != m_scripts.Count;
            if (changed)
            {
                m_scripts = scripts;
                DoRebuildMenu();
            }
        }