public CreateMemoryPage() { InitializeComponent(); TitleBarControl.SetBackButtonVisibility(Visibility.Visible); // 设置为多选 GalleryGridViewControl.SetGridViewMultipleSelection(); // 标题box TitleBox.Text = new DateTimeFormatter("longdate").Format(DateTime.Now); // 完成button DoneButton.Click += async(sender, args) => { if (_memoryListView == null) { return; } // 新建一个回忆VM var memoryViewModel = await MemoryViewModel.GetInstanceAsync(); memoryViewModel.KeyNo = _memoryListView.LastKeyNo + 1; memoryViewModel.MemoryName = TitleBox.Text; memoryViewModel.ImageViewModels = GalleryGridViewControl.SelectedImageViewModels; memoryViewModel.CoverImage = memoryViewModel.ImageViewModels[0].ThumbnailImage; _memoryListView.Add(memoryViewModel); GoBack(); }; // 取消button CancelButton.Click += (sender, args) => { GoBack(); }; }
private void FrmMenu_Load(object sender, EventArgs e) { TitleBarControl TTb = new TitleBarControl() { FrmMenu = this }; TTb.AddTitleBar(); }
public MemoryDetailPage() { InitializeComponent(); InitVisual(); TitleBarControl.SetBackButtonVisibility(Visibility.Visible); ShowButton.Click += (sender, args) => { // 进入街景界面 var rootFrame = Window.Current.Content as Frame; rootFrame?.Navigate(typeof(StreetViewPage), _memoryModel); Window.Current.Content = rootFrame; Debug.WriteLine("进入街景界面"); }; AudioButton.Click += async(sender, args) => { var filePicker = new FileOpenPicker(); filePicker.FileTypeFilter.Add(".mp3"); filePicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; var file = await filePicker.PickSingleFileAsync(); if (file == null) { return; } var newFile = await file.CopyAsync(ApplicationData.Current.LocalFolder); await newFile.RenameAsync(_memoryModel.KeyNo.ToString(), NameCollisionOption.ReplaceExisting); // 显示成功通知 var flyout = FlyoutBase.GetAttachedFlyout((FrameworkElement)sender); flyout.ShowAt((FrameworkElement)sender); await Task.Run(async() => { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { await Task.Delay(1000); flyout.Hide(); }); }); }; DeleteButton.Click += (sender, args) => { var rootFrame = Window.Current.Content as Frame; //_memoryListViewModel.Delete(_memoryViewModel); ViewModelLocator.Instance.MemoryListViewModel.DeleteCommand.Execute(_memoryModel); rootFrame?.GoBack(); }; }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (DeviceHelper.IsDesktop) { TitleBarUc = TitleBarHelper.CustomTitleBar(this.Content); TitleBarUc.OnClickBackBtn += (s, ex) => { if (Frame.CanGoBack) { Frame.GoBack(); } }; } }
protected override void CustomTitleBar() { if (DeviceHelper.IsDesktop && _titleBar == null) { _titleBar = new TitleBarControl() { ShowBackBtn = false }; (this.Content as Grid).Children.Add(_titleBar); Grid.SetColumnSpan(_titleBar, 5); Grid.SetRowSpan(_titleBar, 5); Canvas.SetZIndex(_titleBar, 100); } _titleBar.Setup(); }
public static TitleBarControl CustomTitleBar(UIElement rootContent) { var currentContent = rootContent as Grid; if (currentContent == null) { throw new ArgumentNullException("The root element of the page should be Grid."); } var uc = new TitleBarControl(); (currentContent as Grid).Children.Add(uc); Grid.SetColumnSpan(uc, 5); Grid.SetRowSpan(uc, 5); return(uc); }
public static void InitLang(Page page) { // ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_aspnetcon/html/76091f86-f967-4687-a40f-de87bd8cc9a0.htm String selectedLanguage = TitleBarControl.GetLang(page, "langlist"); page.UICulture = selectedLanguage; page.Culture = selectedLanguage; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage); Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLanguage); page.Session["lang"] = Thread.CurrentThread.CurrentUICulture.Name; }
public virtual void OnShow() { OnShownChanged?.Invoke(this, new ShownArgs() { Shown = true }); _titleBarControl = TitleBarHelper.CustomTitleBar(this.Content); _titleBarControl.OnClickBackBtn += (x, e) => { Shown = false; }; //Window.Current.SetTitleBar(this); if (DeviceHelper.IsMobile) { StatusBarHelper.SetUpBlackStatusBar(); } else { TitleBarHelper.SetUpTitleBarColorForDarkText(); } }
public CreateMemoryPage() { InitializeComponent(); TitleBarControl.SetBackButtonVisibility(Visibility.Visible); // 设置为多选 GalleryGridViewControl.SetGridViewMultipleSelection(); // 标题box TitleBox.Text = new DateTimeFormatter("longdate").Format(DateTime.Now); // 完成button DoneButton.Click += async(sender, args) => { MemoryModel memoryModel = await ViewModelLocator.Instance.MemoryListViewModel.CreateMemoryAsync( ViewModelLocator.Instance.MemoryListViewModel.MemoryList.LastKeyNo, TitleBox.Text, GalleryGridViewControl.SelectedImageModels); ViewModelLocator.Instance.MemoryListViewModel.AddCommand.Execute(memoryModel); GoBack(); }; // 取消button CancelButton.Click += (sender, args) => { GoBack(); }; }
private void OnWindowPreviewMouseDown(object sender, MouseButtonEventArgs e) { if (_paneRoot != null) { var pos = e.GetPosition(_paneRoot); if ((pos.X >= 0) && (pos.X <= _paneRoot.ActualWidth) && (pos.Y >= 0) && (pos.Y <= _paneRoot.ActualHeight)) { return; } } if (e.OriginalSource is UIElement originalElement && TitleBarControl.GetInsideTitleBar(originalElement)) { return; } if (IsPaneOpen) { e.Handled = true; ClosePane(); } }
/// <summary> /// This method creates the root layout for the window and automatically adds the items that should be in the root panel (i.e. references are required). /// </summary> /// <param name="monitor">The monitor from which the legends are copied. </param> /// <param name="other">The previous <see cref="SigmaWindow"/> - some values propagate automatically to the new window (e.g. tabs).</param> /// <param name="titleBarControl">The <see cref="TitleBarControl"/>, since it belongs to the window itself (not root content).</param> /// <returns>The newly created root panel. (In this case where the tabs etc. are placed)</returns> protected virtual Panel CreateContent(WPFMonitor monitor, SigmaWindow other, out TitleBarControl titleBarControl) { titleBarControl = CreateObjectByFactory <TitleBarControl>(TitleBarFactoryIdentifier); LeftWindowCommands = TitleBar; TabControl = CreateObjectByFactory <TabControlUI <SigmaWindow, TabUI> >(TabControlFactoryIdentifier); if (other == null) { AddTabs(TabControl, monitor.Tabs); } Layout tabLayout = (Layout)TabControl; // ReSharper disable once CoVariantArrayConversion UIElement statusBar = CreateObjectByFactory <UIElement>(StatusBarFactoryIdentifier, monitor.Legends.Values.ToArray()); DockPanel rootLayout = CreateObjectByFactory <DockPanel>(RootPanelFactoryIdentifier); rootLayout.Children.Add(statusBar); DockPanel.SetDock(statusBar, Dock.Bottom); rootLayout.Children.Add(tabLayout); return(rootLayout); }
protected virtual void CustomTitleBar() { var currentContent = this.Content as Grid; if (currentContent == null) { throw new ArgumentNullException("The root element of the page should be Grid."); } if (TitleBarUC == null) { TitleBarUC = new TitleBarControl(); TitleBarUC.OnClickBackBtn += () => { if (Frame.CanGoBack) { Frame.GoBack(); } }; (currentContent as Grid).Children.Add(TitleBarUC); Grid.SetColumnSpan(TitleBarUC, 5); Grid.SetRowSpan(TitleBarUC, 5); } TitleBarUC.Setup(); }
public SettingPage() { InitializeComponent(); TitleBarControl.SetBackButtonVisibility(Visibility.Visible); DataContext = ViewModelLocator.Instance.FolderListViewModel; }
public SettingPage() { InitializeComponent(); TitleBarControl.SetBackButtonVisibility(Visibility.Visible); }
public GoBackCommand(TitleBarControl owner) { _owner = owner; }