protected override async void OnNavigatedTo(NavigationEventArgs e) { NavigationFrame.Navigated += NavigationFrameOnNavigated; NavView.BackRequested += NavView_BackRequested; // Get list of samples var sampleCategories = await Samples.GetCategoriesAsync(); NavView.MenuItemsSource = sampleCategories; SetAppTitle(string.Empty); NavigateToSample(null); if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString())) { var parser = DeepLinkParser.Create(e.Parameter.ToString()); var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]); if (targetSample != null) { NavigateToSample(targetSample); } } // NavView goes into a weird size on load unless the window size changes // Needs a gentle push to update layout NavView.Loaded += (s, args) => NavView.InvalidateMeasure(); }
/* Permet de dupliquer un onglet via un contextmenu (clic droit) */ private void Click_Item_Duplicate(object sender, RoutedEventArgs e) { TabItem tab = (TabItem)((ContextMenu)(((MenuItem)sender).Parent)).PlacementTarget; NavView view = GetNavView(tab); string url = view.Browser.Address; CreateNewTab(url); }
public void FinishNavigationDrawer() { NavView.FindViewById(Resource.Id.createAccountButton).Click -= CreateAccount_Click; NavView.FindViewById(Resource.Id.alreadyHaveAccountButton).Click -= SignIn_Click; NavView.FindViewById(Resource.Id.about_upward).Click -= GoToAppInfo_Click; NavView.FindViewById(Resource.Id.drawerLogout).Click -= Logout_Click; }
/* Evènement attribué à la création de nouveaux favoris pour la navigation vers le lien lié */ private void GoToFav_Click(object sender, RoutedEventArgs e) { TabItem tab = (TabItem)MainTabControl.SelectedItem; Frame frame = (Frame)tab.Content; NavView view = (NavView)frame.Content; var x = sender; view.Browser.Address = (String)((MenuItem)sender).Header; }
private async void GetDrawerInfo() { var profile = await _profileDrawerControllerService.GetUserProfile(); RunOnUiThread(() => { if (profile != null) { //set up profile picture, logout button and favorites if the user is logged in LoggedIn = true; NavView.FindViewById(Resource.Id.drawerNonAuthenticatedHeader).Visibility = ViewStates.Gone; NavView.FindViewById(Resource.Id.drawerLogout).Visibility = ViewStates.Visible; var authHeader = NavView.FindViewById(Resource.Id.drawerAuthenticatedHeader); authHeader.Visibility = ViewStates.Visible; Picasso.With(this).Load(profile.ProfileImageUrl) .Into(authHeader.FindViewById <ImageView>(Resource.Id.drawerAuthenticatedHeader_Avatar)); authHeader.Tag = profile.ProfileId; authHeader.SetOnClickListener(this); authHeader.FindViewById <TextView>(Resource.Id.drawerUser_Fullname).Text = profile.ProfileFirstName + " " + profile.ProfileLastName; authHeader.FindViewById <TextView>(Resource.Id.drawerUser_Handle).Text = profile.ProfileHandle; //Setting up auth tab layout //MainTabLayout.Visibility = ViewStates.Visible; Fab.Visibility = ViewStates.Visible; //TODO: Change these to real fragments later if (Fragments.Count == 1) { Fragments.Add(NotificationFragment.NewInstance()); Fragments.Add(NotificationFragment.NewInstance()); } MainFragAdapter.NotifyDataSetChanged(); SetTabIcons(); } else { //set up icon and hide tab layout when user is not logged in LoggedIn = false; Fab.Visibility = ViewStates.Gone; NavView.FindViewById(Resource.Id.drawerLogout).Visibility = ViewStates.Gone; NavView.FindViewById(Resource.Id.drawerNonAuthenticatedHeader).Visibility = ViewStates.Visible; NavView.FindViewById(Resource.Id.drawerAuthenticatedHeader).Visibility = ViewStates.Gone; NavView.FindViewById <ImageView>(Resource.Id.drawerNonAuthenticatedHeader_Avatar) .SetImageDrawable( ViewUtil.GetSVGDrawable(this, "profile_empty", 200, Resource.Color.Upward_dark_grey)); MainTabLayout.Visibility = ViewStates.Gone; } PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).Edit() .PutBoolean(Constants.PREF_SIGNED_IN_KEY, LoggedIn).Commit(); }); }
/* Récupération, grâce à l'API Google, de l'icône du site actuel, en size 64, pour les onglets et favoris */ private ImageSource BitmapImageWithTab(TabItem tab) { NavView view = GetNavView(tab); ChromiumWebBrowser browser = view.Browser; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri("https://www.google.com/s2/favicons?sz=64&domain=" + browser.Address); bitmap.EndInit(); return(bitmap); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ISession session = new Session(); MainForm mainForm = new MainForm(); INavView navView = new NavView(); IMainPresenter mainPresenter = new MainPresenter(session, mainForm); mainPresenter.setNav(navView); mainPresenter.LoadViewNavPanel(); Application.Run(mainForm); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { NavigationFrame.Navigated += NavigationFrameOnNavigated; NavView.BackRequested += NavView_BackRequested; #if HAS_UNO if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString())) { var parser = DeepLinkParser.Create(e.Parameter.ToString()); System.Console.WriteLine($"Deeplink Root:{parser.Root}, Keys: {string.Join(",", parser.Keys)}"); if (parser.TryGetValue("ShowUnoUnsupported", out var showUnoUnsupportedString) && bool.TryParse(showUnoUnsupportedString, out bool showUnoUnsupported)) { Console.WriteLine($""); Samples.ShowUnoUnsupported = showUnoUnsupported; } } #endif // Get list of samples var sampleCategories = await Samples.GetCategoriesAsync(); System.Console.WriteLine($"Got {sampleCategories.Count} categorie (p: {e.Parameter})"); NavView.MenuItemsSource = sampleCategories; SetAppTitle(string.Empty); NavigateToSample(null); if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString())) { var parser = DeepLinkParser.Create(e.Parameter.ToString()); if (parser.TryGetValue("sample", out var sample)) { var targetSample = await Sample.FindAsync(parser.Root, sample); if (targetSample != null) { NavigateToSample(targetSample); } } } // NavView goes into a weird size on load unless the window size changes // Needs a gentle push to update layout NavView.Loaded += (s, args) => NavView.InvalidateMeasure(); System.Console.WriteLine($"Done navigating"); }
public MainWindow() { InitializeComponent(); if (App.RepositoryImageMode) { Width = 1280; Height = 640; NavView.ClearValue(PaddingProperty); NavView.ClearValue(HamburgerMenuEx.HeaderTemplateProperty); NavViewItems.RemoveAt(NavViewItems.Count - 1); } UpdateAppTitleBarMargin(NavView); NavView.SelectedItem = NavViewItems.OfType <HamburgerMenuItem>().First(); Navigate(NavView.SelectedItem); }
public MainWindow() { InitializeComponent(); if (App.RepositoryImageMode) { Width = 1280; Height = 640; NavView.ClearValue(PaddingProperty); NavView.ClearValue(NavigationView.HeaderTemplateProperty); NavView.MenuItems.RemoveAt(NavView.MenuItems.Count - 1); } NavView.SelectedItem = NavView.MenuItems.OfType <NavigationViewItem>().First(); Navigate(NavView.SelectedItem); Loaded += delegate { UpdateAppTitle(); }; }
public MainPage() { this.InitializeComponent(); viewModel = new AutoSuggestViewModel(); viewModel.LocationChanged += this.onLocationChanged; viewModel.LoginEventSuccess += this.onLoginSuccess; viewModel.AddressFailed += this.onAddressFailed; progring.IsActive = true; MyAutoSuggest.IsEnabled = false; HospDocSuggest.IsEnabled = false; NavView.IsEnabled = false; NavView.IsPaneOpen = false; NavView.SelectedItem = NavView.MenuItems[0]; //OpenBtn.IsEnabled = false; //MyListBox.SelectedIndex = 0; //Dashboardbtn.IsEnabled = false; //AppBtn.IsEnabled = false; NavView.Focus(FocusState.Programmatic); //myFrame.Navigate(typeof(MainPageLoadingScreenView)); }
public void SetUpNavigationDrawer() { GetDrawerInfo(); //If not logged in, show nonauthenticated section and hide authenticated //Otherwise, set up profile picture, profile full name, handle and favorites NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.createAccountButton_Icon) .AddView(ViewUtil.GetSVGImageView(this, "arrow_right_white_small", 24, Android.Resource.Color.White)); NavView.FindViewById(Resource.Id.createAccountButton).Click += CreateAccount_Click; NavView.FindViewById(Resource.Id.alreadyHaveAccountButton).Click += SignIn_Click; NavView.FindViewById(Resource.Id.about_upward).Click += GoToAppInfo_Click; float iconSize = 60; var findALeague = ViewUtil.GetSVGImageView(this, "location_grey", iconSize); var volunteer = ViewUtil.GetSVGImageView(this, "volunteer_grey", iconSize); var donate = ViewUtil.GetSVGImageView(this, "donate_grey", iconSize); var aboutUpward = ViewUtil.GetSVGImageView(this, "about_grey", iconSize); var contact = ViewUtil.GetSVGImageView(this, "contact_grey", iconSize); var preferences = ViewUtil.GetSVGImageView(this, "settings_grey", iconSize); NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.find_a_league_icon).AddView(findALeague); NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.volunteer_icon).AddView(volunteer); NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.donate_icon).AddView(donate); NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.about_upward_icon).AddView(aboutUpward); NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.contact_us_icon).AddView(contact); NavView.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.preferences_icon).AddView(preferences); NavView.FindViewById(Resource.Id.drawerLogout).Click += Logout_Click; NavView.FindViewById(Resource.Id.find_a_league).SetOnClickListener(this); NavView.FindViewById(Resource.Id.volunteer).SetOnClickListener(this); NavView.FindViewById(Resource.Id.contact_us).SetOnClickListener(this); NavView.FindViewById(Resource.Id.donate).SetOnClickListener(this); NavView.FindViewById(Resource.Id.about_upward).SetOnClickListener(this); NavView.FindViewById(Resource.Id.drawerPrivacyPolicy).SetOnClickListener(this); NavView.FindViewById(Resource.Id.drawerFanreactTechnologies).SetOnClickListener(this); NavView.FindViewById(Resource.Id.drawerTermsAndConditions).SetOnClickListener(this); }
// Use this for initialization void Start() { nav = transform.FindChild("nav").GetComponent <NavView>(); nav.setBtn1("新增礼品", () => { GameObject go = UIManager.OpenUI(Config.UI.UIPath.EditGoodsPanel); EditGoodsView ev = go.AddComponent <EditGoodsView>(); ev.CallBack = (Refresh); }); list = transform.FindChild("Content").FindChild("GoodsList").GetComponent <GoodsListView>(); list.setCallback(null, x => { GameObject go = UIManager.OpenUI(Config.UI.UIPath.EditGoodsPanel); EditGoodsView ev = go.AddComponent <EditGoodsView>(); ev.Good = Goods.GetGood(x); ev.CallBack = (Refresh); }, x => { Goods g = Goods.GetGood(x); string text = "确定删除\'" + g.Title + "\'吗?"; UI.Widget.CommonTips.showDelete(text, () => { g.delete(); Refresh(); }); }); }
/* Capture l'url de l'onglet en cours, et créé un favori en l'ajoutant dans un contextmenu + Serialization : A chaque ajout de favori, l'ajoute au fichier favori.xml (ou le créé s'il n'existe pas)*/ private void MenuItem_Click(object sender, RoutedEventArgs e) { TabItem tab = (TabItem)MainTabControl.SelectedItem; NavView view = GetNavView(tab); Image img = new Image { Source = BitmapImageWithTab(tab) }; string inputRead = new InputBox("Donnez un nom a votre favori ?", "Title", "Arial", 20).ShowDialog(); // Permet de donner une description où un surnom au favori Favori favori = new Favori(view.Browser.Address, inputRead); favlist.Add(favori); //Serializer<List<Favori>> serializer = new Serializer<List<Favori>>("favoris.xml", SerializeFormat.Xml); //serializer.Write(favlist); Serializer <List <Favori> > serializerBin = new Serializer <List <Favori> >("favoris.loic-jes", SerializeFormat.Binary); // Sérialisation en binaire - extension de fichier signature (nom de mon github) serializerBin.Write(favlist); if (string.IsNullOrWhiteSpace(inputRead)) { inputRead = view.Browser.Address; } MenuItem newFav = new MenuItem { Header = inputRead, Icon = img }; newFav.Click += GoToFav_Click; this.FavContextMenu.Items.Add(newFav); }
private void NavInvalidateMeasure_Click(object sender, RoutedEventArgs e) { NavView.InvalidateMeasure(); }
public AppShellView() { this.InitializeComponent(); coreApplicationView = CoreApplication.GetCurrentView(); //if (coreApplicationView != null) // coreApplicationView.TitleBar.ExtendViewIntoTitleBar = true; applicationView = ApplicationView.GetForCurrentView(); applicationView.TitleBar.BackgroundColor = Colors.Transparent; applicationView.TitleBar.ButtonBackgroundColor = Colors.Transparent; applicationView.TitleBar.InactiveBackgroundColor = Colors.Transparent; uiSettings = new Windows.UI.ViewManagement.UISettings(); NavView.SetBinding(Microsoft.UI.Xaml.Controls.NavigationView.MenuItemsSourceProperty, NepApp.CreateBinding(NepApp.UI, nameof(NepApp.UI.NavigationItems))); inlineNavigationService = WindowManager.GetNavigationManagerForCurrentView().RegisterFrameAsNavigationService(InlineFrame, FrameLevel.Two); windowService = WindowManager.GetWindowServiceForCurrentView(); UpdateSelectedNavigationItems(); NepApp.UI.SetNavigationService(inlineNavigationService); inlineNavigationService.Navigated += InlineNavigationService_Navigated; NepApp.UI.SetOverlayParentAndSnackBarContainer(OverlayPanel, snackBarGrid); App.RegisterUIDialogs(); nowPlayingOverlayCoordinator = new AppShellViewModelNowPlayingOverlayCoordinator(this); NavView.SetBinding(Microsoft.UI.Xaml.Controls.NavigationView.HeaderProperty, NepApp.CreateBinding(NepApp.UI, nameof(NepApp.UI.ViewTitle))); NowPlayingButton.SetBinding(Button.DataContextProperty, NepApp.CreateBinding(NepApp.SongManager, nameof(NepApp.SongManager.CurrentSong))); NepApp.MediaPlayer.MediaEngagementChanged += MediaPlayer_MediaEngagementChanged; NepApp.MediaPlayer.IsPlayingChanged += MediaPlayer_IsPlayingChanged; NepApp.UI.Overlay.OverlayedDialogShown += Overlay_DialogShown; NepApp.UI.Overlay.OverlayedDialogHidden += Overlay_DialogHidden; Messenger.AddTarget(this); DeviceInformation.SubplatformChanged += DeviceInformation_SubplatformChanged; if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase") && Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.AcrylicBrush")) { //Add acrylic. Windows.UI.Xaml.Media.AcrylicBrush myBrush = new Windows.UI.Xaml.Media.AcrylicBrush(); myBrush.BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop; myBrush.TintColor = uiSettings.GetColorValue(UIColorType.AccentDark2); myBrush.FallbackColor = uiSettings.GetColorValue(UIColorType.AccentDark2); myBrush.Opacity = 0.6; myBrush.TintOpacity = 0.5; bottomAppBar.Background = myBrush; } else { bottomAppBar.Background = new SolidColorBrush(uiSettings.GetColorValue(UIColorType.Accent)); } }
private void ViewModel_Navigated(object sender, NavigationServiceEventArgs e) { NavView.SetTitle(e.Title); }
/* Construction d'une nouvelle tab / onglet : Un texte placeholder et une image de croix dans un stackpanel, inséré dans * un tab, inséré dans le tabcontrol*/ public void CreateNewTab(string url = "") { if (MainTabControl.Items.Count < 27) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = new Uri("asset/img/close_cross.png", UriKind.Relative); bitmapImage.EndInit(); StackPanel stackPanel = new StackPanel { Margin = new Thickness(-4, 4, 0, 0), Orientation = Orientation.Horizontal }; Image imageCross = new Image { Source = bitmapImage, Width = 16 }; imageCross.MouseDown += ImageCross_MouseDown; TextBlock textBlock = new TextBlock { Text = "N" }; stackPanel.Children.Insert(0, textBlock); stackPanel.Children.Insert(1, imageCross); SolidColorBrush bgColor = new SolidColorBrush(); bgColor = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF5B5B5B")); SolidColorBrush borderColor = new SolidColorBrush(); borderColor = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF6A6666")); //Create ContextMenu ContextMenu contextMenu = new ContextMenu(); MenuItem menuItemDup = new MenuItem { Header = "Dupliquer" }; menuItemDup.Click += Click_Item_Duplicate; MenuItem menuItemClose = new MenuItem { Header = "Fermer" }; menuItemClose.Click += Click_Item_Close; contextMenu.Items.Add(menuItemDup); contextMenu.Items.Add(menuItemClose); TabItem tab = new TabItem { Header = stackPanel, ContextMenu = contextMenu, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0), Height = 34, FontSize = 20, Background = bgColor, BorderBrush = borderColor }; Frame frame = new Frame { Content = new NavView(), Margin = new Thickness(-5) }; tab.Content = frame; MainTabControl.Items.Add(tab); MainTabControl.SelectedItem = tab; if (url != "") { this.Dispatcher.BeginInvoke((Action)(() => { NavView view = (NavView)frame.Content; view.Browser.Address = url; })); } } }