I have to develop an app for Windows Phone 8. I want the user to be briefly notified without force him to face a Message Box (and consequently having to press a button to dismiss it). Are there any alternatives? I'm from Android and something similar to a Toast would be perfect. Also having the opportunity to change the text color would be nice.
Thank you in advance.
There are toasts in Windows Phone as well but AFAIR they can be used only when your app is in the background. But there is a solution: ToastPrompt class from Coding4Fun toolkit which is visually equal to toast notification.
See details:
https://stackoverflow.com/a/13981508/1985167
You can use ToastPrompt from Coding4Fun toolkit,
like this,
private void ToastWrapWithImgAndTitleClick(object sender, RoutedEventArgs e)
{
var toast = GetToastWithImgAndTitle();
toast.TextWrapping = TextWrapping.Wrap;
toast.Show();
}
private static ToastPrompt GetToastWithImgAndTitle()
{
return new ToastPrompt
{
Title = "With Image",
TextOrientation = System.Windows.Controls.Orientation.Vertical,
Message = LongText,
ImageSource = new BitmapImage(new Uri("../../ApplicationIcon.png", UriKind.RelativeOrAbsolute))
};
}
Related
i wanna provide share option from my windows app to another apps in my windows phone, like android develpement. please any one tell, is it possible in windows phone. (using RT, not in silver Light) Thank You in advance.
For example: like the below image
I am using below code using "How to use ShareLinkTask namespace in Windows Phone 8.1?" link.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
DataTransferManager dtManager = DataTransferManager.GetForCurrentView();
dtManager.DataRequested += dtManager_DataRequested;
}
private async void dtManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
e.Request.Data.Properties.Title = "Code Samples";
e.Request.Data.Properties.Description = "Here are some great code samples for Windows Phone.";
e.Request.Data.SetWebLink(new Uri("http://code.msdn.com/wpapps"));
}
// Click Button to share Web Link
private void btnShareLink_Click(object sender, RoutedEventArgs e)
{
Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
}
but it displays a progress bar with a message Preparing content to share and then it disappears, with no UI for sharing.
what should I do.please help me.
I have a CaptureElement in my WP8.1 App, My CaptureElement Stuck on one frame if I do below steps:
Open that page which have capture element, it shows my camera preview.
Press and hold hardware back button of phone. Recent apps will be shown on screen.
Don't tap on any app just again press hardware back button one time.
It will take me back to capture element screen but now the preview is showing last frame when I press and hold back button.
I have tried this on default camera app of phone and it works ok but flicks a little bit, seems that they have handled it.
How can I handle it in my application.
By surfing on internet I came to know that this suspends the application so I have to handle suspension states.
Just adding these simple lines, it worked perfectly :)
public MediaCapture()
{
this.InitializeComponent();
this.navigationHelper = new NavigationHelper(this);
Application.Current.Resuming += App_resuming;
Application.Current.Suspending += App_Suspending;
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
async void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
{
if (captureManager != null)
{
await captureManager.StopPreviewAsync();
captureManager.Dispose();
captureManager = null;
}
}
private void App_resuming(object sender, object e)
{
if (Frame.Content == this)
{
InitializeCamera();
}
}
I have an universal app and the windows version use ink manager to capture a signature. I want to do the same with the phone but the ink manager dont exist. Does anyone have or know an alternative.
I added a canvas named Display and add this code using two events.
private Point _currentPoint;
private Point _oldPoint;
private async void Display_PointerMoved(object sender, PointerRoutedEventArgs e)
{
DrawPoint(e);
}
private void DrawPoint(PointerRoutedEventArgs e)
{
_currentPoint = e.GetCurrentPoint(this).Position;
Line linea = new Line
{
Stroke = new SolidColorBrush(Colors.Black),
StrokeThickness=1,
X1 = _currentPoint.X,
Y1 = _currentPoint.Y,
X2 = _oldPoint.X,
Y2 = _oldPoint.Y
};
Display.Children.Add(linea);
_oldPoint = _currentPoint;
}
private void Display_PointerPressed(object sender, PointerRoutedEventArgs e)
{
_currentPoint = e.GetCurrentPoint(this).Position;
_oldPoint = _currentPoint;
}
Input: XAML user input events sample in Microsoft MSDN code has a sample using pointer events with both C# and Visual Basic. Specifies Visual Studio 2013 but will probably upgrade with a later version of Visual Studio. And this example looks to be for Windows 8.1 however you might be able to use that as a starting place.
I'm working on a windows phone 8 application. I want to use toggle switch for some purposes. Sadly windows phone 8 does not have that controller. So i had to install windows phone toolkit nuget package.
Now I want to set the state(some thing like isChecked=true). but I couldn't find any method to use.
can someone please help me.
Try this on Button Click
private void Button_Click(object sender, RoutedEventArgs e)
{
if (toggleSwitch.IsChecked == true)
toggleSwitch.IsChecked = false;
else
toggleSwitch.IsChecked = true;
}
It is Working....
I need to develop an app to make a call from the Windows Phone 8 app using Visual Studio.
But I couldn't find any resources to do it.
When a button is clicked I need to call to a mobile number which is already given.
By clicking that button I must call only to that mobile number.
This is what I coded. When a given button is clicked, I this method is calling...
private void HyperlinkButton_Click_1(object sender, RoutedEventArgs e)
{
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "0719957868";
phoneCallTask.DisplayName = "Gage";
phoneCallTask.Show();
}
But I get an unhandled exception.
Unhandled exception.
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break();
}
}
When you use PhoneCallTask, you have to specify a new Capability of your app in WMAppManifest.xaml: ID_CAP_PHONEDIALER
source
This is how you should do it:
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "2065550123";
phoneCallTask.DisplayName = "Gage";
phoneCallTask.Show();
Remember that the call is not automatically started but it prompts the user to confirm that action.
Here is how to initiate a call on windows phone
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394025(v=vs.105).aspx
Ok for future reference i must add this.
If you get an Unauthorized Access Exception then you need to enable ID_CAP_PHONEDAILER from the Capabilities section in the WMAppManifest.xml file.
See here