Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            editors = new List <EditorPanel>();

            EmptyLabel.Visibility = Visibility.Visible;
            tabControl.Visibility = Visibility.Collapsed;

            // create AppData path
            if (!Directory.Exists(Path.Combine(dataFolderPath, "TOKElfTool")))
            {
                Directory.CreateDirectory(Path.Combine(dataFolderPath, "TOKElfTool"));
            }

            // Read recently opened files
            if (File.Exists(historyPath))
            {
                recentlyOpenedFiles = File.ReadAllLines(historyPath).ToList();
                RegenerateRecentlyOpened();
                EmptyLabel.UpdateList(4, ((IEnumerable <string>)recentlyOpenedFiles).Reverse().ToArray());
            }
            else
            {
                EmptyLabel.UpdateList(0, new string[0]);
            }
        }
Exemplo n.º 2
0
        private void OnVisibilityChanged(bool visible)
        {
            this.ToTop();

            Node.SetProcessUnhandledInput(visible);

            UpLabel.Iter(l => l.Active    = visible && this.CanGoUp());
            CloseLabel.Iter(l => l.Active = visible);

            if (!visible)
            {
                ItemsContainer.GetChildren()
                .OfType <Node>()
                .Filter(c => !EmptyLabel.Contains(c))
                .Iter(ItemsContainer.FreeChild);
            }
        }
Exemplo n.º 3
0
        private void HandleItemsChange(IEnumerable <IMenuModel> items)
        {
            ItemsContainer.GetChildren()
            .OfType <Node>()
            .Filter(c => !EmptyLabel.Contains(c))
            .Iter(ItemsContainer.FreeChild);

            bool IsValid(IMenuModel item)
            {
                var hasChildren = StructureProviders.Exists(p => p.HasChildren(item.Model));
                var executable  = MenuHandlers.Exists(h => h.CanExecute(item));

                return(hasChildren || executable);
            }

            var list = items.Filter(IsValid).Freeze();

            list.Iter((index, item) => CreateItemControl(item, index, ItemsContainer));

            EmptyLabel.Iter(v => v.Visible = !list.Any());
        }