private void Delete_Photos_Click(object sender, EventArgs e) { this.IsInSelectState = false; ApplicationBar = ((ApplicationBar)this.Resources["DateView_NonSelectState_Photos_AppBar"]); for (int i = PhotoListBox.Items.Count - 1; i >= 0; i--) { if (((Photo)PhotoListBox.Items[i]).IsSelected) { dateViewModel.DeletePhoto((Photo)PhotoListBox.Items[i]); ((DateViewModel)this.DataContext).Photos.Remove((Photo)PhotoListBox.Items[i]); } else { ListBoxItem lbi = (ListBoxItem)PhotoListBox.ItemContainerGenerator.ContainerFromIndex(i); Image image = GeneralMethods.FindChild<Image>(lbi, "ImageMask"); image.Opacity = 0; image.Visibility = Visibility.Collapsed; Border border = (Border)lbi.GetVisualChild(0); border.BorderBrush = new SolidColorBrush(Colors.White); ((Photo)PhotoListBox.Items[i]).IsSelected = false; TiltEffect.SetIsTiltEnabled(((Photo)PhotoListBox.Items[i]).Image, true); } } ((IApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true; ((IApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true; SelectedPhotoCount = 0; }
// Конструктор public MainPage() { InitializeComponent(); TiltEffect.SetIsTiltEnabled(this, true); btn0 = (ApplicationBarIconButton)ApplicationBar.Buttons[0]; btn1 = (ApplicationBarIconButton)ApplicationBar.Buttons[1]; }
private void showPopup(bool wrongPw) { ContentPanel.Visibility = Visibility.Collapsed; //LayoutRoot.Background=Application.Current.Resources. PasswordBox pwBox = new PasswordBox(); TiltEffect.SetIsTiltEnabled(pwBox, true); CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Bitte Passwort eingeben", Content = pwBox, LeftButtonContent = "ok", IsRightButtonEnabled = false, IsFullScreen = false }; if (wrongPw) { messageBox.Message = "Falsches Passwort!!"; } else { messageBox.Message = UntisExp.VConfig.enterPW; } //Create a new custom message box //Define the dismissed event handler messageBox.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: if (pwBox.Password == UntisExp.VConfig.password) { _settings.Write("group", 0); ContentPanel.Visibility = Visibility.Visible; } else { showPopup(true); return; } break; case CustomMessageBoxResult.None: Application.Current.Terminate(); break; default: break; } }; //launch the task messageBox.Show(); }
protected override PhoneApplicationFrame CreatePhoneApplicationFrame() { var frame = new TransitionFrame(); TiltEffect.SetIsTiltEnabled(frame, true); return(frame); }
// Конструктор public MainPage() { InitializeComponent(); TiltEffect.SetIsTiltEnabled(this, true); // Задайте для контекста данных элемента управления listbox пример данных operatorList.DataContext = App.OperatorModel; tmpPhone = String.Empty; }
// Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { TiltEffect.SetIsTiltEnabled(RootFrame, true); Task.Run(() => { ViewModelLocator.GpsWatcherStatic.StartWatcher(); }); }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { TiltEffect.SetIsTiltEnabled(RootFrame, true); if (Thread.CurrentThread.CurrentUICulture.CompareInfo.Name.IndexOf("nl-") >= 0 || Thread.CurrentThread.CurrentCulture.CompareInfo.Name.IndexOf("nl-") >= 0) { Thread.CurrentThread.CurrentUICulture = new CultureInfo("nl-NL"); } }
public JumpListBox() { InitializeComponent(); _jumpListSelector = new JumpListSelector(); _jumpListSelector.LetterClicked += new EventHandler <GEventArgs <object> >(_jumpListSelector_LetterClicked); this.Loaded += JumpListBox_Loaded; TiltEffect.SetIsTiltEnabled(this, true); }
public DailyGirlPage() { InitializeComponent(); if (!App.IsLowMemoryDevice) { TiltEffect.SetIsTiltEnabled(this, true); } DataContext = App.ViewModel; }
/// <summary> /// Pop up a MessageBox with Input Textbox to input the email address of a friend /// </summary> public void InputFriendEmail() { TextBox emailInputBox = new TextBox() { //Set inputscope to Email InputScope = new System.Windows.Input.InputScope() { Names = { new System.Windows.Input.InputScopeName() { NameValue = System.Windows.Input.InputScopeNameValue.EmailSmtpAddress } } } }; TiltEffect.SetIsTiltEnabled(emailInputBox, true); CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Please input Email Address:", Message = "Please input email address of the friend that you want to add.", Content = emailInputBox, LeftButtonContent = "Add", RightButtonContent = "Cancel", IsFullScreen = false, }; messageBox.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: string result = ""; result = emailInputBox.Text; if (result.Length > 0 && !result.Equals(Me.Email)) //make sure there is input and the address doesn't belong to ME { SendFriendRequest(result); } break; case CustomMessageBoxResult.RightButton: // Do something. break; case CustomMessageBoxResult.None: // Do something. break; default: break; } }; messageBox.Show(); }
/// <summary> /// Displays a CustomMessageBox with a CheckBox as content. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event information.</param> private void MessageBoxWithCheckBox_Click(object sender, RoutedEventArgs e) { CheckBox checkBox = new CheckBox() { Content = "Do not ask me again", Margin = new Thickness(0, 14, 0, -2) }; TiltEffect.SetIsTiltEnabled(checkBox, true); CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Would you like to rate and review this application?", Message = "Thank you for trying out the Windows Phone Toolkit." + Environment.NewLine + Environment.NewLine + "We would really like to hear what you think about it. Would you mind spending a couple of minutes to rate and review this application in the Marketplace?", Content = checkBox, LeftButtonContent = "ok", RightButtonContent = "cancel", IsFullScreen = (bool)FullScreenCheckBox.IsChecked }; messageBox.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: // Launch Marketplace review task. // Do not ask again. break; case CustomMessageBoxResult.RightButton: case CustomMessageBoxResult.None: if ((bool)checkBox.IsChecked) { // Do not launch Marketplace review task. // Do not ask again. } else { // Do not launch Marketplace review task. // Ask again later. } break; default: break; } }; messageBox.Show(); }
// Constructor public MainPage() { TiltEffect.SetIsTiltEnabled(this, true); searching = false; refreshingFavs = false; refreshingNearby = false; ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources["DefaultAppBar"]; OCTranspoStopsData.initDB(); InitializeComponent(); setupLists(); setupSearchBox(); setupMap(); }
/// <summary> /// Constructor. /// </summary> public MainPage() { InitializeComponent(); // Setup the language code dialog. langCodeDlg.ItemSource = this.langCodeMap.Keys; langCodeDlg.Title = "SELECT THE LANGUAGE OF YOUR IMAGE"; langCodeDlg.Closed += new EventHandler(langCodeDlg_Closed); TiltEffect.SetIsTiltEnabled(this, true); // Set the default language to 'English'. this.cmbLangCode.DataContext = "English"; langCodeDlg.SelectedIndex = 11; }
private async void MenuItem_Click_2(object sender, System.Windows.Input.GestureEventArgs e) { InputScope scope = new InputScope(); InputScopeName name = new InputScopeName(); name.NameValue = InputScopeNameValue.Text; scope.Names.Add(name); string commentID = (string)(sender as Button).Tag; TextBox box = new TextBox() { Text = (from c in post.comments where c.commentID == commentID select c).First().content, Margin = new Thickness(0, 14, 0, -2), InputScope = scope }; TiltEffect.SetIsTiltEnabled(box, true); CustomMessageBox messageBox = new CustomMessageBox() { Caption = AppResources.editComment, Content = box, LeftButtonContent = "ok", RightButtonContent = AppResources.cancel //IsFullScreen = (bool)FullScreenCheckBox.IsChecked }; var result = await ShowAsync(messageBox); switch (result) { case CustomMessageBoxResult.LeftButton: int res = await Global.googLib.EditComment(commentID, box.Text); if (res != 1) { RefreshPost(); } break; case CustomMessageBoxResult.RightButton: case CustomMessageBoxResult.None: break; default: break; } }
private static void DisplayCustomPopupMessageWithAction(CustomPopupMessageWithAction customPopupMessageWithAction) { CustomMessageBox messageBoxResult = new CustomMessageBox() { Caption = customPopupMessageWithAction.Caption, Message = customPopupMessageWithAction.Message, LeftButtonContent = customPopupMessageWithAction.LeftButtonText, RightButtonContent = customPopupMessageWithAction.RightButtonText }; if (customPopupMessageWithAction.HyperLink != null) { TiltEffect.SetIsTiltEnabled(customPopupMessageWithAction.HyperLink, true); messageBoxResult.Content = customPopupMessageWithAction.HyperLink; } messageBoxResult.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: if (customPopupMessageWithAction.LeftButtonAction != null) { customPopupMessageWithAction.LeftButtonAction(); } break; case CustomMessageBoxResult.RightButton: if (customPopupMessageWithAction.RightButtonAction != null) { customPopupMessageWithAction.RightButtonAction(); } break; case CustomMessageBoxResult.None: if (customPopupMessageWithAction.NoButtonAction != null) { customPopupMessageWithAction.NoButtonAction(); } break; default: break; } }; messageBoxResult.Show(); }
void OnLoad(object sender, RoutedEventArgs e) { TiltEffect.SetIsTiltEnabled(this, true); SetTag(); if (!readingPosManager.Bound) { readingPosManager.Bind(this); } if (!pullDetector.Bound) { pullDetector.Bind(this); pullDetector.Compression += RefreshOnPull; } }
private async void postEditTap(object sender, System.Windows.Input.GestureEventArgs e) { Post post = (Post)(sender as Button).Tag; TextBox box = new TextBox() { Text = post.editableContent, Margin = new Thickness(0, 14, 0, -2) }; TiltEffect.SetIsTiltEnabled(box, true); CustomMessageBox messageBox = new CustomMessageBox() { Caption = AppResources.editPost, //Message = // "Tap Edit to continue.", Content = box, LeftButtonContent = "ok", RightButtonContent = AppResources.cancel //IsFullScreen = (bool)FullScreenCheckBox.IsChecked }; var result = await ShowAsync(messageBox); switch (result) { case CustomMessageBoxResult.LeftButton: string res = await Global.googLib.EditPost(box.Text, post.postID); if (res != null) { //RefreshPost(); //MessageBox.Show("Super!"); contentTextBlock.Text = res; } break; case CustomMessageBoxResult.RightButton: case CustomMessageBoxResult.None: break; default: break; } }
/// <summary> /// Displays a CustomMessageBox with a HyperlinkButton as content. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event information.</param> private void MessageBoxWithHyperlinkButton_Click(object sender, RoutedEventArgs e) { HyperlinkButton hyperlinkButton = new HyperlinkButton() { Content = "Privacy Statement", Margin = new Thickness(0, 28, 0, 8), HorizontalAlignment = HorizontalAlignment.Left, NavigateUri = new Uri("http://silverlight.codeplex.com/", UriKind.Absolute) }; TiltEffect.SetIsTiltEnabled(hyperlinkButton, true); CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Allow this application to access and use your location?", Message = "Sharing this information helps us provide and improve the location-based services offered for this phone. We won't use the information to identify or contact you.", Content = hyperlinkButton, LeftButtonContent = "allow", RightButtonContent = "cancel", IsFullScreen = (bool)FullScreenCheckBox.IsChecked }; messageBox.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: // Do something. break; case CustomMessageBoxResult.RightButton: // Do something. break; case CustomMessageBoxResult.None: // Do something. break; default: break; } }; messageBox.Show(); }
/// <summary> /// 显示提示框,询问用户是否评价此应用。 /// </summary> private void ShowCustomMessageBox() { CheckBox checkBox = new CheckBox() { Content = AppResources.CheckBoxContent, Margin = new Thickness(0, 14, 0, -2) }; TiltEffect.SetIsTiltEnabled(checkBox, true); CustomMessageBox customMessageBox = new CustomMessageBox() { Caption = AppResources.MsgBoxCaption, Message = AppResources.MsgBoxMsg, Content = checkBox, LeftButtonContent = AppResources.MsgBoxLeftBtn, RightButtonContent = AppResources.MsgBoxRightBtn }; customMessageBox.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: case CustomMessageBoxResult.None: appSettings.SetRateTimeAsNow(); appSettings.SetRateStatus(ApplicationSettingsStatus.RateLater); if ((bool)checkBox.IsChecked) { appSettings.SetRateStatus(ApplicationSettingsStatus.RateNever); } break; case CustomMessageBoxResult.RightButton: appSettings.SetRateStatus(ApplicationSettingsStatus.RateNever); ShowMarketplaceReview(); break; default: break; } }; customMessageBox.Show(); }
private static void DisplayCustomPopupMessage(CustomPopupMessage customPopupMessage) { CustomMessageBox messageBoxResult = new CustomMessageBox() { Caption = customPopupMessage.Caption, Message = customPopupMessage.Message, LeftButtonContent = customPopupMessage.LeftButtonText, RightButtonContent = customPopupMessage.RightButtonText }; if (customPopupMessage.HyperLink != null) { TiltEffect.SetIsTiltEnabled(customPopupMessage.HyperLink, true); messageBoxResult.Content = customPopupMessage.HyperLink; } messageBoxResult.Show(); }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) { var tbx = new PhoneTextBox() { Hint = "Titre", Margin = new Thickness(0, 14, 0, -2) }; var uc = new TimeLabeledRadialSlider(); TiltEffect.SetIsTiltEnabled(tbx, true); var messageBox = new CustomMessageBox() { Caption = "Donnez un titre à ce temps", Content = uc, LeftButtonContent = "ok", RightButtonContent = "annuler", IsFullScreen = false }; messageBox.Dismissed += (s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: var b = (Button)sender; b.Content = uc.GetTimeValue().ToString(); //var saved = _chronometerStore.SaveNew(tbx.Text, _stopWatch.Elapsed); //var message = saved ? "Le temps a été enregistré." : "Une erreur est survenue."; //Popup(message); // confirmation break; case CustomMessageBoxResult.RightButton: case CustomMessageBoxResult.None: default: break; } }; messageBox.Show(); //*/ }
public App() { try { BugSenseHandler.Instance.InitAndStartSession(new ExceptionManager(Current), RootFrame, "33c9a891"); UnhandledException += App_UnhandledException; } catch (Exception) { } //BugSenseHandler.Instance.Init(this, "d17bb886"); UnhandledException += ApplicationUnhandledException; InitializeComponent(); InitializePhoneApplication(); TiltEffect.SetIsTiltEnabled(RootFrame, true); DispatcherHelper.Initialize(); }
private void FindSensors_Click(object sender, RoutedEventArgs e) { sp = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Vertical }; lp = new ListPicker(); lp.Items.Add(new ListPickerItem() { Content = "XX2A-DF2A-CS4E-12A3" }); lp.Items.Add(new ListPickerItem() { Content = "12A3-DF2A-XX2A-CS4E" }); lp.Items.Add(new ListPickerItem() { Content = "ZXDC-XDER-432D-3445" }); sp.Children.Add(lp); TiltEffect.SetIsTiltEnabled(sp, true); cmb = new CustomMessageBox() { Content = sp, Opacity = 0.98, RightButtonContent = "Clear", LeftButtonContent = "Select", }; cmb.Dismissing += cmb_Dismissing; lp.SelectionChanged += lp_SelectionChanged; cmb.Show(); }
/// <summary> /// Method that initializes a single pivot item /// </summary> /// <param name="f">Feed to initialize the pivot item from</param> private void CreatePivotItem(RSSFeed f) { if (f.IsVisible) { // Programmatically create the pivot item // Note that most of the time you'd want to do this with XAML and data binding, // or at least use a data template for the content of the pivot item. However in // this case it's better to create everything manually because we are updating the state // of pivot items in LoadItems(). This means that we have to access the pivot // item controls directly, which is very difficult to do in Silverlight if the // controls are being created through data template (this is because FindName() // method of FrameworkTemplate is not available in Silverlight). It would probably be // possible to go around the need of accessing controls directly through data-binding but // that would most likely lead to more code lines than the 16 we need here. PivotItem pivotItem = new PivotItem(); pivotItem.Header = f.Title; pivotItem.Margin = new Thickness(0, 0, 0, 0); Grid grid = new Grid(); grid.Margin = new Thickness(25, 0, 0, 0); // Add a progressbar for each pivot item, initially hidden ProgressBar progressBar = new ProgressBar(); progressBar.IsIndeterminate = false; progressBar.Visibility = Visibility.Collapsed; grid.Children.Add(progressBar); ListBox listBox = new ListBox(); listBox.ItemTemplate = (DataTemplate)Resources["RSSItemTemplate"]; listBox.SelectionChanged += ItemSelectionChanged; // Enable tilt effect for the listbox. // TilEffect is part of Silverlight Toolkit which does not ship as part of this example. Please see // release notes for instructions how to install and use Silverlight Toolkit. TiltEffect.SetIsTiltEnabled(listBox, true); grid.Children.Add(listBox); pivotItem.Content = grid; RSSItemsPivot.Items.Add(pivotItem); } }
public ChannelRecommendPage() { InitializeComponent(); this.Loaded += ChannelRecommendPage_Loaded; _coverNavFactory = new CoverNavFactory(); _coverNavFactory.HttpSucessHandler += coverNav_Successed; _coverNavFactory.HttpFailorTimeOut += http_FailorTimeOut; _recommendChannelFactory = new RecommendListFactory(); _recommendChannelFactory.HttpSucessHandler += recommendChannelFactory_GetChannelsSucceed; _recommendChannelFactory.HttpFailorTimeOut += http_FailorTimeOut; _coverViewModel = new ChannelCoverViewModel(); _recommendChannelViewModel = new ChannelRecommendViewModel(); coverList.ItemsSource = _coverViewModel; var navs = FirstPage.RecommandNavs; if (navs != null) { foreach (var nav in navs) { var item = new PivotItem(); var head = new TextBlock(); head.Text = nav.Name; head.Tag = nav.Navid; head.Style = App.Current.Resources["PivotMasterTitleStyle"] as Style; var content = new LongListSelector(); content.Style = App.Current.Resources["PivotListStyle"] as Style; content.ItemTemplate = App.Current.Resources["CoverRecommendTemplate"] as DataTemplate; content.ItemsSource = _recommendChannelViewModel; content.SelectionChanged += recommend_SelectionChanged; TiltEffect.SetIsTiltEnabled(content, true); item.Header = head; item.Content = content; recommendPivot.Items.Add(item); } } }
public App() { UnhandledException += ApplicationUnhandledException; InitializeComponent(); InitializePhoneApplication(); TiltEffect.SetIsTiltEnabled(RootFrame, true); DispatcherHelper.Initialize(); try { BugSenseHandler.Instance.InitAndStartSession(new ExceptionManager(Current), RootFrame, "4a268ccc"); UnhandledException += App_UnhandledException; } catch (Exception exception) { if (Debugger.IsAttached) { Debug.WriteLine("App.xaml.cs:" + exception); } } }
// Constructor public MainPage() { InitializeComponent(); if (!App.IsLowMemoryDevice) { TiltEffect.SetIsTiltEnabled(this, true); } // try to start the background agent. StartPeriodicAgent(); // Init localized app bar BuildLocalizedApplicationBar(); // Set the data context of the listbox control to the sample data DataContext = App.ViewModel; // For infinite scrolling GirlsStreamList.ItemRealized += GirlsStreamList_ItemRealized; }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Language display initialization InitializeLanguage(); TiltEffect.SetIsTiltEnabled(RootFrame, true); DispatcherHelper.Initialize(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Application.Current.Host.Settings.EnableFrameRateCounter = false; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Prevent the screen from turning off while under the debugger by disabling // the application's idle detection. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } //RootFrame.Navigating += new NavigatingCancelEventHandler(RootFrame_Navigating); }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { TiltEffect.SetIsTiltEnabled(RootFrame, true); TaskHelper.ResetTask(false); //Set culture ISettingService settingService = SimpleIoc.Default.GetInstance <ISettingService>(); // var settingsCulture = settingService.GetCulture(); if (string.IsNullOrEmpty(settingsCulture)) { if (Thread.CurrentThread.CurrentUICulture.CompareInfo.Name.IndexOf("nl-") >= 0 || Thread.CurrentThread.CurrentCulture.CompareInfo.Name.IndexOf("nl-") >= 0) { settingsCulture = "nl-NL"; } else if (Thread.CurrentThread.CurrentUICulture.CompareInfo.Name.IndexOf("en-") >= 0 || Thread.CurrentThread.CurrentCulture.CompareInfo.Name.IndexOf("en-") >= 0) { settingsCulture = "en-US"; } settingService.SetCulture(settingsCulture); } if (!string.IsNullOrEmpty(settingsCulture)) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(settingsCulture); } try { ReviewBugger.CheckNumOfRuns(); } catch { } }
private void Select_Photos_Click(object sender, EventArgs e) { this.IsInSelectState = true; ApplicationBar = ((ApplicationBar)this.Resources["DateView_SelectState_Photos_AppBar"]); for (int i = PhotoListBox.Items.Count - 1; i >= 0; i--) { ListBoxItem lbi = (ListBoxItem)PhotoListBox.ItemContainerGenerator.ContainerFromIndex(i); Image image = GeneralMethods.FindChild<Image>(lbi, "ImageMask"); // shouldn't really need to do these two but something funny happends if I don't image.Visibility = Visibility.Visible; image.Opacity = 0; Border border = (Border)lbi.GetVisualChild(0); border.BorderBrush = new SolidColorBrush(Colors.Blue); ((Photo)PhotoListBox.Items[i]).IsSelected = false; TiltEffect.SetIsTiltEnabled(((Photo)PhotoListBox.Items[i]).Image, false); } ((IApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = false; ((IApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true; }