public MainPage() { InitializeComponent(); DisableConnectionStatusPopup = true; ApplicationBarMenuClosedOpacity = 0.9; ApplicationBarMenuOpenOpacity = 0.9; // Application Bar AddAppBarPlayTransportButtons(); AddApplicationBarMenuItem(LocalizedStrings.ChooseLibraryMenuItem, NavigationManager.OpenChooseLibraryPage); AddApplicationBarMenuItem(LocalizedStrings.SettingsMenuItem, NavigationManager.OpenSettingsPage); AddApplicationBarMenuItem(LocalizedStrings.AboutMenuItem, NavigationManager.OpenAboutPage); #if WP8 // Disabled for now //EnableAppleTVControlButton(); #endif #if DEBUG UpdateDebugDataMenuItem(); #endif _standardAppBar = ApplicationBar; UpdateTrialModeText(); Loaded += ShowTrialDialogOnFirstLoad; DialogClosed += MainPage_DialogClosed; }
public void BuildLocalizedApplicationBar(IApplicationBar appBar) { appBar.Opacity = 0; appBar.StateChanged += ApplicationBar_StateChanged; ApplicationBarIconButton appBarButtonHome = new ApplicationBarIconButton(new Uri("/Assets/AppBar/home.png", UriKind.Relative)); appBarButtonHome.Text = AppResources.AppBarButtonHome; appBar.Buttons.Add(appBarButtonHome); appBarButtonHome.Click += appBarButtonHome_Click; ApplicationBarMenuItem appBarMenuTaxes = new ApplicationBarMenuItem(AppResources.AppBarMenuTaxes); appBar.MenuItems.Add(appBarMenuTaxes); appBarMenuTaxes.Click += appBarMenuTaxes_Click; ApplicationBarMenuItem appBarMenuHowTo = new ApplicationBarMenuItem(AppResources.AppBarMenuHowTo); appBar.MenuItems.Add(appBarMenuHowTo); appBarMenuHowTo.Click += appBarMenuHowTo_Click; ApplicationBarMenuItem appBarMenuAbout = new ApplicationBarMenuItem(AppResources.AppBarMenuAbout); appBar.MenuItems.Add(appBarMenuAbout); appBarMenuAbout.Click += appBarMenuAbout_Click; }
private void SwapPageMode() { IApplicationBar tmpAppbar = this.ApplicationBar; ApplicationBar = backupAppBar; backupAppBar = tmpAppbar; }
/// <summary> /// Disables all the menu items of this ApplicationBar. /// </summary> /// <param name="applicationBar">This Applicationbar.</param> public static void DisableMenuItems(this IApplicationBar applicationBar) { foreach (ApplicationBarMenuItem menuItem in applicationBar.MenuItems) { menuItem.IsEnabled = false; } }
private void OnProfileViewerPropertyChanged(object sender, PropertyChangedEventArgs e) { if (Property.NameEquals(e.PropertyName, () => ViewModel.ProfilePhotoViewer.IsOpen)) { ViewModel.NotifyOfPropertyChange(() => ViewModel.IsViewerOpen); if (ViewModel.ProfilePhotoViewer.IsOpen) { _prevAppBar = ApplicationBar; var profilePhotoViewerView = ProfilePhotoViewer.Content as ProfilePhotoViewerView; ApplicationBar = profilePhotoViewerView != null ? profilePhotoViewerView.ApplicationBar : null; } else { // wait to finish closing profile viewer animation Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () => { if (_prevAppBar != null) { ApplicationBar = _prevAppBar; } }); } } }
//*********************************************************************************************************************** //*********************************************************************************************************************** /// <summary> /// Permet de définir une une fois les boutons de la barre d'application. /// </summary> /// <param name="Self">Objet concerné par l'appel.</param> /// <param name="Mode"></param> /// <param name="Buttons">Boutons de la barre d'application.</param> //----------------------------------------------------------------------------------------------------------------------- public static void SetButtons(this IApplicationBar Self, ApplicationBarMode Mode, params ApplicationBarIconButton[] Buttons) { //------------------------------------------------------------------------------------------------------------------- if (Self != null) { //--------------------------------------------------------------------------------------------------------------- if (ApplicationBars.ContainsKey(Self) && ApplicationBars[Self].IsSuspended) { //----------------------------------------------------------------------------------------------------------- ApplicationBars[Self].IsSuspended = false; var buttons = new List <ApplicationBarIconButton> (); foreach (ApplicationBarIconButton Button in Buttons) { buttons.Add(Button); } ApplicationBars[Self].Mode = Mode; ApplicationBars[Self].Buttons = buttons.ToArray(); //----------------------------------------------------------------------------------------------------------- } //--------------------------------------------------------------------------------------------------------------- else { Set(Self, Mode, Buttons); } //--------------------------------------------------------------------------------------------------------------- } //------------------------------------------------------------------------------------------------------------------- }
/// <summary> /// Creates a menu item and adds it to an application bar. /// </summary> /// <param name="appBar"></param> /// <param name="command"></param> /// <param name="text"></param> /// <returns></returns> public static ApplicationBarMenuItem CreateAndAddMenuItem(this IApplicationBar appBar, ICommand command, string text) { ApplicationBarMenuItem mi = new ApplicationBarMenuItem(text); // First-time values. mi.IsEnabled = command.CanExecute(mi); // Adds click handler to execute the command upon click. mi.Click += (o, e) => { if (command.CanExecute(mi)) { command.Execute(mi); } }; // Adds CanExecute changed handler. command.CanExecuteChanged += (o, e) => { mi.IsEnabled = command.CanExecute(mi); }; // Adds the button. appBar.MenuItems.Add(mi); return(mi); }
/// <summary> /// Creates a button and adds it to an application bar. /// </summary> /// <param name="appBar"></param> /// <param name="iconFilenameRelative"></param> /// <param name="command"></param> /// <param name="text"></param> /// <returns></returns> public static ApplicationBarIconButton CreateAndAddButton(this IApplicationBar appBar, string iconFilenameRelative, ICommand command, string text) { ApplicationBarIconButton btn = new ApplicationBarIconButton(new Uri("/icons/" + iconFilenameRelative, UriKind.Relative)); // First-time values. btn.IsEnabled = command.CanExecute(btn); btn.Text = text; // Adds click handler to execute the command upon click. btn.Click += (o, e) => { if (command.CanExecute(btn)) { command.Execute(btn); } }; // Adds CanExecute changed handler. command.CanExecuteChanged += (o, e) => { btn.IsEnabled = command.CanExecute(btn); }; // Adds the button. appBar.Buttons.Add(btn); return(btn); }
public void SetPageContext() { if (bar != null) { view.ApplicationBar = bar; return; } bar = new ApplicationBar(); ApplicationBarIconButton buttonNewsLoadMore = new ApplicationBarIconButton(new Uri("/Resources/baricons/loadmore.png", UriKind.RelativeOrAbsolute)); buttonNewsLoadMore.Text = "more"; buttonNewsLoadMore.Click += ButtonNewsLoadMore_OnClick; bar.Buttons.Add(buttonNewsLoadMore); ApplicationBarMenuItem menuItemSettings = new ApplicationBarMenuItem("settings"); menuItemSettings.Click += menuItemSettings_Click; bar.MenuItems.Add(menuItemSettings); view.ApplicationBar = bar; }
public VideoPage() { InitializeComponent(); _autoPlay = SettingsHelper.GetIsAutoPlayVideo(); Pivot.SelectionChanged += PivotOnSelectionChanged; SubscribePlayerEvents(player); player.AutoPlay = _autoPlay; PhoneApplicationService.Current.Deactivated += Current_Deactivated; PhoneApplicationService.Current.Activated += Current_Activated; LayoutRoot.SizeChanged += OnLayoutRootSizeChanged; _sensor = SimpleOrientationSensor.GetDefault(); _sendApplicationBar = new ApplicationBar(); _sendApplicationBarButton = ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Send.png", AppResources.Send, Send_Click); _sendApplicationBar.Buttons.Add(_sendApplicationBarButton); _currentApplicationBar = new ApplicationBar(); _currentApplicationBar.Mode = ApplicationBarMode.Minimized; _currentApplicationBar.Buttons.Add(ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Home.png", AppResources.Home, Home_Click)); //_currentApplicationBar.Buttons.Add(ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Refresh.png", AppResources.Refresh, Refresh_Click)); _currentApplicationBar.MenuItems.Add(ApplicationBarHelper.CreateAApplicationBarMenuItem(AppResources.CopyVideoLink, CopyVideoUrl_Click)); _favoritesApplicationBarButton = ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.StarAdd.png", AppResources.AddToFavorites, AddToFavorites_Click); _addToPlaylistApplicationBarButton = ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Add.png", AppResources.AddToPlaylist, AddToPlaylist_Click); ApplicationBar = _currentApplicationBar; }
private void OnProfilePhotoViewerPropertyChanged(object sender, PropertyChangedEventArgs e) { if (Property.NameEquals(e.PropertyName, () => ViewModel.ProfilePhotoViewer.IsOpen)) { ScrollViewer.IsHitTestVisible = !ViewModel.ProfilePhotoViewer.IsOpen; AppBarPanel.Visibility = !ViewModel.ProfilePhotoViewer.IsOpen ? Visibility.Visible : Visibility.Collapsed; if (ViewModel.ProfilePhotoViewer.IsOpen) { _prevAppBar = ApplicationBar; var profilePhotoViewerView = ProfilePhotoViewer.Content as ProfilePhotoViewerView; ApplicationBar = profilePhotoViewerView != null ? profilePhotoViewerView.ApplicationBar : null; } else { // wait to finish closing profile viewer animation Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () => { ApplicationBar = _prevAppBar; }); } } }
//------------------------------------------------------------------------------------------------------------------- public CacheItem(IApplicationBar Owner) { this.Owner = Owner; this.Buttons = new ApplicationBarIconButton[0]; this.IsSuspended = false; this.Mode = Owner.Mode; }
public void Show() { _page.OrientationChanged += PageOrientationChanged; _popup.WindowClosing += PopupClosing; if (_page.ApplicationBar != null && _hideAppBar) { _appBarVisibility = _page.ApplicationBar.IsVisible; _page.ApplicationBar.IsVisible = false; _appBar = _page.ApplicationBar; } _page.Content.IsHitTestVisible = false; _canClose = false; _popup.IsOpen = true; var storyboard = new Storyboard(); var opacityAnimation = new DoubleAnimation() { To = 1, Duration = new Duration(TimeSpan.FromMilliseconds(300)) }; Storyboard.SetTarget(opacityAnimation, (Border)_popup.Content); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("Opacity")); storyboard.Children.Add(opacityAnimation); storyboard.Begin(); _popup.UpdateLayout(); }
private void MakeAppBarForInfo() { _appBarInfo = new Microsoft.Phone.Shell.ApplicationBar(); // Creates and adds the buttons. _appBarInfo.CreateAndAddButton("appbar.transport.play.rest.png", StartNewGameCommand, "start"); }
public SwipeMenu(PhoneApplicationPage page, Canvas pageCanvas, Canvas layoutRoot, Storyboard moveAnimation, Grid leftMenu) { this.pageCanvas = pageCanvas; this.layoutRoot = layoutRoot; this.moveAnimation = moveAnimation; this.leftMenu = leftMenu; this.applicationBar = page.ApplicationBar; this.currentPage = page; NavigationService navigationService = page.NavigationService; pageCanvas.ManipulationCompleted += pageCanvas_ManipulationCompleted; pageCanvas.ManipulationDelta += pageCanvas_ManipulationDelta; pageCanvas.ManipulationStarted += pageCanvas_ManipulationStarted; pageCanvas.Height = leftMenu.Height = App.Current.RootVisual.RenderSize.Height; StackPanel panel = new StackPanel(); Thickness margin = panel.Margin; margin.Top = 50; panel.Margin = margin; SwipeMenuItem.navigationService = navigationService; panel.Children.Add(new SwipeMenuItem("Giriş", "/Assets/MenuItem.png", "/LoginPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Bilgiler", "/Assets/MenuItem.png", "/StudentPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Dönemler", "/Assets/MenuItem.png", "/PeriodsPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Dersler", "/Assets/MenuItem.png", "/PeriodDetailsPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Ders programı", "/Assets/MenuItem.png", "/LessonPlanPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Gano hesapla", "/Assets/MenuItem.png", "/CalculateGanoPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Yemek listesi", "/Assets/MenuItem.png", "/FoodListsPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Ayarlar", "/Assets/MenuItem.png", "/SettingsPage.xaml?" + DateTime.Now)); panel.Children.Add(new SwipeMenuItem("Hakkında", "/Assets/MenuItem.png", "/AboutPage.xaml?" + DateTime.Now)); leftMenu.Children.Add(panel); MoveViewWindow(-350); }
private void PreparePage(bool showLoader) { if (showLoader) { if (!this._currentPage.FullscreenLoaders.Contains(this)) { this._currentPage.FullscreenLoaders.Add(this); } this._applicationBar = this._currentPage.ApplicationBar; this._currentPage.ApplicationBar = (IApplicationBar)null; } else { if (this._currentPage.FullscreenLoaders.Contains(this)) { this._currentPage.FullscreenLoaders.Remove(this); } if (this._applicationBar == null) { return; } this._currentPage.ApplicationBar = this._applicationBar; this._applicationBar = (IApplicationBar)null; } }
protected PivotViewModel(INavigationService navigation, IApplicationBar applicationBar) { Navigation = navigation; AppBar = applicationBar; _pivotFix = new PivotFix <IScreen>(this); }
public CommandButtonAdapter( IApplicationBar appbar, IApplicationBarIconButton button, Mode hideMode = Mode.DisableButton, ICommand command = null) { if (appbar == null && hideMode != Mode.DisableButton) throw new ArgumentException("Without an appbar reference I can only disable buttons not hide them"); if (button == null) throw new ArgumentNullException("button"); _AppBar = appbar; HideMode = hideMode; Button = button; Command = command; if (_AppBar != null && HideMode == Mode.DisableButton) { if (!_AppBar.Buttons.Contains(Button)) { _AppBar.Buttons.Add(Button); } } }
public ScreenSaver(Grid parentLayoutRoot, IApplicationBar appBar) { InitializeComponent(); // MainPage.xaml layoutroot _parentLayoutRoot = parentLayoutRoot; _applicationBar = appBar; this.LayoutRoot.Visibility = System.Windows.Visibility.Collapsed; }
public static ApplicationBarIconButton GetMinimizarButton(IApplicationBar self) { return MakeButton("minus.png", "minimizar", (object sender, EventArgs e) => { self.Mode = (self.Mode == ApplicationBarMode.Default) ? ApplicationBarMode.Minimized : ApplicationBarMode.Default; }); }
private void OnApplicationBarChanged(IApplicationBar bar) { if (bar != null) { // Hides or shows the app RefreshApplicationBarIsVisible(); } }
internal override void SwapAppBar(PhoneApplicationPage _parent) { if (_parent.ApplicationBar != null && _parent.ApplicationBar.IsVisible) { _appBar = _parent.ApplicationBar; _appBar.IsVisible = false; } }
public static ApplicationBarIconButton FindButton(this IApplicationBar appBar, string text) { if (appBar == null) { throw new ArgumentNullException("appBar"); } return((from object button in appBar.Buttons select button as ApplicationBarIconButton).FirstOrDefault(btn => btn != null && btn.Text == text)); }
internal static ApplicationBarMenuItem AddApplicationBarMenuItem(IApplicationBar bar, string menuText, EventHandler action = null) { var applicationBarMenuItem = new ApplicationBarMenuItem(menuText); if (action != null) applicationBarMenuItem.Click += action; bar.MenuItems.Add(applicationBarMenuItem); return applicationBarMenuItem; }
public PopupContainer(PhoneApplicationPage basePage) { InitializeComponent(); this.Loaded += new RoutedEventHandler(PopupCotainer_Loaded); _BasePage = basePage; _BasePage.BackKeyPress += BasePage_BackKeyPress; _AppBar = basePage.ApplicationBar; }
internal void RemoveItem(IApplicationBar internalApplicationBar) { if (isAttached) { OnItemRemoved(internalApplicationBar); isAttached = false; } }
/// <summary> /// Translates the IconButtons in a ApplicationBar /// </summary> /// <param name="bar"></param> public static void TranslateButtons(this IApplicationBar bar) { // Translate unsupport XAML bindings foreach (ApplicationBarIconButton button in bar.Buttons) { button.Text = button.Text.Translate(); } }
internal void Dettach(IApplicationBar sysAppBar) { foreach (var item in this) { item.Dettach(sysAppBar); item.DataContext = null; } }
public ThreadView() { InitializeComponent(); BindEvents(); this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape; this._currentOrientation = this.Orientation; this._defaultAppBar = this.ApplicationBar; }
private void HideStoryboardCompleted() { this.IsOpen = false; try { if (this.SetStatusBarBackground) { SystemTray.BackgroundColor = ((SolidColorBrush)Application.Current.Resources["PhoneBackgroundBrush"]).Color; } if (this.CurrentPage != null) { if (this.CurrentPage.Flyouts.Contains((IFlyout)this)) { this.CurrentPage.Flyouts.Remove((IFlyout)this); } this.CurrentPage.BackKeyPress -= new EventHandler <CancelEventArgs>(this.OnBackKeyPress); this.CurrentPage.NavigationService.Navigated -= new NavigatedEventHandler(this.OnNavigated); if (this._applicationBar != null) { this.CurrentPage.ApplicationBar = this._applicationBar; this._applicationBar = (IApplicationBar)null; } this.AnimateParentControl(false); this._page = (PageBase)null; } } catch { } try { Panel popupContainer = this.PopupContainer; if ((popupContainer != null ? popupContainer.Children : (UIElementCollection)null) != null) { if (this._overlay != null) { this.PopupContainer.Children.Remove((UIElement)this._overlay); } this.PopupContainer.Children.Remove((UIElement)this._childPanel); } } catch { } this._isHiding = false; try { EventHandler eventHandler = this.Closed; if (eventHandler == null) { return; } eventHandler((object)this, null); } catch { } }
public NewMultimediaAppBarUpdater(IMessageBus Messenger, PhoneApplicationPage page, ElementMultimediaVM vm) { _page = page; _appbar = _page.ApplicationBar; _vm = vm; _back_key = Disposable.Empty; if (_vm == null) throw new ArgumentNullException("vm"); _vm.NewMultimediaObservable .Subscribe(m => show_mmo_buttons(m)); _mmobuttons = new List<object>(); _image = new ApplicationBarIconButton() { IconUri = new Uri("/Images/appbar.feature.camera.rest.png", UriKind.RelativeOrAbsolute), IsEnabled = true, Text = "image" }; _mmobuttons.Add(_image); _audio = new ApplicationBarIconButton() { IconUri = new Uri("/Images/appbar.feature.audio.rest.png", UriKind.RelativeOrAbsolute), IsEnabled = true, Text = "audio" }; _mmobuttons.Add(_audio); _video = new ApplicationBarIconButton() { IconUri = new Uri("/Images/appbar.feature.video.rest.png", UriKind.RelativeOrAbsolute), IsEnabled = true, Text = "video" }; _mmobuttons.Add(_video); Observable.Merge( Observable.FromEventPattern<object, EventArgs>(_image, "Click") .Select(_ => MediaType.Image), Observable.FromEventPattern<object, EventArgs>(_audio, "Click") .Select(_ => MediaType.Audio), Observable.FromEventPattern<object, EventArgs>(_video, "Click") .Select(_ => MediaType.Video) ) .Do(_ => restore_buttons()) .Select(media => new MultimediaObjectVM(new MultimediaObject() { MediaType = media, OwnerType = _mmowner.EntityType, RelatedId = _mmowner.EntityID }) as IElementVM<MultimediaObject>) .ToMessage(Messenger, MessageContracts.EDIT); _buttons = new List<object>(); foreach (var btn in _appbar.Buttons) _buttons.Add(btn); }
public static void Enable(this IApplicationBar appBar) { appBar.IsMenuEnabled = true; foreach (var button in appBar.Buttons.OfType <ApplicationBarIconButton>()) { button.IsEnabled = true; } }
public BoardViewModel(ITrelloApiSettings settings, ITrello api, INavigationService navigation, IApplicationBar applicationBar, Func <BoardListViewModel> listFactory) : base(navigation, applicationBar) { _api = api; _listFactory = listFactory; }
public static void EnableApplicationBar(this IApplicationBar appBar, bool enable) { //foreach (IApplicationBarIconButton button in appBar.Buttons) //{ // button.IsEnabled = enable; //} appBar.IsVisible = enable; appBar.IsMenuEnabled = enable; }
internal void Attach(object dataContext, IApplicationBar sysAppBar) { for (int index = 0; index < Count; index++) { var item = this[index]; item.DataContext = dataContext; item.Attach(sysAppBar, index, this); } }
public BoardViewModel(ITrelloApiSettings settings, ITrello api, INavigationService navigation, IApplicationBar applicationBar, Func<BoardListViewModel> listFactory) : base(navigation, applicationBar) { _api = api; _listFactory = listFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationBar" /> class. /// </summary> public ApplicationBar() { InternalApplicationBar = new Microsoft.Phone.Shell.ApplicationBar(); Buttons = new ApplicationBarIconButtonCollection(InternalApplicationBar.Buttons); MenuItems = new ApplicationBarMenuItemCollection(InternalApplicationBar.MenuItems); InternalApplicationBar.StateChanged += ApplicationBarStateChanged; }
internal void AddItem(IApplicationBar internalApplicationBar) { if (!isAttached) { OnItemAdded(internalApplicationBar); isAttached = true; if (Command != null) IsEnabled = Command.CanExecute(CommandParameter); } }
internal static ApplicationBarIconButton AddApplicationBarButton(IApplicationBar bar, string imageUrl, string buttonName, EventHandler action = null) { var applicationBarIconButton = new ApplicationBarIconButton(new Uri(imageUrl, UriKind.Relative)) { Text = buttonName }; if (action != null) applicationBarIconButton.Click += action; bar.Buttons.Add(applicationBarIconButton); return applicationBarIconButton; }
public void Init(Ioctls ioctls, Core core, Runtime runtime) { /** * Displays a special kind of dialog that has a list of possible choices. * The list of options is displayed as buttons on iOS, and as text views on Android. * By clicking any option the dialog gets dismissed and a #EVENT_TYPE_OPTIONS_BOX_BUTTON_CLICKED event is sent back. * * \param title The dialog title. * \param destructiveButtonTitle The destructive button text. This is an iOS specific feature: it has different color than the other options, * and it indicates that it's action has destructive behaviour. On Android it is treated and it looks like a normal option. * \param cancelButtonTitle The dialog's Cancel button text. If left empty, the dialog is not cancelable. * \param otherButtonTitles The address to the buffer that stores the list of options. * \param otherButtonTitlesSize The size of the buffer, in bytes. */ ioctls.maOptionsBox = delegate(int _title, int _destructiveButtonTitle, int _cancelButtonTitle, int _otherButtonTitles, int _otherButtonTitlesSize) { mApplicationBarMenuItems = new List<ApplicationBarMenuItem>(); mRuntime = runtime; MoSync.Util.RunActionOnMainThreadSync(() => { // get the current application page PhoneApplicationPage currentPage = (((PhoneApplicationFrame)Application.Current.RootVisual).Content as PhoneApplicationPage); // create the application bar and enable the application bar menu which will contain the option buttons currentPage.ApplicationBar = new ApplicationBar(); currentPage.ApplicationBar.Mode = ApplicationBarMode.Default; currentPage.ApplicationBar.Opacity = 1.0; currentPage.ApplicationBar.IsVisible = true; currentPage.ApplicationBar.IsMenuEnabled = true; mApplicationBar = currentPage.ApplicationBar; // the cancel button will be an application bar button with a default icon String cancelButtonTitle = core.GetDataMemory().ReadWStringAtAddress(_cancelButtonTitle); ApplicationBarIconButton cancelButton = new ApplicationBarIconButton(); // by not specifying the uri path to the button icon, a default one will be set cancelButton.IconUri = new Uri("", UriKind.Relative); cancelButton.Text = cancelButtonTitle; cancelButton.Click += new EventHandler(cancelButton_Click); currentPage.ApplicationBar.Buttons.Add(cancelButton); createOptionButtons(core, _otherButtonTitles); // the destructive button will be the last application bar menu item String destructiveButtonTitle = core.GetDataMemory().ReadWStringAtAddress(_destructiveButtonTitle); ApplicationBarMenuItem destructiveMenuItem = new ApplicationBarMenuItem(); destructiveMenuItem.Text = destructiveButtonTitle; destructiveMenuItem.Click += new EventHandler(destructiveButton_Click); currentPage.ApplicationBar.MenuItems.Add(destructiveMenuItem); }); return MoSync.Constants.MAW_RES_OK; }; }
public BindableApplicationBar() { internalApplicationBar = new ApplicationBar(); buttons = new BindableApplicationBarIconButtonCollection(internalApplicationBar); menuItems = new BindableApplicationBarMenuItemCollection(internalApplicationBar); buttons.CollectionChanged += OnCollectionChanged; menuItems.CollectionChanged += OnCollectionChanged; BindingOperations.SetBinding(this, DataContextProperty, new Binding()); }
public ApplicationBarHandler(IApplicationBar applicationBar) { ApplicationBar = applicationBar; ButtonCache = new Dictionary<ApplicationBarButtons, ApplicationBarIconButton>(); ButtonCache.Add(GetButton(@"/Assets/AppBar/refresh.png", "Refresh", ApplicationBarButtons.Refresh)); ButtonCache.Add(GetButton(@"/Assets/AppBar/settings.png", "Settings", ApplicationBarButtons.Settings)); ButtonCache.Add(GetButton(@"/Assets/AppBar/delete.png", "Cleanup", ApplicationBarButtons.Cleanup)); ButtonCache.Add(GetButton(@"/Assets/AppBar/select.png", "Select All", ApplicationBarButtons.SelectAll)); ButtonCache.Add(GetButton(@"/Assets/AppBar/film.png", "to Mp4", ApplicationBarButtons.Convert)); ButtonCache.Add(GetButton(@"/Assets/AppBar/select.png", "Select Many", ApplicationBarButtons.Select)); ButtonCache.Add(GetButton(@"/Assets/AppBar/delete.png", "delete", ApplicationBarButtons.Delete)); }
public ViewAudioVideoPageAppbarUpdater(IApplicationBar appbar, IAudioVideoPageVM viewmodel) { _appbar = appbar; _vm = viewmodel; if (_vm == null) return; _play = new ApplicationBarIconButton() { IconUri = new Uri("/Images/AudioIcons/play.png", UriKind.Relative), Text = "play", IsEnabled = true, }; _play.Click += (s, args) => _vm.Play.Execute(null); _play.Click += (s, args) => this.adjustPlaying(true); _stop = new ApplicationBarIconButton() { IconUri = new Uri("/Images/AudioIcons/stop.png", UriKind.Relative), Text = "stop", IsEnabled = false, }; _stop.Click += (s, args) => _vm.Stop.Execute(null); _stop.Click += (s, args) => this.adjustPlaying(false); _vm.ObservableForProperty(x => x.IsEditable) .Select(change => change.Value) .Subscribe(iseditable => adjustApplicationBar(iseditable)); _edit = new ApplicationBarIconButton() { IconUri = new Uri("/Images/appbar.edit.rest.png", UriKind.Relative), Text = "edit", IsEnabled = true, }; _edit.Click += (s, args) => _vm.ToggleEditable.Execute(null); _delete = new ApplicationBarIconButton() { IconUri = new Uri("/Images/appbar.delete.rest.png", UriKind.Relative), Text = "delete", IsEnabled = true, }; _delete.Click += (s, args) => _vm.Delete.Execute(null); adjustApplicationBar(_vm.IsEditable); }
internal override void SwapAppBar(PhoneApplicationPage parent) { if (parent == null) return; _parent = parent; _parentAppBar = _parent.ApplicationBar; ApplicationBar appBar = new ApplicationBar(); ApplicationBarIconButton button = new ApplicationBarIconButton(new Uri("/Assets/ApplicationBar.Check.png", UriKind.RelativeOrAbsolute)) { Text = "Select Folder" }; button.Click += Selected_Click; appBar.Buttons.Add(button); _parent.ApplicationBar = appBar; }
public HomePage() { InitializeComponent(); PrepareAnimations(); InteractionEffectManager.AllowedTypes.Add(typeof(RadDataBoundListBoxItem)); this.ForumsList.IsSynchronizedWithCurrentItem = false; this.BookmarksList.IsSynchronizedWithCurrentItem = false; this.FavoritesListBox.IsSynchronizedWithCurrentItem = false; this.FavoritesListBox.ItemAnimationMode = ItemAnimationMode.PlayOnNewSource; HomePage._context = new ViewModels.HomePageViewModel(this.ForumsList); this._defaultBar = this.ApplicationBar; BindEvents(); }
public static void LocalizeAppBar(this PhoneApplicationPage page, IApplicationBar appBar) { if (appBar == null) { return; } foreach (var button in appBar.Buttons.OfType<ApplicationBarIconButton>()) { button.Text = Strings.ResourceManager.GetString(button.Text); } foreach (var menuItem in appBar.MenuItems.OfType<ApplicationBarMenuItem>()) { menuItem.Text = Strings.ResourceManager.GetString(menuItem.Text); } }
public ShellViewModel(ITrelloApiSettings settings, INavigationService navigation, IApplicationBar applicationBar, MyBoardsViewModel myBoards, MyCardsViewModel myCards, MyNotificationsViewModel myNotifications) : base(navigation, applicationBar) { _myBoards = myBoards; _myCards = myCards; _myNotifications = myNotifications; _myBoards.Bind(applicationBar); _myCards.Bind(applicationBar); _myNotifications.Bind(applicationBar); Title = "TRELLOW"; Subtitle = settings.Fullname; }
public PostListPage() { this.InitializeComponent(); this.DataContext = this._viewModel = new PostListViewModel(this.popupPlaceholder); // app bar this._listApplicationBar = this.ApplicationBar; this._currentItemApplicationBar = this.CreateCurrentItemApplicationBar(); this.LocalizeAppBar(); // update progress indicator this._systemProgressIndicator = new ProgressIndicator() { IsIndeterminate = false, Text = Strings.Loading }; BindingOperations.SetBinding(this._systemProgressIndicator, ProgressIndicator.IsVisibleProperty, new Binding("IsLoadingAfterUpdate") { Source = this.DataContext }); BindingOperations.SetBinding(this._systemProgressIndicator, ProgressIndicator.ValueProperty, new Binding("ProgressAfterUpdate") { Source = this.DataContext }); SystemTray.SetProgressIndicator(this, this._systemProgressIndicator); // on selected post changed this._viewModel.SelectedPostChanged += this.OnSelectedPostChanged; }
public NewThread() { InitializeComponent(); BindEvents(); InteractionEffectManager.AllowedTypes.Add(typeof(RadDataBoundListBoxItem)); InteractionEffectManager.AllowedTypes.Add(typeof(RadListPicker)); InteractionEffectManager.AllowedTypes.Add(typeof(RadListPickerItem)); this._context = this.LayoutRoot.DataContext as ViewModels.ThreadRequestViewModel; if (this._context == null) throw new Exception("DataContext should not be null."); this._tagSource = new AwfulTextBoxTagOptionAdapter(this.ThreadTextBox, this.tagOptions, this._context.Tags); this._previewContext = new ViewModels.ThreadRequestPreviewViewModel(); this.PreviewViewer.SetViewModel(this._previewContext); this.PreviewViewer.PageHeaderPanel.Visibility = System.Windows.Visibility.Collapsed; this._defaultBar = this.ApplicationBar; }
public ThreadList() { InitializeComponent(); PrepareAnimations(); BindEvents(); this.ThreadsList.IsSynchronizedWithCurrentItem = false; this.NewThreadsList.IsSynchronizedWithCurrentItem = false; this.ReadThreadsList.IsSynchronizedWithCurrentItem = false; this.MiscFilterList.IsSynchronizedWithCurrentItem = false; InteractionEffectManager.AllowedTypes.Add(typeof(RadDataBoundListBoxItem)); this._defaultAppBar = this.ApplicationBar; if (App.IsBusy) { OnPageLoading(this, EventArgs.Empty); } GatherStoryboardEvents(); this.context = new ViewModels.ThreadsViewModel(); this.reload = true; }
internal static ApplicationBarIconButton CreateApplicationBarButton(IApplicationBar applicationBar, string buttonUrl, string buttonText, bool isEnabled) { // Trying to add more than 4 buttons to an application bar // will result in a runtime error, so we need to check for that if (applicationBar.Buttons.Count >= 4) { return null; } // Create the button var applicationBarButton = new ApplicationBarIconButton(); applicationBarButton.IconUri = new Uri(buttonUrl, UriKind.Relative); applicationBarButton.Text = buttonText; applicationBarButton.IsEnabled = isEnabled; // Add the button to the specified application bar instance applicationBar.Buttons.Add(applicationBarButton); // Return a reference to the button return applicationBarButton; }
public PlayStopButton(IApplicationBar appbar, IAudioVideoPageVM vm) : base(appbar) { PLAY = new ButtonState() { URI = new Uri("/Images/AudioIcons/play.png", UriKind.Relative), Text = DiversityResources.Button_Play, Command = vm.Play }; STOP = new ButtonState() { URI = new Uri("/Images/AudioIcons/stop.png", UriKind.Relative), Text = DiversityResources.Button_Stop, Command = vm.Stop }; _subscription = vm.ObservableForProperty(x => x.State) .Value() .StartWith(vm.State) .Select(state => (state == PlayStates.Idle) ? PLAY : STOP) .Subscribe(s => this.CurrentState = s); }
public void UpdateApplicationBarButtons(IApplicationBar applicationBar, string[] preserveButtons) { // Create a list of the buttons to preserve in the application bar. var preserveButtonsList = new List<IApplicationBarIconButton>(); foreach (IApplicationBarIconButton button in applicationBar.Buttons) { if (preserveButtons.Contains(button.Text)) { preserveButtonsList.Add(button); } } // Clear the current buttons in the application bar. applicationBar.Buttons.Clear(); // Add application bar buttons specific of the pivot item. this.PopulateApplicationBarButtons(applicationBar); // Add the preserved application bar buttons. foreach (var button in preserveButtonsList) { applicationBar.Buttons.Add(button); } }
public SaveDeleteButton(IApplicationBar appbar, IEditPageVM vm) : base(appbar) { SAVE = new ButtonState() { URI = new Uri("/Images/appbar.save.rest.png", UriKind.Relative), Text = DiversityResources.Button_Save, Command = vm.Save }; DELETE = new ButtonState() { URI = new Uri("/Images/appbar.delete.rest.png", UriKind.Relative), Text = DiversityResources.Button_Delete, Command = vm.Delete }; _subscription = vm.ObservableForProperty(x => x.IsEditable) .Value() .StartWith(vm.IsEditable) .Select(editable => (editable) ? SAVE : DELETE) .Subscribe(s => this.CurrentState = s); }
public EditPageSaveEditButton(IApplicationBar appbar, ISavePageVM vm) : base(appbar) { SAVE = new ButtonState() { URI = new Uri("/Images/appbar.save.rest.png", UriKind.Relative), Text = DiversityResources.Button_Save, Command = vm.Save }; EDIT = new ButtonState() { URI = new Uri("/Images/appbar.edit.rest.png", UriKind.Relative), Text = DiversityResources.Button_Edit, Command = vm.ToggleEditable }; _subscription = vm.ObservableForProperty(x => x.IsEditable) .Value() .StartWith(vm.IsEditable) .Select(editable => (editable) ? SAVE : EDIT) .Subscribe(state => this.CurrentState = state); }
private void initializeApplicationBar() { this.transerButton = new ApplicationBarIconButton(); this.transerButton.IconUri = new Uri("/icons/appbar.transfering.rest.png", UriKind.RelativeOrAbsolute); this.transerButton.Text = this.GetLanguageInfoByKey("TransferingAccount"); this.transerButton.IsEnabled = false; this.transerButton.Click += new System.EventHandler(this.TransferButton_Click); ApplicationBarIconButton button = new ApplicationBarIconButton(); button.Click += new System.EventHandler(this.CancelButton_Click); button.Text = this.GetLanguageInfoByKey("Cancel"); button.IconUri = new Uri("/icons/appbar.cancel.rest.png", UriKind.RelativeOrAbsolute); ApplicationBar bar = new ApplicationBar { Opacity = 0.78 }; this.applicationBarForTransfer = bar; this.applicationBarForTransfer.Buttons.Add(this.transerButton); this.applicationBarForTransfer.Buttons.Add(button); this.editingBarManager = new ApplicationBarHelper(this); this.editingBarManager.OriginalBar = this.applicationBarForTransfer; this.editingBarManager.AddTextBox(new TextBox[] { this.AmountTextBox, this.Description, this.TransferingPoundage }); base.ApplicationBar = this.applicationBarForTransfer; }
private void DialogServiceOnOpened(object sender, EventArgs args) { applicationBar = dialogService.Page.ApplicationBar; if (applicationBar != null) { dialogService.Page.ApplicationBar = null; } }