Пример #1
0
        public async Task Init()
        {
            var folderList = await App._instance.IO.GetLocalDataAsync <List <FolderItem> >(StaticString.FolderListFileName);

            var historyList = await App._instance.IO.GetLocalDataAsync <List <HistoryItem> >(StaticString.HistoryListFileName);

            FolderCollection.Clear();
            DisplayHistoryCollection.Clear();
            if (!folderList.IsNullOrEmpty())
            {
                folderList.ForEach(p => FolderCollection.Add(p));
            }
            else
            {
                var folderItem = new FolderItem(App._instance.App.GetLocalizationTextFromResource(LanguageName.Default), FeatherSymbol.Activity);
                FolderCollection.Add(folderItem);
                await SaveFolderList();
            }

            string lastSelectedFolderId = App._instance.App.GetLocalSetting(Settings.LastSelectFolderId, "");

            if (!FolderCollection.Any(p => p.Id == lastSelectedFolderId))
            {
                lastSelectedFolderId = FolderCollection.First().Id;
            }

            CurrentSelectedFolder = FolderCollection.Where(p => p.Id == lastSelectedFolderId).First();

            if (!historyList.IsNullOrEmpty())
            {
                AllHistoryList = historyList;
                historyList.Where(p => p.FolderId == lastSelectedFolderId).ToList().ForEach(p => DisplayHistoryCollection.Add(p));
                HistoryChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #2
0
 public static void ClearHistory()
 {
     _commands = new LinkedList <Command>();
     _current  = null;
     LogManager.GetCurrentClassLogger().Info($"Commands history was cleared!");
     HistoryChanged?.Invoke();
 }
Пример #3
0
        public bool Add(string url, MediaRouter.InputType urlType, string subUrl = null)
        {
            lock (locker)
            {
                Entry entry = null;

                int existIndex = Get(url, subUrl);

                if (existIndex != -1)
                {
                    entry          = Entries[existIndex];
                    entry.OpenedAt = DateTime.Now.Ticks;
                    RemoveAll(url, subUrl);
                }
                else
                {
                    entry = new Entry(url, urlType, subUrl);
                }

                int removeCount = Entries.Count - maxEntries;
                for (int i = 0; i <= removeCount; i++)
                {
                    Entries.RemoveAt(0);
                }

                Save();
                Entries.Add(entry);
                SaveLast();

                HistoryChanged?.Invoke(this, EventArgs.Empty);

                return(existIndex != -1);
            }
        }
Пример #4
0
        static void Use(Color color)
        {
            if (History.Contains(color))
            {
                History.Remove(color);
            }
            History.Insert(0, color);

            HistoryChanged?.Invoke();
        }
Пример #5
0
        private void MakeTextBufferReadOnly()
        {
            using (var edit = _historyTextBuffer.CreateReadOnlyRegionEdit()) {
                var span = new Span(0, edit.Snapshot.Length);
                _readOnlyRegion = edit.CreateReadOnlyRegion(span, SpanTrackingMode.EdgeInclusive, EdgeInsertionMode.Deny);
                edit.Apply();
            }

            _currentEntry = null;
            HistoryChanged?.Invoke(this, new EventArgs());
        }
Пример #6
0
        public static void RemoveAfter(LinkedListNode <Command> currentNext)
        {
            LinkedListNode <Command> cur = _commands.Last;

            while (cur != currentNext)
            {
                _commands.RemoveLast();
                cur = _commands.Last;
            }

            HistoryChanged?.Invoke();
        }
Пример #7
0
        public async Task RefreshHistoryInfo()
        {
            var info = await PlotContentProvider.GetHistoryInfoAsync();

            ActivePlotIndex = info.ActivePlotIndex;
            PlotCount       = info.PlotCount;

            VsAppShell.Current.DispatchOnUIThread(() => {
                // We need to push creation of the tool window
                // so it appears on the first plot
                if (!VsAppShell.Current.IsUnitTestEnvironment)
                {
                    ToolWindowUtilities.ShowWindowPane <PlotWindowPane>(0, false);
                }
                HistoryChanged?.Invoke(this, EventArgs.Empty);
            });
        }
Пример #8
0
        public void Clear()
        {
            lock (locker)
            {
                Entries.Clear();
                if (File.Exists(Path.Combine(Folder, "History.xml")))
                {
                    File.Delete(Path.Combine(Folder, "History.xml"));
                }
                if (File.Exists(Path.Combine(Folder, "HistoryLast.xml")))
                {
                    File.Delete(Path.Combine(Folder, "HistoryLast.xml"));
                }

                HistoryChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #9
0
        public static void AddCommand(Command newCommand)
        {
            if (_current == null)
            {
                _current = new LinkedListNode <Command>(newCommand);
                _commands.AddFirst(_current);
            }
            else
            {
                if (_current.Next != null)
                {
                    RemoveAfter(_current);
                }
                _commands.AddAfter(_current, newCommand);
                _current = _commands.Last;
            }

            HistoryChanged?.Invoke();
        }
Пример #10
0
        public static void Redo()
        {
            if (_current == null)
            {
                return;
            }

            if (_current.Value.Executed)
            {
                if (_current.Next == null)
                {
                    return;
                }

                _current = _current.Next;
            }

            ICommand command = _current.Value;

            command.Execute();
            HistoryChanged?.Invoke();
        }
Пример #11
0
        public static void Undo()
        {
            if (_current == null)
            {
                return;
            }

            if (_current.Value.Undid)
            {
                if (_current.Previous == null)
                {
                    return;
                }

                _current = _current.Previous;
            }

            ICommand command = _current.Value;

            command.Undo();
            HistoryChanged?.Invoke();
        }
Пример #12
0
 private void RaiseHistoryChanged()
 {
     HistoryChanged?.Invoke(this, new EventArgs());
 }
Пример #13
0
 public static void Clear()
 {
     History = new List <Color>();
     HistoryChanged?.Invoke();
 }
Пример #14
0
 public static void Set(List <Color> history)
 {
     History = history;
     HistoryChanged?.Invoke();
 }
Пример #15
0
 private void RaiseHistoryChanged() => HistoryChanged?.Invoke(this, EventArgs.Empty);
Пример #16
0
 internal void RaiseHistoryChanged()
 {
     HistoryChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #17
0
 protected virtual void OnHistoryChanged(object sender, EventArgs e)
 {
     HistoryChanged?.Invoke(this, e);
 }
Пример #18
0
 private void Manager_HistoryChanged(object sender, EventArgs e)
 {
     HistoryChanged?.Invoke(sender, e);
 }
Пример #19
0
 private void TRCoord_HistoryChanged(object sender, EventArgs e)
 {
     HistoryChanged?.Invoke(this, e);
 }
Пример #20
0
 private void ClearHistoryInfo()
 {
     ActivePlotIndex = -1;
     PlotCount       = 0;
     HistoryChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #21
0
 void OnHistoryChanged()
 {
     HistoryChanged?.Invoke(null, EventArgs.Empty);
 }
Пример #22
0
 protected void OnHistoryChanged([CallerMemberName] string propertyName = null)
 {
     HistoryChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
 }
Пример #23
0
 private void OnHistoryChanged()
 {
     HistoryChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #24
0
 protected virtual void OnHistoryChanged()
 {
     HistoryChanged?.Invoke(this, EventArgs.Empty);
 }