Пример #1
0
        public void Initialize()
        {
            LeftPane = (IPaneViewModel)Container.Resolve(GetStoredPaneType(_userSettings.LeftPaneType));
            var leftParam = _userSettings.LeftPaneFileListPaneSettings;

            LeftPane.LoadDataAsync(LoadCommand.Load, new LoadDataAsyncParameters(leftParam), PaneLoaded);
            LeftPane.SetActive();

            RightPane = (IPaneViewModel)Container.Resolve(GetStoredPaneType(_userSettings.RightPaneType));
            var rightParam = _userSettings.RightPaneFileListPaneSettings;

            RightPane.LoadDataAsync(LoadCommand.Load, new LoadDataAsyncParameters(rightParam), PaneLoaded);
        }
Пример #2
0
 public virtual void ImportItem()
 {
     if (FilePicker != null)
     {
         FilePicker.RemoveAll();
         LeftPane.Remove(FilePicker);
         FilePicker = null;
         RefreshScreen();
     }
     else
     {
         ShowImportFileMenu();
     }
 }
Пример #3
0
        public virtual void RefreshScreen()
        {
            ErrorView = null;
            STClient.ResetData();

            Top.Clear();
            HostPane.Clear();
            ClassListView.Clear();
            LeftPane.Clear();
            SettingsPane.Clear();
            Setup();

            Application.Refresh();
        }
Пример #4
0
 private void OnOpenNestedPane(OpenNestedPaneEventArgs args)
 {
     if (LeftPane == args.Opener)
     {
         _leftPaneStack.Push(LeftPane);
         LeftPane = args.Openee;
         LeftPane.SetActive();
     }
     else if (RightPane == args.Opener)
     {
         _rightPaneStack.Push(RightPane);
         RightPane = args.Openee;
         RightPane.SetActive();
     }
 }
Пример #5
0
        /// <summary>
        /// Text
        /// </summary>
        /// <returns>text</returns>
        public override string ToString()
        {
            if (SingleChild != null)
            {
                return("DC: " + SingleChild.Text);
            }

            if (LeftPane != null)
            {
                return("DC[" + LeftPane.ToString() + " | " + RightPane.ToString() + "]");
            }

            if (TopPane != null)
            {
                return("DC[" + TopPane.ToString() + " | " + BottomPane.ToString() + "]");
            }

            return("DC<ModeEmpty>");
        }
Пример #6
0
 private void OnCloseNestedPane(CloseNestedPaneEventArgs args)
 {
     if (LeftPane == args.Pane)
     {
         var settings = LeftPane.Settings;
         LeftPane.Dispose();
         LeftPane = _leftPaneStack.Pop();
         LeftPane.LoadDataAsync(LoadCommand.Restore, new LoadDataAsyncParameters(settings, args.Payload));
         LeftPane.SetActive();
     }
     else if (RightPane == args.Pane)
     {
         var settings = RightPane.Settings;
         RightPane.Dispose();
         RightPane = _rightPaneStack.Pop();
         RightPane.LoadDataAsync(LoadCommand.Restore, new LoadDataAsyncParameters(settings, args.Payload));
         RightPane.SetActive();
     }
 }
Пример #7
0
        //Animations:动画
        //两侧侧栏:模糊特效
        private void SplitViewCollapsed()
        {
            LeftPane.Saturation(value: 0, duration: 600, delay: 0).StartAsync();
            RightPane.Saturation(value: 0, duration: 600, delay: 0).StartAsync();

            LeftGrid.Visibility  = Visibility.Visible;
            RightGrid.Visibility = Visibility.Visible;

            //侧栏
            if (nwe == WidthEnum.PhoneNarrow || nwe == WidthEnum.PhoneStrath)//如果手机竖屏或手机横屏
            {
                LeftBorder.Visibility  = Visibility.Collapsed;
                RightBorder.Visibility = Visibility.Collapsed;
            }

            //顶栏动画
            MainTitleBar.Visibility   = Visibility.Collapsed;
            SecondTitleBar.Visibility = Visibility.Visible;
        }
Пример #8
0
        public virtual void ShowImportFileMenu()
        {
            FilePicker = new FrameView("Select file")
            {
                X           = 0,
                Y           = 0,
                Width       = Dim.Fill(),
                Height      = Dim.Percent(75),
                ColorScheme = Colors.Menu
            };

            FilePicker.Leave += (args) =>
            {
                LeftPane.Remove(FilePicker);
                FilePicker = null;
            };

            GetDirectoriesAndFileView(Directory.GetCurrentDirectory());
            LeftPane.Add(FilePicker);
            FilePicker.SetFocus();
        }
Пример #9
0
        public override void Dispose()
        {
            object data = null;
            FileListPaneSettings settings;
            IPaneViewModel       left;

            do
            {
                settings = LeftPane.Settings;
                data     = LeftPane.Close(data);
                left     = LeftPane;
                LeftPane = _leftPaneStack.Count > 0 ? _leftPaneStack.Pop() : null;
                if (LeftPane != null)
                {
                    LeftPane.LoadDataAsync(LoadCommand.Restore, new LoadDataAsyncParameters(settings));
                }
            }while (LeftPane != null);
            _userSettings.LeftPaneType = left.GetType().FullName;
            _userSettings.LeftPaneFileListPaneSettings = left.Settings;

            data = null;
            IPaneViewModel right;

            do
            {
                settings  = RightPane.Settings;
                data      = RightPane.Close(data);
                right     = RightPane;
                RightPane = _rightPaneStack.Count > 0 ? _rightPaneStack.Pop() : null;
                if (RightPane != null)
                {
                    RightPane.LoadDataAsync(LoadCommand.Restore, new LoadDataAsyncParameters(settings));
                }
            }while (RightPane != null);
            _userSettings.RightPaneType = right.GetType().FullName;
            _userSettings.RightPaneFileListPaneSettings = right.Settings;

            base.Dispose();
        }
Пример #10
0
        private void DrawLeftPane(BufferContainer buffer)
        {
            WriteAt(buffer, 0, 0, $"{LeftPane.ToString()}");

            DrawItems(buffer, 0, 2, GetItems(LeftPane), LeftPane, RightPane, !RightHasFocus);
        }
Пример #11
0
        public virtual void ConfigureWindows <T>(
            Dictionary <string, string> displayItemList,
            Dictionary <string, dynamic> dataItemList,
            bool configureLeftPane = true,
            bool configureHostPane = true)
        {
            _dataItemList = dataItemList;

            if (configureLeftPane)
            {
                ConfigureLeftPane(GetName());
            }
            if (configureHostPane)
            {
                ConfigureHostPane("");
            }

            ConfigureStatusBar();

            MenuBar menubar = null;

            if (displayItemList?.Count > 0)
            {
                var itemListView = GetClassListView <T>(displayItemList);
                LeftPane.Add(itemListView);

                string typeName = dataItemList.FirstOrDefault().Value.GetType().Name;
                switch ((T)dataItemList.FirstOrDefault().Value)
                {
                case Device d:
                case InstalledApp app:
                case SceneSummary s:
                case Subscription sub:
                case CapabilitySummary cs:
                    menubar = MenuHelper.GetStandardMenuBar(Top.ColorScheme, typeName, ExportItem, null);
                    break;

                default:
                    menubar = MenuHelper.GetStandardMenuBar(Top.ColorScheme, typeName, ExportItem, ImportItem);
                    break;
                }
            }
            else
            {
                menubar = MenuHelper.GetStandardMenuBar(Top.ColorScheme);
            }

            if (menubar != null)
            {
                Top.Add(menubar);
            }
            Top.Add(LeftPane);
            if (SettingsPane != null)
            {
                Top.Add(SettingsPane);
            }
            Top.Add(HostPane);
            Top.Add(StatusBar);

            if (displayItemList?.Count > 0)
            {
                dynamic itemToSelect = SelectedItem ?? dataItemList?.FirstOrDefault().Value;
                UpdateJsonView(itemToSelect.ToJson());
                if (SettingsPane != null)
                {
                    UpdateSettings <T>(itemToSelect);
                }
            }
        }
        /// <summary>
        /// This member overrides Control.PrepareControlHierarchy
        /// </summary>
        private void PrepareControlHierarchy()
        {
            if (HasControls() == false)
            {
                return;
            }

            Debug.Assert(Controls[0] is Table);
            Table table = (Table)Controls[0];

            Debug.Assert(table.Rows.Count == 1);
            TableCellCollection cells = table.Rows[0].Cells;

            table.CopyBaseAttributes(this);
            if (ControlStyleCreated)
            {
                table.ApplyStyle(ControlStyle);
            }

            Debug.Assert(cells.Count == 7);

            TableCell firstSeparator = cells[0];

            firstSeparator.Visible = ShowFirstSeparator;
            firstSeparator.MergeStyle(this.VerticalSeparatorStyle);

            TableCell leftCell = cells[1];

            leftCell.MergeStyle(this.LeftPaneStyle);

            TableCell leftToContentSeparator = cells[2];

            leftToContentSeparator.MergeStyle(this.VerticalSeparatorStyle);

            if (LeftPane.HasControls() || LeftPane.Text.Trim() != String.Empty)
            {
                LeftPane.Visible = true;
                leftToContentSeparator.Visible = true;
            }
            else
            {
                LeftPane.Visible = false;
                leftToContentSeparator.Visible = false;
            }


            TableCell contentCell = cells[3];

            contentCell.MergeStyle(this.ContentPaneStyle);

            TableCell contentToRightSeparator = cells[4];

            contentToRightSeparator.MergeStyle(this.VerticalSeparatorStyle);

            TableCell rightCell = cells[5];

            rightCell.MergeStyle(this.RightPaneStyle);

            TableCell lastSeparator = cells[6];

            lastSeparator.Visible = ShowLastSeparator;
            lastSeparator.MergeStyle(this.VerticalSeparatorStyle);

            if (RightPane.HasControls() || RightPane.Text.Trim() != String.Empty)
            {
                contentToRightSeparator.Visible = true;
                RightPane.Visible = true;
            }
            else
            {
                contentToRightSeparator.Visible = false;
                RightPane.Visible = false;
            }
        }
Пример #13
0
 private void OnRefreshPanes(RefreshPanesEventArgs e)
 {
     LeftPane.Refresh(false);
     RightPane.Refresh(false);
 }