/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { _notWindow = new NotificationWindow(); var popControl = new PopupControl { DataContext = this }; _notWindow.Content = popControl; // Code runs "for real" initTime = DateTime.Now; mainTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(timerSleep) }; mainTimer.Tick += new EventHandler(timer_Tick); mainTimer.Start(); wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); wc.DownloadStringAsync(vocaUrl); } }
private void OnQueryDisplayText(object sender, QueryDisplayTextEventArgs e) { //if (Closing) //{ // return; //} if (WinUtils.IsComponentInDesignMode(sender as Component) || m_repositoryPopupEdit != null || PopupControl == null) { return; } e.DisplayText = PopupControl.GetDisplayText(); var popupEdit = sender as PopupContainerEdit; if (m_DisplayTextInternal != e.DisplayText) { m_DisplayTextInternal = e.DisplayText; if (popupEdit != null) { popupEdit.ToolTip = e.DisplayText; } //if (OnDisplayTextChangedEvent != null) // OnDisplayTextChangedEvent(this, EventArgs.Empty); } if (popupEdit != null) { popupEdit.Text = e.DisplayText; } }
public void viewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("CurrentPopupView")) { if (null == viewModel.CurrentPopupView) { PopupControl.ShowPopup(false, viewModel.CurrentPopupView, false); } else if (viewModel.CommandParameter != null && (viewModel.CommandParameter.Equals("forgotPassword") || viewModel.CommandParameter.Equals("resetPassword")) || viewModel.CommandParameter.Equals("TemporaryPINSent")) { PopupControl.ShowPopup(true, viewModel.CurrentPopupView, false); } } else if (e.PropertyName.Equals("TemporaryPINAlreadySent")) { viewModel.CurrentPopupView = new SaveNotificationPopup("Please check your email. Your temporary password/PIN has been sent to your email.\nClick on Reset Password? button in the login screen to reset password using the temporary password/PIN provided."); } else if (e.PropertyName.Equals("InvalidUser")) { loginWarning.Visibility = Visibility.Visible; } else if (e.PropertyName.Equals("LogoutUser")) { loginWarning.Visibility = Visibility.Collapsed; } UserNameFocus(); }
private void ShowControl() { if (AssociatedObject.IsVisible && AssociatedObject.Opacity > 0.01) { PopupControl?.ShowMessageFor(AssociatedObject, MessageText, new Point(Dx, Dy)); } }
private async void UploadAvatar(Load avatarLoader) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(); PopupControl.OpenPopup(ActivityPopup); try { Stream stream = await avatarLoader(); if (stream == null) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); ErrorPopup.MessageText = Constants.FILE_SELECTION_ERROR; PopupControl.OpenPopup(ErrorPopup); return; } CurrentUser = await App.DI.Resolve <ChangeAvatarController>().ChangeAvatar(CurrentUser, stream); CurrentUser = await App.DI.Resolve <UpdateProfileController>().Update(CurrentUser); PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); LoadCurrentUserProfile(); } catch (ResponseException ex) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); ErrorPopup.MessageText = ex.message; PopupControl.OpenPopup(ErrorPopup); } }
private async void SignUpAsync(string login, string password, string email) { PopupControl.OpenPopup(ActivityPopup); try { User user = await App.DI.Resolve <SignUpController>().SignUp(login, password, email); App.Current.MainPage = new CurrentUserProfilePage(user); PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); } catch (ResponseException ex) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); ErrorPopup.MessageText = ex.message; PopupControl.OpenPopup(ErrorPopup); } /*catch(Exception ex) * { * PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); * * AuthErrorMessage.Text = ex.InnerException.Message; * PopupControl.OpenPopup(ErrorPopup); * }*/ }
// Adds given pause controller as invoker of toggle pause event public static void AddTogglePauseInvoker(PopupControl invoker) { // adds invoker to list and adds all listeners to this invoker togglePauseInvokers.Add(invoker); foreach (UnityAction <bool> listener in togglePauseListeners) { invoker.AddTogglePauseListener(listener); } }
private bool EditProfile_OnClick(MotionEvent ME, CustomControls.IClickable sender) { if (ME.Action == MotionEventActions.Down) { PopupControl.OpenPopup(UpdateProfilePopup); } return(false); }
private bool UserAvatarChange_OnClick(MotionEvent ME, CustomControls.IClickable sender) { if (ME.Action == MotionEventActions.Down) { PopupControl.OpenPopup(SelectAvatarSourcePopup); } return(false); }
protected override bool OnBackButtonPressed() { if (PopupControl.OpenedPopupsCount == 0 || PopupControl.IsKeyboardVisible()) { return(false); } PopupControl.CloseTopPopup(); return(true); }
public static PopupControl<NoteEntity> NotesCreateClick(this IWidgetContainer container) { container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-notes-toggler")).Click(); By createLocator = container.WidgetContainerLocator().CombineCss(" a.sf-note-create"); container.Selenium.WaitElementVisible(createLocator); container.Selenium.FindElement(createLocator).Click(); PopupControl<NoteEntity> result = new PopupControl<NoteEntity>(container.Selenium, "New"); container.Selenium.WaitElementPresent(result.PopupLocator); return result; }
private void ProfilePage_Appearing(object sender, System.EventArgs e) { LoadUserProfile(); ErrorPopup.OnFirstButtonClicked = (ctx, arg) => PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(); SelectAvatarSourcePopup.OnFirstButtonClicked = (ctx, arg) => { UploadAvatar(async() => await App.DI.Resolve <Camera>().TakePhoto(Camera.CameraLocation.FRONT, Constants.MAX_PHOTO_WIDTH_HEIGHT)); }; SelectAvatarSourcePopup.OnSecondButtonClicked = (ctx, arg) => { UploadAvatar(async() => await App.DI.Resolve <Gallery>().PickPhoto(Constants.MAX_PHOTO_WIDTH_HEIGHT)); }; n1.ImageSource = "settings.png"; n2.ImageSource = "update.png"; }
protected override bool OnBackButtonPressed() { if (PopupControl.OpenedPopupsCount == 0 || PopupControl.IsKeyboardVisible()) { App.Current.MainPage = new MainPage(); } else { PopupControl.CloseTopPopup(); } return(true); }
private void button2_Click(object sender, EventArgs e) { PopupControl popup = new PopupControl(dataGridView1); popup.Show(new Point(this.Location.X - 128, this.Location.Y)); //optionally change the items in the data source _People.Add(new Person() { FirstName = "NewFirst", LastName = "NewLast", PhoneNumber = "123-333-3322" }); //reset the bindings bindingSource1.DataSource = _People; bindingSource1.ResetBindings(true); }
public static void NavigateAdaptive(Type page, object parameter = null, bool clearHistory = false, NavigationTransitionInfo infoOverride = null) { if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile") { Main.Navigate(page, parameter, clearHistory, infoOverride); } else { var flyout = new PopupControl(); var frame = new Frame(); frame.Navigate(page, parameter, new SuppressNavigationTransitionInfo()); flyout.FlyoutContent = frame; flyout.Show(); } }
public void OrderWebTestExample() { Browse("Normal", b => { Lite <OrderEntity> lite = null; try { b.SearchPage(typeof(PersonEntity)).Using(persons => { persons.Search(); persons.SearchControl.Results.OrderBy("Id"); return(persons.Results.EntityClick <PersonEntity>(1)); }).Using(john => { using (PopupControl <OrderEntity> order = john.ConstructFromPopup(OrderOperation.CreateOrderFromCustomer)) { order.ValueLineValue(a => a.ShipName, Guid.NewGuid().ToString()); order.EntityCombo(a => a.ShipVia).SelectLabel("FedEx"); ProductEntity sonicProduct = Database.Query <ProductEntity>().SingleEx(p => p.ProductName.Contains("Sonic")); var line = order.EntityListDetail(a => a.Details).CreateElement <OrderDetailsEntity>(); line.EntityLineValue(a => a.Product, sonicProduct.ToLite()); Assert.AreEqual(sonicProduct.UnitPrice, order.ValueLineValue(a => a.TotalPrice)); order.ExecuteAjax(OrderOperation.SaveNew); lite = order.GetLite(); Assert.AreEqual(sonicProduct.UnitPrice, order.ValueLineValue(a => a.TotalPrice)); } return(b.NormalPage(lite)); }).EndUsing(order => { Assert.AreEqual(lite.InDB(a => a.TotalPrice), order.ValueLineValue(a => a.TotalPrice)); }); } finally { if (lite != null) { lite.Delete(); } } }); }//OrderWebTestExample
private async void AddTracksToPlaylist(List <AudioVk> tracks) { var playlist = (PlaylistVk)await PopupControl.Show <SelectPlaylistView>(); if (playlist == null) { return; } try { await _tracksService.AddTracksToPlaylist(tracks, playlist.Id); } catch (Exception ex) { Logger.Error(ex, "Unable to add tracks to playlist"); } }
protected override void InitializeCommands() { SignOutVkCommand = new DelegateCommand(() => { Messenger.Default.Send(new MessageUserAuthChanged { IsLoggedIn = false }); Analytics.TrackEvent(AnalyticsEvent.SignOutVk); }); SignInLastFmCommand = new DelegateCommand(async() => { await PopupControl.Show <LastFmLoginView>(); RaisePropertyChanged(nameof(LastFmSession)); }); SignOutLastFmCommand = new DelegateCommand(() => { AppState.LastFmSession = null; RaisePropertyChanged(nameof(LastFmSession)); }); bool isDeleting = false; ClearAlbumCoversCommand = new DelegateCommand(async() => { if (isDeleting) { return; } isDeleting = true; IsAlbumCoversDeleted = false; try { StorageFolder cache = await ApplicationData.Current.LocalFolder.GetFolderAsync("Cache"); await cache.DeleteAsync(); IsAlbumCoversDeleted = true; } catch (Exception ex) { Logger.Error(ex, "Album covers cleanup failed."); } isDeleting = false; }); }
private async void LogInAsync(string login, string password) { PopupControl.OpenPopup(ActivityPopup); try { User user = await App.DI.Resolve <LogInController>().LogIn(login, password); App.Current.MainPage = new CurrentUserProfilePage(user); PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); } catch (ResponseException ex) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); ErrorPopup.MessageText = ex.message; PopupControl.OpenPopup(ErrorPopup); } }
public void viewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("CurrentPopupView")) { if (null == viewModel.CurrentPopupView) { this.GridCustomers.IsEnabled = true; this.userInfoPanel.Opacity = this.GridCustomers.Opacity = this.MainTabControl.Opacity = this.CancelButton.Opacity = this.SaveButton.Opacity = this.DeleteButton.Opacity = this.SearchPanel.Opacity = 1; this.Opacity = 1; PopupControl.ShowPopup(false, viewModel.CurrentPopupView, false); } else { this.GridCustomers.IsEnabled = false; this.userInfoPanel.Opacity = this.GridCustomers.Opacity = this.MainTabControl.Opacity = this.CancelButton.Opacity = this.SaveButton.Opacity = this.DeleteButton.Opacity = this.SearchPanel.Opacity = 0.5; PopupControl.ShowPopup(true, viewModel.CurrentPopupView, false); } } else if (e.PropertyName.Equals("SavedCustomer")) { viewModel.CurrentPopupView = new SaveNotificationPopup("Details are successfully saved."); } else if (e.PropertyName.Equals("EmptyFields")) { viewModel.CurrentPopupView = new WarningErrorNotificationPopup("Please fill the required fields."); } else if (e.PropertyName.Equals("ReadyToSave")) { SaveDetails(); } else if (e.PropertyName.Equals("PasswordChanged")) { viewModel.CurrentPopupView = new SaveNotificationPopup("Password changed successfully."); } if (e.PropertyName.Equals("NonAdmin") || viewModel.CurrentPopupView == null) { if (viewModel.CurrentAppUser != null) { DisableControlForNonAdmin(viewModel.CurrentAppUser.IsAdmin); } } }
private async void LoadUserProfile() { try { PopupControl.OpenPopup(ActivityPopup); CurrentUser = await App.DI.Resolve <GetProfileController>().GetUserById(CurrentUser.id); LoadCurrentUserProfile(); PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); } catch (ResponseException ex) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); ErrorPopup.MessageText = ex.message; PopupControl.OpenPopup(ErrorPopup); } }
protected override void InitializeCommands() { SignOutVkCommand = new DelegateCommand(() => { Messenger.Default.Send(new MessageUserAuthChanged { IsLoggedIn = false }); Analytics.TrackEvent(AnalyticsEvent.SignOutVk); }); SignInLastFmCommand = new DelegateCommand(async() => { await PopupControl.Show <LastFmLoginView>(); RaisePropertyChanged(nameof(LastFmSession)); }); SignOutLastFmCommand = new DelegateCommand(() => { AppState.LastFmSession = null; RaisePropertyChanged(nameof(LastFmSession)); }); }
private async void EditProfileAsync() { PopupControl.OpenPopup(ActivityPopup); try { CurrentUser.fullName = FirstNameEntry.Text + Constants.FIRST_LAST_NAME_SPLITTER.ToString() + LastNameEntry.Text; CurrentUser.phone = PhoneEntry.Text; CurrentUser = await App.DI.Resolve <UpdateProfileController>().Update(CurrentUser); LoadCurrentUserProfile(); PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(); } catch (ResponseException ex) { PopupControl.CloseTopPopupAndHideKeyboardIfNeeded(true); ErrorPopup.MessageText = ex.message; PopupControl.OpenPopup(ErrorPopup); } }
private void CurrentView_BackRequested(object sender, BackRequestedEventArgs e) { PopupControl.CloseCurrent(); }
protected override void InitializeCommands() { GoToSettingsCommand = new DelegateCommand(() => { App.Current.NavigationService.Navigate(typeof(SettingsView)); }); PlaySingleTrackCommand = new DelegateCommand <IAudio>(track => { AudioService.Instance.PlayAudio(track, new List <IAudio> { track }); }); AddTrackToNowPlayingCommand = new DelegateCommand <IAudio>(track => { AudioService.Instance.CurrentPlaylist.Add(track); }); RemoveTrackFromNowPlayingCommand = new DelegateCommand <IAudio>(track => { AudioService.Instance.CurrentPlaylist.Remove(track); }); PlayTrackNextCommand = new DelegateCommand <IAudio>(track => { AudioService.Instance.CurrentPlaylist.AddAfterCurrent(track); }); AddTrackToMyMusicCommand = new DelegateCommand <AudioVk>(AddTrackToMyMusic); EditTrackCommand = new DelegateCommand <AudioVk>(async track => { await PopupControl.Show <EditTrackView>(new Dictionary <string, object> { ["track"] = track }); }); RemoveTrackFromMyMusicCommand = new DelegateCommand <AudioVk>(RemoveTrackFromMyMusic); ShowTrackLyricsCommand = new DelegateCommand <AudioVk>(async track => { await PopupControl.Show <TrackLyricsView>(new Dictionary <string, object> { ["track"] = track }); }); FindMoreForTrackCommand = new DelegateCommand <IAudio>(track => { App.Current.NavigationService.Navigate(typeof(SearchView), new Dictionary <string, object> { ["query"] = track.Artist }); }); CopyTrackTitleCommand = new DelegateCommand <IAudio>(track => { var data = new DataPackage(); data.SetText($"{track.Artist} - {track.Title}"); Clipboard.SetContent(data); }); SearchCommand = new DelegateCommand <string>(query => { App.Current.NavigationService.Navigate(typeof(SearchView), new Dictionary <string, object> { ["query"] = query }); }); GoToPostAuthorCommand = new DelegateCommand <AudioPost>(async post => { await Launcher.LaunchUriAsync(post.AuthorUri); }); GoToPostCommand = new DelegateCommand <AudioPost>(async post => { await Launcher.LaunchUriAsync(post.PostUri); }); PlayPlaylistCommand = new DelegateCommand <PlaylistVk>(async playlist => { try { var tracks = await _tracksService.GetTracks(long.Parse(playlist.OwnerId), long.Parse(playlist.Id), accessKey: playlist.AccessKey); if (tracks.Count > 0) { AudioService.Instance.PlayAudio(tracks.First(), tracks); } } catch (Exception ex) { Logger.Error(ex, "Unable to play playlist"); } }); EditPlaylistCommand = new DelegateCommand <PlaylistVk>(async playlist => { await PopupControl.Show <EditPlaylistView>(new Dictionary <string, object> { ["playlist"] = playlist }); }); DeletePlaylistCommand = new DelegateCommand <PlaylistVk>(async playlist => { //TODO unfollow if (await _tracksService.DeletePlaylist(playlist)) { Messenger.Default.Send(new MessagePlaylistRemoved() { Playlist = playlist }); } }); AddTrackToPlaylistCommand = new DelegateCommand <AudioVk>(track => { AddTracksToPlaylist(new List <AudioVk> { track }); }); SavePlaylistCommand = new DelegateCommand <PlaylistVk>(async playlist => { try { await _tracksService.FollowPlaylist(playlist); } catch (Exception ex) { Logger.Error(ex, "Unable to follow playlist"); } }); ShowDownloadLinkCommand = new DelegateCommand <AudioVk>(async track => { ContentDialog dialog = new ContentDialog() { Title = Meridian.Utils.Helpers.Resources.GetStringByKey("ContextMenu_DownloadLink"), PrimaryButtonText = Meridian.Utils.Helpers.Resources.GetStringByKey("Close") }; dialog.Content = new TextBox { Text = track.Source.ToString(), TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, IsReadOnly = true, }; await dialog.ShowAsync(); }); }
protected override void InitializeCommands() { base.InitializeCommands(); //place other commands here AddPlaylistCommand = new DelegateCommand(async() => { var newPlaylist = (IPlaylist)await PopupControl.Show <EditPlaylistView>(); if (newPlaylist != null) { Playlists.Insert(0, newPlaylist); } }); GoToPlaylistCommand = new DelegateCommand <PlaylistVk>(playlist => { NavigationService.Navigate(typeof(PlaylistView), new Dictionary <string, object> { ["playlist"] = playlist }); }); ShuffleAllCommand = new DelegateCommand(() => { List <IAudio> tracks = null; switch (_tabIndex) { case 0: tracks = Tracks.ToList(); break; case 1: tracks = _news?.SelectMany(p => p.Tracks).ToList(); break; case 2: tracks = _wallPosts?.SelectMany(p => p.Tracks).ToList(); break; } if (tracks.IsNullOrEmpty()) { return; } tracks.Shuffle(); AudioService.Instance.PlayAudio(tracks.First(), tracks); }); PlayAllCommand = new DelegateCommand(() => { List <IAudio> tracks = null; if (_tabIndex == 1) { tracks = _news?.SelectMany(p => p.Tracks).ToList(); } else if (_tabIndex == 2) { tracks = _wallPosts?.SelectMany(p => p.Tracks).ToList(); } if (tracks.IsNullOrEmpty()) { return; } AudioService.Instance.PlayAudio(tracks.First(), tracks); }); }
private void LogInButton_Clicked(object sender, EventArgs e) => PopupControl.OpenPopup(LogInPopup);
private void SignUpButton_Clicked(object sender, EventArgs e) => PopupControl.OpenPopup(SignUpPopup);
private void AuthErrorClose_Clicked(object sender, EventArgs e) => PopupControl.CloseTopPopupAndHideKeyboardIfNeeded();
/// <summary> /// Hides an existing popup /// </summary> /// <param name="popupContent">a child or root element of the popup content</param> /// <param name="Host_Id">Identifier of the host control</param> public static async Task HidePopupControlAsync(FrameworkElement popupContent, string Host_Id = null) { var id = PopupControl.GetIdentifier(popupContent); await HidePopupControlAsync(id, Host_Id); }
/// <summary> /// Hides an existing popup /// </summary> /// <param name="popupContent">a child or root element of the popup content</param> /// <param name="Host_Id">Identifier of the host control</param> public static void HidePopupControl(FrameworkElement popupContent, string Host_Id = null) { var id = PopupControl.GetIdentifier(popupContent); HidePopupControl(id, Host_Id); }