Esempio n. 1
0
        public void InsertTab(IProfilingTab newTab, IProfilingTab after)
        {
            if (newTab == null)
            {
                throw new ArgumentNullException(nameof(newTab));
            }
            if (after == null && newTab.GetType() != typeof(HomeTab))            //We don't want anyone to remove Home tab
            {
                throw new ArgumentNullException(nameof(after));
            }
            if (after != null && !Tabs.Select(t => t.Tab).Contains(after))
            {
                throw new ArgumentOutOfRangeException($"Tab '{after.GetType().Name}' not present in current tabs.");
            }
            //Remove everything after 'after'(if after is null remove everything)
            while (Tabs.Any() && Tabs.Last().Tab != after)
            {
                TabsOnLeft.Items.Remove(TabsOnLeft.Items.Last());
            }
            newTab.InsertTab += InsertTab;
            var tabView = new TabView(newTab);

            tabView.Clicked += TabView_Clicked;
            TabsOnLeft.Items.Add(tabView);
            Select(tabView);
        }
Esempio n. 2
0
        public MainForm()
        {
            calculator = new BiorhythmCalculator();
            calculator.Load();


            standardGraphView = new StandardGraphView(calculator);
            percentageView    = new PercentageView(calculator);
            settingsMenu      = new SettingMenu(this.Handle, calculator);

            tabView = new TabView(this.Handle);

            tabView.TabPages.Add(new TabPage(standardGraphView, "Standard"));
            //tabView.TabPages.Add(new TabPage(extraGraphView, "Extra"));
            tabView.TabPages.Add(new TabPage(percentageView, "Percentage"));
            tabView.ToolsSweep.Enabled   = true;
            tabView.ToolsSweep.Occurred += new System.ComponentModel.CancelEventHandler(ToolsSweep_Occurred);

            percentageView.ToolsSweep.Enabled   = true;
            percentageView.ToolsSweep.Occurred += new System.ComponentModel.CancelEventHandler(ToolsSweep_Occurred);

            standardGraphView.ToolsSweep.Enabled   = true;
            standardGraphView.ToolsSweep.Occurred += new System.ComponentModel.CancelEventHandler(ToolsSweep_Occurred);

            tabView.Closed += new EventHandler(OnClose);

            this.Load += new EventHandler(MainForm_Load);
        }
Esempio n. 3
0
        void Select(TabView tabView)
        {
            bool foundIt = false;

            foreach (var tv in Tabs)
            {
                if (tv == tabView)
                {
                    foundIt            = true;
                    tv.BackgroundColor = Colors.Red;
                }
                else
                {
                    if (foundIt)
                    {
                        tv.BackgroundColor = Colors.Blue;
                    }
                    else
                    {
                        tv.BackgroundColor = Colors.Yellow;
                    }
                }
            }
            PlaceHolderForTabContent.Content = tabView.Tab.TabContent;
        }
        public TUserControl GetUserControl <TUserControl> (string tabViewID)
            where TUserControl : Control
        {
            TabbedMultiView multiView = UserControlMultiView;

            if (multiView == null)
            {
                throw new InvalidOperationException("Page has no UserControlMultiView.");
            }

            TabView view = (TabView)multiView.FindControl(tabViewID);

            if (view == null)
            {
                throw new ArgumentOutOfRangeException("No child control with ID " + tabViewID + " found.");
            }

            view.EnsureLazyControls();
            foreach (Control childControl in view.LazyControls)
            {
                if (childControl is TUserControl)
                {
                    return((TUserControl)childControl);
                }
            }

            throw new ArgumentOutOfRangeException("TabView " + ID + " has no lazy control of type " + typeof(TUserControl).Name + ".");
        }
Esempio n. 5
0
        public MainPage()
        {
            this.InitializeComponent();
            var tabView    = new TabView();
            var itemSource = new List <TabViewItem>
            {
                new TabViewItem {
                    Header = "Tab 1", Content = new TextBlock {
                        Text = "Hello Tab 1!"
                    }
                },
                new TabViewItem {
                    Header = "Tab 2", Content = new TextBlock {
                        Text = "Hello Tab 2!"
                    }
                },
                new TabViewItem {
                    Header = "Tab 3", Content = new TextBlock {
                        Text = "Hello Tab 3!"
                    }
                },
            };

            tabView.TabItemsSource = itemSource;
            MainPageFrame.Content  = tabView;
        }
Esempio n. 6
0
        public MainWindow()
        {
            this.InitializeComponent();

            view = new TabView()
            {
                VerticalAlignment = VerticalAlignment.Stretch
            };
            view.TabItems.Add(new TabViewItem {
                Header = "Twitter Like Button", Content = new MattHenleysLikeButton()
                {
                    VerticalAlignment = VerticalAlignment.Center
                }
            });
            view.TabItems.Add(new TabViewItem {
                Header = "Walking Cat", Content = new WalkingCat()
                {
                    VerticalAlignment = VerticalAlignment.Center
                }
            });
            view.TabItems.Add(new TabViewItem {
                Header = "Transparent Cube", Content = new TransparentCube()
                {
                    VerticalAlignment = VerticalAlignment.Center
                }
            });
            this.Content      = view;
            view.SizeChanged += View_SizeChanged;
        }
Esempio n. 7
0
        public void Deactivate()
        {
            if (contentPage != null)
            {
                navigator?.Remove(contentPage);
                contentPage.Dispose();
                contentPage = null;
                tabView     = null;
            }

            if (addBtn != null)
            {
                window?.Remove(addBtn);
                addBtn.Dispose();
                addBtn = null;
            }

            if (removeBtn != null)
            {
                window?.Remove(removeBtn);
                removeBtn.Dispose();
                removeBtn = null;
            }

            navigator = null;
            window    = null;
        }
Esempio n. 8
0
        public static TabView GetTabView()
        {
            var tabView = new TabView();

            tabView.SetStyle(Styles.GetTabViewStyle());
            return(tabView);
        }
Esempio n. 9
0
        private void TabDepartement_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabView tabView = sender as TabView;

            departementSelectionne = (Departement)tabView.SelectedItem;
            annees.Replace(GetAnnees(departementSelectionne.Id));
        }
Esempio n. 10
0
        private IDataEditControl AddPage(string id, string title, IconInfo icon, string path)
        {
            TabView view = new TabView();

            view.ID    = id + "_View";
            view.Title = title;
            view.Icon  = icon;
            MultiView.Views.Add(view);

            UserControl control = (UserControl)this.LoadControl(path);

            control.ID = IdentifierGenerator.HtmlStyle.GetValidIdentifier(Path.GetFileNameWithoutExtension(path));

            //EgoFormPageUserControl formPageControl = control as EgoFormPageUserControl;
            //if (formPageControl != null)
            //  formPageControl.FormPageObject = formPage;

            view.LazyControls.Add(control);

            IDataEditControl dataEditControl = control as IDataEditControl;

            if (dataEditControl != null)
            {
                dataEditControl.BusinessObject = (IBusinessObject)Function.Object;
                dataEditControl.LoadValues(IsPostBack);
                dataEditControl.Mode = Function.ReadOnly ? DataSourceMode.Read : DataSourceMode.Edit;
                return(dataEditControl);
            }

            return(null);
        }
Esempio n. 11
0
        private void CreateFindReplace(bool isFind = true)
        {
            winDialog = new Window(isFind ? "Find" : "Replace")
            {
                X           = Win.Bounds.Width / 2 - 30,
                Y           = Win.Bounds.Height / 2 - 10,
                ColorScheme = Colors.Menu
            };

            var tabView = new TabView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            tabView.AddTab(new TabView.Tab("Find", FindTab()), isFind);
            var replace = ReplaceTab();

            tabView.AddTab(new TabView.Tab("Replace", replace), !isFind);
            tabView.SelectedTabChanged += (s, e) => tabView.SelectedTab.View.FocusFirst();
            winDialog.Add(tabView);

            Win.Add(winDialog);

            winDialog.Width  = replace.Width + 4;
            winDialog.Height = replace.Height + 4;

            winDialog.SuperView.BringSubviewToFront(winDialog);
            winDialog.SetFocus();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //TODO błąd aplikacji przy przekręcaniu ekranu

            base.OnCreate(savedInstanceState);

            ViewPager viewPager = FindViewById <ViewPager>(Resource.Id.view_pager);

            sectionsPagerAdapter = new PlayersScoreSectionsPagerAdapter(this, SupportFragmentManager, viewPager);
            TabLayout tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            tabs.SetupWithViewPager(viewPager);

            LinearLayout view = (LinearLayout)tabs.GetChildAt(0);

            for (int i = 0; i < view.ChildCount; i++)
            {
                TabView tabView = (TabView)view.GetChildAt(i);
                for (int j = 0; j < tabView.ChildCount; j++)
                {
                    if (tabView.GetChildAt(j) is TextView textView)
                    {
                        textView.SetTextColor(Color.White);
                    }
                }
            }
        }
Esempio n. 13
0
        public void AddBookmark(string url, string title, TabView tv, MainWindow mw)
        {
            if (ItemsCount != 3)
                {

                    bookmarkItem = new BookmarkItem(url, title, tv, mainWindow, this);
                    Canvas canvas1 = new Canvas();
                    mainCanvas.Children.Add(canvas1);
                    Canvas.SetTop(canvas1, RowsCount * 105);
                    Canvas.SetLeft(bookmarkItem, ItemsCount * 177);
                    bookmarkItem.Width = bookmarkWidth;
                    bookmarkItem.Height = bookmarkHeight;
                    canvas1.Children.Add(bookmarkItem);
                    ItemsCount += 1;
                    if (ItemsCount == 3) {
                        ItemsCount = 0;
                        RowsCount += 1;
                    }
                    if (RowsCount >= 3)
                    {
                        mainCanvas.Height = (RowsCount + 1) * 110;
                    }

            }
        }
        //SimpleView에서 버튼 클릭 시 수행
        public void ClickMessage(string serial)
        {
            Console.WriteLine("SimpleView Click");
            //기존에 생성된 탭 탐색
            for (int i = 0; i < TabItems.Count; i++)
            {
                DXTabItem tmp = TabItems[i];
                if (tmp.Header.ToString() != "홈")
                {
                    if (((tmp.Content as TabView).DataContext as TabViewModel).Dev.Serial == serial)
                    {
                        Selected_tab = tmp;
                        return;
                    }
                }
            }
            //새로운 탭 생성
            DXTabItem tabitem = new DXTabItem();
            TabView   tabview = new TabView();

            foreach (TabViewModel vm in Dev_list)
            {
                if (vm.Dev.Serial == serial)
                {
                    tabview.DataContext = vm;
                    tabitem.Content     = tabview;
                    tabitem.Header      = "디바이스" + vm.Dev.Dev_num.ToString();
                }
            }
            TabItems.Add(tabitem);
            Selected_tab = tabitem;
        }
Esempio n. 15
0
        public MainForm()
        {
            calculator = new BiorhythmCalculator();
            calculator.Load();

            standardGraphView = new StandardGraphView(calculator);
            percentageView = new PercentageView(calculator);
            settingsMenu = new SettingMenu(this.Handle, calculator);

            tabView = new TabView(this.Handle);

            tabView.TabPages.Add(new TabPage(standardGraphView, "Standard"));
            //tabView.TabPages.Add(new TabPage(extraGraphView, "Extra"));
            tabView.TabPages.Add(new TabPage(percentageView, "Percentage"));
            tabView.ToolsSweep.Enabled = true;
            tabView.ToolsSweep.Occurred += new System.ComponentModel.CancelEventHandler(ToolsSweep_Occurred);

            percentageView.ToolsSweep.Enabled = true;
            percentageView.ToolsSweep.Occurred += new System.ComponentModel.CancelEventHandler(ToolsSweep_Occurred);

            standardGraphView.ToolsSweep.Enabled = true;
            standardGraphView.ToolsSweep.Occurred += new System.ComponentModel.CancelEventHandler(ToolsSweep_Occurred);

            tabView.Closed += new EventHandler(OnClose);

            this.Load += new EventHandler(MainForm_Load);
        }
Esempio n. 16
0
        public void TabView_WhenSettingTheActiveTab_KeepsCoherentState()
        {
            var tabView = new TabView();

            Assert.That(tabView.value, Is.EqualTo(-1));
            var tab1 = new TabContent {
                TabName = "Tab1"
            };
            var tab2 = new TabContent {
                TabName = "Tab2"
            };
            var tab3 = new TabContent {
                TabName = "Tab3"
            };
            var tabs = new List <TabContent> {
                tab1, tab2, tab3
            };

            tabView.Tabs = tabs;
            Assert.That(tabView.value, Is.EqualTo(-1));
            var header  = tabView.Q(className: "tab-view__tab-header");
            var content = tabView.Q(className: "tab-view__tab-content");

            for (var index = -2; index < 5; ++index)
            {
                var expectedIndex = index >= 0 && index < tabs.Count ? index : -1;
                tabView.value = index;
                Assert.That(tabView.value, Is.EqualTo(expectedIndex));

                for (var i = 0; i < tabs.Count; ++i)
                {
                    Assert.That(tabs[i].style.display, Is.EqualTo(new StyleEnum <DisplayStyle>(expectedIndex == i ? DisplayStyle.Flex : DisplayStyle.None)));
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Creates a new tab on the page's tab view.
        /// </summary>
        /// <returns>
        /// The <see cref="TabViewPage"/>.
        /// </returns>
        public TabViewPage CreateTab()
        {
            TabView tabView = this.WindowsApp.FindElement(this.tabViewQuery);

            tabView.CreateTab();
            return(this);
        }
Esempio n. 18
0
 private void OnTabItemsChanged(TabView sender, IVectorChangedEventArgs e)
 {
     if (e.CollectionChange == CollectionChange.ItemInserted)
     {
         SelectedIndex = (int)e.Index;
     }
 }
Esempio n. 19
0
        /// <summary>
        /// Closes a tab on the page's tab view with the specified name.
        /// </summary>
        /// <param name="name">The name of the tab.</param>
        /// <returns>The <see cref="TabViewPage"/>.</returns>
        public TabViewPage CloseTab(string name)
        {
            TabView tabView = this.WindowsApp.FindElement(this.tabViewQuery);

            tabView.CloseTab(name);
            return(this);
        }
    public static TabView CreateTab(TabBar tabBar)
    {
        var tab = new TabView("Kits");

        tabBar.AddTab(tab);

        var analyticsEditor = new AnalyticsToggleEditor();
        var authEditor      = new AuthToggleEditor();
        var accountEditor   = new AccountToggleEditor();

        tab.AddDrawer(new HorizontalLine());
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new AdsToggleEditor(tabBar), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new GameServiceToggleEditor(tabBar, accountEditor), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new PushToggleEditor(), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new IAPToggleEditor(tabBar), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), accountEditor, new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), analyticsEditor, new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new RemoteConfigToggleEditor(tabBar, analyticsEditor), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new CrashToggleEditor(analyticsEditor), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), authEditor, new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new CloudDBToggleEditor(authEditor), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new DriveKitToggleEditor(), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new NearbyServiceToggleEditor(), new Spacer()));
        tab.AddDrawer(new HorizontalSequenceDrawer(new Spacer(), new AppMessagingToggleEditor(), new Spacer()));
        tab.AddDrawer(new HorizontalLine());
        tab.AddDrawer(new Spacer());
        tab.AddDrawer(new HelpboxAGConnectFile());

        return(tab);
    }
Esempio n. 21
0
        private void InitializeTabView(TabView tabView)
        {
            tabView.TabItems.AddRange(new[]
            {
                new TabItem()
                {
                    Title = string.Format(Strings.Tab, 1)
                },
                new TabItem()
                {
                    Title = string.Format(Strings.Tab, 2)
                },
                new TabItem()
                {
                    Title = string.Format(Strings.Tab, 3)
                },
                new TabItem()
                {
                    Title = string.Format(Strings.Tab, 4)
                },
                new TabItem()
                {
                    Title = string.Format(Strings.Tab, 5)
                },
            });

            Window.Current.Content = tabView;
        }
Esempio n. 22
0
        public void TabView_WhenSettingTabs_CreatesExpectedHierarchy()
        {
            var tabView = new TabView();

            var header = tabView.Q(className: "tab-view__tab-header");
            var tabs   = new List <TabContent>();

            for (var size = 3; size >= 0; --size, tabs.Clear())
            {
                for (var i = 0; i < size; ++i)
                {
                    tabs.Add(new TabContent {
                        TabName = $"Tab{i}"
                    });
                }
                tabView.Tabs = tabs;

                // Header
                Assert.That(header.childCount, Is.EqualTo(tabs.Count));
                var tabLabels = header.Query <Label>().ToList();
                for (var i = 0; i < tabs.Count; ++i)
                {
                    Assert.That(tabLabels[i].text, Is.EqualTo(tabs[i].TabName));
                }

                // Content
                Assert.That(tabView.contentContainer.childCount, Is.EqualTo(tabs.Count));
                for (var i = 0; i < tabs.Count; ++i)
                {
                    Assert.That(tabView[i], Is.EqualTo(tabs[i]));
                }
            }
        }
Esempio n. 23
0
        public InstanceTabsView()
        {
            this.InitializeComponent();
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
            var CoreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            CoreTitleBar.ExtendViewIntoTitleBar = true;
            tabView = TabStrip;

            var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"];

            if (flowDirectionSetting == "RTL")
            {
                FlowDirection = FlowDirection.RightToLeft;
            }

            App.AppSettings             = new SettingsViewModel();
            App.InteractionViewModel    = new InteractionViewModel();
            App.SidebarPinnedController = new SidebarPinnedController();

            App.ConsentDialogDisplay    = new Dialogs.ConsentDialog();
            App.PropertiesDialogDisplay = new Dialogs.PropertiesDialog();
            App.LayoutDialogDisplay     = new Dialogs.LayoutDialog();
            App.AddItemDialogDisplay    = new Dialogs.AddItemDialog();
            App.ExceptionDialogDisplay  = new Dialogs.ExceptionDialog();
            // Turn on Navigation Cache
            this.NavigationCacheMode  = NavigationCacheMode.Enabled;
            Clipboard.ContentChanged += App.Clipboard_ContentChanged;
            App.Clipboard_ContentChanged(null, null);
            Window.Current.SizeChanged += Current_SizeChanged;
            Current_SizeChanged(null, null);

            Helpers.ThemeHelper.Initialize();
        }
        private void TabStrip_TabDragStarting(TabView sender, TabViewTabDragStartingEventArgs args)
        {
            var tabViewItemPath = ((((args.Item as TabItem).Content as Grid).Children[0] as Frame).Tag as TabItemContent).NavigationArg;

            args.Data.Properties.Add(TabPathIdentifier, tabViewItemPath);
            args.Data.RequestedOperation = DataPackageOperation.Move;
        }
Esempio n. 25
0
        public InstanceTabsView()
        {
            this.InitializeComponent();
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
            var CoreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            CoreTitleBar.ExtendViewIntoTitleBar = true;
            tabView = TabStrip;

            var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"];

            if (flowDirectionSetting == "RTL")
            {
                FlowDirection = FlowDirection.RightToLeft;
            }

            App.AppSettings          = new SettingsViewModel();
            App.InteractionViewModel = new InteractionViewModel();

            // Turn on Navigation Cache
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            Window.Current.SizeChanged += Current_SizeChanged;
            Current_SizeChanged(null, null);

            Helpers.ThemeHelper.Initialize();
        }
Esempio n. 26
0
        private void VerticalTabView_TabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs args)
        {
            switch (args.CollectionChange)
            {
            case Windows.Foundation.Collections.CollectionChange.ItemRemoved:
                App.InteractionViewModel.TabStripSelectedIndex = Items.IndexOf(VerticalTabView.SelectedItem as TabItem);
                break;

            case Windows.Foundation.Collections.CollectionChange.ItemInserted:
                App.InteractionViewModel.TabStripSelectedIndex = (int)args.Index;
                break;
            }

            if (App.InteractionViewModel.TabStripSelectedIndex >= 0 && App.InteractionViewModel.TabStripSelectedIndex < Items.Count)
            {
                CurrentSelectedAppInstance = GetCurrentSelectedTabInstance();

                if (CurrentSelectedAppInstance != null)
                {
                    OnCurrentInstanceChanged(new CurrentInstanceChangedEventArgs()
                    {
                        CurrentInstance = CurrentSelectedAppInstance,
                        PageInstances   = GetAllTabInstances()
                    });
                }
            }
        }
        public Controller()
        {
            _graphics           = new ConsoleGraphics();
            _userActionListener = new UserActionListener();
            _modularWindow      = new ModularWindow(_graphics);
            _fileSystemService  = new FileSystemService();

            _tabs = new List <Tab>()
            {
                new Tab(Settings.LeftWindowCoordinateX, Settings.WindowCoordinateY, _userActionListener, _fileSystemService)
                {
                    IsActive = true
                },
                new Tab(Settings.RigthWindowCoordinateX, Settings.WindowCoordinateY, _userActionListener, _fileSystemService)
            };

            _systemItemView = new SystemItemView(_graphics);
            _tabView        = new TabView(_tabs, _graphics, _systemItemView);
            _hints          = new Hints(_graphics);

            _userActionListener.TabSwitching         += SelectNextTab;
            _userActionListener.PropertyRequest      += GetProperty;
            _userActionListener.FileServiceOperation += OperationEventHandler;
            _userActionListener.CompletionOfWork     += () => Exit = true;
        }
Esempio n. 28
0
        public void Deactivate()
        {
            var window = NUIApplication.GetDefaultWindow();

            if (tabView != null)
            {
                window.Remove(tabView);
                tabView.Dispose();
                tabView = null;
            }

            if (addBtn != null)
            {
                window.Remove(addBtn);
                addBtn.Dispose();
                addBtn = null;
            }

            if (removeBtn != null)
            {
                window.Remove(removeBtn);
                removeBtn.Dispose();
                removeBtn = null;
            }
        }
Esempio n. 29
0
        private void AddTab(int index, ICharSequence text, int iconResId)
        {
            var tabView = new TabView(Context, this)
            {
                Focusable = true, Index = index, TextFormatted = text
            };

            tabView.Click += (sender, args) =>
            {
                var tabview     = (TabView)sender;
                var oldSelected = _viewPager.CurrentItem;
                var newSelected = tabview.Index;

                _viewPager.CurrentItem = newSelected;
                if (oldSelected == newSelected && TabReselected != null)
                {
                    TabReselected(this, new TabReselectedEventArgs {
                        Position = newSelected
                    });
                }
            };

            if (iconResId != 0)
            {
                tabView.SetCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
            }

            _tabLayout.AddView(tabView, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, 1));
        }
        private void TabStrip_TabDragStarting(TabView sender, TabViewTabDragStartingEventArgs args)
        {
            var tabViewItemArgs = (args.Item as TabItem).TabItemArguments;

            args.Data.Properties.Add(TabPathIdentifier, tabViewItemArgs.Serialize());
            args.Data.RequestedOperation = DataPackageOperation.Move;
        }
Esempio n. 31
0
        public void AddBookmark(string url, string title, TabView tv, MainWindow mw)
        {
            if (ItemsCount != 3)
            {
                bookmarkItem = new BookmarkPanelItem(url, title, tv, mw, this);
                Canvas canvas1 = new Canvas();
                mainCanvas.Children.Add(canvas1);
                Canvas.SetTop(canvas1, RowsCount * bookmarkTop);
                Canvas.SetLeft(bookmarkItem, ItemsCount * bookmarkLeft);
                bookmarkItem.Width = bookmarkWidth;

                bookmarkItem.Height = bookmarkHeight;
                canvas1.Children.Add(bookmarkItem);
                ItemsCount += 1;
                if (ItemsCount == 3)
                {
                    ItemsCount = 0;
                    RowsCount += 1;
                }
                if (RowsCount > 3)
                {
                    mainCanvas.Height = (RowsCount + 1) * bookmarkTop;
                }
            }
        }
Esempio n. 32
0
        public MainForm(IDataLoader dataLoader)
        {
            if (dataLoader == null)
            {
                throw new ArgumentNullException("Invalid data loader.");
            }

            this._dataLoader = dataLoader;

            this.InitializeComponent();

            this._tabView  = new TabView(this.tab);
            this._pathView = new PathView(this.pathContainer);
            this._itemList = new ItemList(this.list);
            this._itemView = new ItemView(this.listView);

            this._tabView.IndexChanged  += this.OnCategoryChanged;
            this._itemList.ItemSelected += this.OnItemSelected;
            this._itemView.ItemSelected += this.OnProperySelected;

            this._mruMenu = new MruStripMenu(this.menuRecentFile, this.OnMruFile, MRU_REG_KEY + "\\RecentFiles", false);
            this._mruMenu.LoadFromRegistry();
            this.CheckRecentFiles();

            if (this._mruMenu.GetFiles().Length > 0)
            {
                this.OnMruFile(0, this._mruMenu.GetFileAt(0));
            }
        }
 public BookmarkItem(string url, string title, TabView tv, MainWindow mw, Bookmarks books)
 {
     InitializeComponent();
     _url = url;
     _tv = tv;
     label.Content = title;
     Loaded += BookmarkItem_Loaded;
     mainWindow = mw;
     bookmarks = books;
 }
Esempio n. 34
0
        // Also known as "closure hell"
        public static IView View()
        {
            ListSelectView<OrbitDriver> currentlyEditing = null;
            Action<OrbitDriver> onCurrentlyEditingChange = null;

            var setToCurrentOrbit = new ButtonView("Set to current orbit", "Sets all the fields of the editor to reflect the orbit of the currently selected vessel",
                () => onCurrentlyEditingChange(currentlyEditing.CurrentlySelected));

            var referenceSelector = new ListSelectView<CelestialBody>("Reference body", () => FlightGlobals.fetch == null ? null : FlightGlobals.fetch.bodies, null, Extensions.CbToString);

            #region Simple
            var simpleAltitude = new TextBoxView<double>("Altitude", "Altitude of circular orbit", 110000, Model.SiSuffix.TryParse);
            var simpleApply = new ConditionalView(() => simpleAltitude.Valid && referenceSelector.CurrentlySelected != null,
                                  new ButtonView("Apply", "Sets the orbit", () =>
                    {
                        Model.OrbitEditor.Simple(currentlyEditing.CurrentlySelected, simpleAltitude.Object, referenceSelector.CurrentlySelected);

                        currentlyEditing.ReInvokeOnSelect();
                    }));
            var simple = new VerticalView(new IView[]
                {
                    simpleAltitude,
                    referenceSelector,
                    simpleApply,
                    setToCurrentOrbit
                });
            #endregion

            #region Complex
            var complexInclination = new TextBoxView<double>("Inclination", "How close to the equator the orbit plane is", 0, double.TryParse);
            var complexEccentricity = new TextBoxView<double>("Eccentricity", "How circular the orbit is (0=circular, 0.5=elliptical, 1=parabolic)", 0, double.TryParse);
            var complexSemiMajorAxis = new TextBoxView<double>("Semi-major axis", "Mean radius of the orbit (ish)", 10000000, Model.SiSuffix.TryParse);
            var complexLongitudeAscendingNode = new TextBoxView<double>("Lon. of asc. node", "Longitude of the place where you cross the equator northwards", 0, double.TryParse);
            var complexArgumentOfPeriapsis = new TextBoxView<double>("Argument of periapsis", "Rotation of the orbit around the normal", 0, double.TryParse);
            var complexMeanAnomalyAtEpoch = new TextBoxView<double>("Mean anomaly at epoch", "Position along the orbit at the epoch", 0, double.TryParse);
            var complexEpoch = new TextBoxView<double>("Epoch", "Epoch at which mEp is measured", 0, Model.SiSuffix.TryParse);
            var complexEpochNow = new ButtonView("Set epoch to now", "Sets the Epoch field to the current time", () => complexEpoch.Object = Planetarium.GetUniversalTime());
            var complexApply = new ConditionalView(() => complexInclination.Valid &&
                                   complexEccentricity.Valid &&
                                   complexSemiMajorAxis.Valid &&
                                   complexLongitudeAscendingNode.Valid &&
                                   complexArgumentOfPeriapsis.Valid &&
                                   complexMeanAnomalyAtEpoch.Valid &&
                                   complexEpoch.Valid &&
                                   referenceSelector.CurrentlySelected != null,
                                   new ButtonView("Apply", "Sets the orbit", () =>
                    {
                        Model.OrbitEditor.Complex(currentlyEditing.CurrentlySelected,
                            complexInclination.Object,
                            complexEccentricity.Object,
                            complexSemiMajorAxis.Object,
                            complexLongitudeAscendingNode.Object,
                            complexArgumentOfPeriapsis.Object,
                            complexMeanAnomalyAtEpoch.Object,
                            complexEpoch.Object,
                            referenceSelector.CurrentlySelected);

                        currentlyEditing.ReInvokeOnSelect();
                    }));
            var complex = new VerticalView(new IView[]
                {
                    complexInclination,
                    complexEccentricity,
                    complexSemiMajorAxis,
                    complexLongitudeAscendingNode,
                    complexArgumentOfPeriapsis,
                    complexMeanAnomalyAtEpoch,
                    complexEpoch,
                    complexEpochNow,
                    referenceSelector,
                    complexApply,
                    setToCurrentOrbit
                });
            #endregion

            #region Graphical
            SliderView graphicalInclination = null;
            SliderView graphicalEccentricity = null;
            SliderView graphicalPeriapsis = null;
            SliderView graphicalLongitudeAscendingNode = null;
            SliderView graphicalArgumentOfPeriapsis = null;
            SliderView graphicalMeanAnomaly = null;
            double graphicalEpoch = 0;

            Action<double> graphicalOnChange = ignored =>
            {
                Model.OrbitEditor.Graphical(currentlyEditing.CurrentlySelected,
                    graphicalInclination.Value,
                    graphicalEccentricity.Value,
                    graphicalPeriapsis.Value,
                    graphicalLongitudeAscendingNode.Value,
                    graphicalArgumentOfPeriapsis.Value,
                    graphicalMeanAnomaly.Value,
                    graphicalEpoch);

                currentlyEditing.ReInvokeOnSelect();
            };

            graphicalInclination = new SliderView("Inclination", "How close to the equator the orbit plane is", graphicalOnChange);
            graphicalEccentricity = new SliderView("Eccentricity", "How circular the orbit is", graphicalOnChange);
            graphicalPeriapsis = new SliderView("Periapsis", "Lowest point in the orbit", graphicalOnChange);
            graphicalLongitudeAscendingNode = new SliderView("Lon. of asc. node", "Longitude of the place where you cross the equator northwards", graphicalOnChange);
            graphicalArgumentOfPeriapsis = new SliderView("Argument of periapsis", "Rotation of the orbit around the normal", graphicalOnChange);
            graphicalMeanAnomaly = new SliderView("Mean anomaly", "Position along the orbit", graphicalOnChange);

            var graphical = new VerticalView(new IView[]
                {
                    graphicalInclination,
                    graphicalEccentricity,
                    graphicalPeriapsis,
                    graphicalLongitudeAscendingNode,
                    graphicalArgumentOfPeriapsis,
                    graphicalMeanAnomaly,
                    setToCurrentOrbit
                });
            #endregion

            #region Velocity
            var velocitySpeed = new TextBoxView<double>("Speed", "dV to apply", 0, Model.SiSuffix.TryParse);
            var velocityDirection = new ListSelectView<Model.OrbitEditor.VelocityChangeDirection>("Direction", () => Model.OrbitEditor.AllVelocityChanges);
            var velocityApply = new ConditionalView(() => velocitySpeed.Valid,
                                    new ButtonView("Apply", "Adds the selected velocity to the orbit", () =>
                    {
                        Model.OrbitEditor.Velocity(currentlyEditing.CurrentlySelected, velocityDirection.CurrentlySelected, velocitySpeed.Object);
                    }));
            var velocity = new VerticalView(new IView[]
                {
                    velocitySpeed,
                    velocityDirection,
                    velocityApply
                });
            #endregion

            #region Rendezvous
            var rendezvousLeadTime = new TextBoxView<double>("Lead time", "How many seconds off to rendezvous at (zero = on top of each other, bad)", 1, Model.SiSuffix.TryParse);
            var rendezvousVessel = new ListSelectView<Vessel>("Target vessel", () => FlightGlobals.fetch == null ? null : FlightGlobals.fetch.vessels, null, Extensions.VesselToString);
            var rendezvousApply = new ConditionalView(() => rendezvousLeadTime.Valid && rendezvousVessel.CurrentlySelected != null,
                                      new ButtonView("Apply", "Rendezvous", () =>
                    {
                        Model.OrbitEditor.Rendezvous(currentlyEditing.CurrentlySelected, rendezvousLeadTime.Object, rendezvousVessel.CurrentlySelected);
                    }));
            // rendezvous gets special ConditionalView to force only editing of planets
            var rendezvous = new ConditionalView(() => currentlyEditing.CurrentlySelected != null && currentlyEditing.CurrentlySelected.vessel != null,
                                 new VerticalView(new IView[]
                    {
                        rendezvousLeadTime,
                        rendezvousVessel,
                        rendezvousApply
                    }));
            #endregion

            #region CurrentlyEditing
            onCurrentlyEditingChange = newEditing =>
            {
                if (newEditing == null)
                {
                    return;
                }
                {
                    double altitude;
                    CelestialBody body;
                    Model.OrbitEditor.GetSimple(newEditing, out altitude, out body);
                    simpleAltitude.Object = altitude;
                    referenceSelector.CurrentlySelected = body;
                }
                {
                    double inclination;
                    double eccentricity;
                    double semiMajorAxis;
                    double longitudeAscendingNode;
                    double argumentOfPeriapsis;
                    double meanAnomalyAtEpoch;
                    double epoch;
                    CelestialBody body;
                    Model.OrbitEditor.GetComplex(newEditing,
                        out inclination,
                        out eccentricity,
                        out semiMajorAxis,
                        out longitudeAscendingNode,
                        out argumentOfPeriapsis,
                        out meanAnomalyAtEpoch,
                        out epoch,
                        out body);
                    complexInclination.Object = inclination;
                    complexEccentricity.Object = eccentricity;
                    complexSemiMajorAxis.Object = semiMajorAxis;
                    complexLongitudeAscendingNode.Object = longitudeAscendingNode;
                    complexArgumentOfPeriapsis.Object = argumentOfPeriapsis;
                    complexMeanAnomalyAtEpoch.Object = meanAnomalyAtEpoch;
                    complexEpoch.Object = epoch;
                    referenceSelector.CurrentlySelected = body;
                }
                {
                    double inclination;
                    double eccentricity;
                    double periapsis;
                    double longitudeAscendingNode;
                    double argumentOfPeriapsis;
                    double meanAnomaly;
                    Model.OrbitEditor.GetGraphical(newEditing,
                        out inclination,
                        out eccentricity,
                        out periapsis,
                        out longitudeAscendingNode,
                        out argumentOfPeriapsis,
                        out meanAnomaly,
                        out graphicalEpoch);
                    graphicalInclination.Value = inclination;
                    graphicalEccentricity.Value = eccentricity;
                    graphicalPeriapsis.Value = periapsis;
                    graphicalLongitudeAscendingNode.Value = longitudeAscendingNode;
                    graphicalArgumentOfPeriapsis.Value = argumentOfPeriapsis;
                    graphicalMeanAnomaly.Value = meanAnomaly;
                }
                {
                    Model.OrbitEditor.VelocityChangeDirection direction;
                    double speed;
                    Model.OrbitEditor.GetVelocity(newEditing, out direction, out speed);
                    velocityDirection.CurrentlySelected = direction;
                    velocitySpeed.Object = speed;
                }
            };

            currentlyEditing = new ListSelectView<OrbitDriver>("Currently editing", Model.OrbitEditor.OrderedOrbits, onCurrentlyEditingChange, Extensions.OrbitDriverToString);

            if (FlightGlobals.fetch != null && FlightGlobals.fetch.activeVessel != null && FlightGlobals.fetch.activeVessel.orbitDriver != null)
            {
                currentlyEditing.CurrentlySelected = FlightGlobals.fetch.activeVessel.orbitDriver;
            }
            #endregion

            var savePlanet = new ButtonView("Save planet", "Saves the current orbit of the planet to a file, so it stays edited even after a restart. Delete the file named the planet's name in " + IoExt.GetPath(null) + " to undo.",
                                 () => Model.PlanetEditor.SavePlanet(currentlyEditing.CurrentlySelected.celestialBody));
            var resetPlanet = new ButtonView("Reset to defaults", "Reset the selected planet to defaults",
                                  () => Model.PlanetEditor.ResetToDefault(currentlyEditing.CurrentlySelected.celestialBody));

            var planetButtons = new ConditionalView(() => currentlyEditing.CurrentlySelected?.celestialBody != null,
                                    new VerticalView(new IView[]
                    {
                        savePlanet,
                        resetPlanet
                    }));

            var tabs = new TabView(new List<KeyValuePair<string, IView>>()
                {
                    new KeyValuePair<string, IView>("Simple", simple),
                    new KeyValuePair<string, IView>("Complex", complex),
                    new KeyValuePair<string, IView>("Graphical", graphical),
                    new KeyValuePair<string, IView>("Velocity", velocity),
                    new KeyValuePair<string, IView>("Rendezvous", rendezvous),
                });

            return new VerticalView(new IView[]
                {
                    currentlyEditing,
                    planetButtons,
                    new ConditionalView(() => currentlyEditing.CurrentlySelected != null, tabs)
                });
        }
        private void addTab(int index, string text, int iconResId)
        {
            TabView tabView = new TabView(this);

            tabView.mIndex = index;
            tabView.Focusable = true;
            tabView.SetOnClickListener(mTabClickListener);

            tabView.Text = text;

            if (iconResId != 0)
            {
                tabView.SetCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
            }

            mTabLayout.AddView(tabView, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, 1));
        }
        void TabBtn_Clicked(object sender, EventArgs e)
        {
            string id = ((iiButton)sender).ClassId;
            switch (id)
            {
                case "3":
                    try
                    {
                        _tabView = TabView.Balance;
                        layoutContent.Children.Clear();
                        parent = BalanceLeaveLayout();
                        layoutContent.Children.Clear();
                        layoutContent.Children.Add(parent);
                        listView.ItemsSource = ViewModel.EmployeeList;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Exception : {0}", ex.InnerException);
                    }
                    break;
                case "4":
                    try
                    {
                        _tabView = TabView.Calendar;
                        layoutContent.Children.Clear();
                        parent = CalendarViewLayout();
                        layoutContent.Children.Clear();
                        layoutContent.Children.Add(parent);

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Exception : {0}", ex.InnerException);
                    }
                    break;
                case "5":
                    try
                    {
                        _tabView = TabView.Holidays;
                        layoutContent.Children.Clear();
                        parent = HolidayViewLayout();
                        layoutContent.Children.Clear();
                        layoutContent.Children.Add(parent);

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Exception : {0}", ex.InnerException);
                    }
                    break;
                default:
                    break;
            }
        }
        private void AddTab(int index, ICharSequence text, int iconResId, GravityFlags iconGravity)
        {
            var tabView = new TabView(Context, this) {Focusable = true, Index = index, TextFormatted = text};
            tabView.Click += (sender, args) =>
            {
                var tabview = (TabView)sender;
                var oldSelected = _viewPager.CurrentItem;
                var newSelected = tabview.Index;

                _viewPager.CurrentItem = newSelected;
                if(oldSelected == newSelected && TabReselected != null)
                    TabReselected(this, new TabReselectedEventArgs { Position = newSelected });
            };

            if (iconResId != 0)
            {
                switch (iconGravity) {
                case GravityFlags.Top:
                    tabView.SetCompoundDrawablesWithIntrinsicBounds(0, iconResId, 0, 0);
                    break;
                case GravityFlags.Right:
                    tabView.SetCompoundDrawablesWithIntrinsicBounds(0, 0, iconResId, 0);
                    break;
                case GravityFlags.Bottom:
                    tabView.SetCompoundDrawablesWithIntrinsicBounds(0, 0, 0, iconResId);
                    break;
                case GravityFlags.Left:
                default:
                    tabView.SetCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
                    break;
                }
            }

            _tabLayout.AddView(tabView, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, 1));
        }