Windows phone 8.1 ink manager alternative - windows-phone-8.1

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.

Related

share option in windows phone app

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.

Windows Phone 8 - Message Box alternative

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))
};
}

Trigger a phone call in Windows Phone 8 application

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

ReadingChanged never called for Accelerometer on WP8

I'm trying to use the C++ Accelerometer interface in the Windows::Devices::Sensors namespace on the Windows Phone 8. The code is very similar to a C# project I have that works, but I can't get the C++ event to fire like I can with my C# code.
My C++ code is a C# project with a C++ component, the C++ component just opens up the Accelerometer device for reading, and then tries to setup an event to fire whenever data is ready:
AccelerometerWrapper::AccelerometerWrapper() {
Accelerometer^ acc = Accelerometer::GetDefault();
accReading = acc->ReadingChanged::add( ref new TypedEventHandler<Accelerometer^, AccelerometerReadingChangedEventArgs^>(this, &AccelerometerWrapper::ReadingChanged));
}
void AccelerometerWrapper::ReadingChanged(Accelerometer^ sender, AccelerometerReadingChangedEventArgs^ e) {
...
}
Unfortunately, my ReadingChanged() function is never being called. I've looked around for a Start() method or somesuch but I can't find anything. I'm basing most of my knowledge off of the AccelerometerCPP example, but I can't actually test that as it is a generic WinRT (e.g. Windows 8, not Windows Phone 8) example, and my computer does not have an accelerometer. Everything compiles and runs, the event is just never triggered.
EDIT: I have successfully run a test to verify that I can manually call acc->GetCurrentReading(), so the accelerometer is working, it just seems to be the event that is not getting triggered.
Thank you in advance!
I'm not a C++ expert, but the new Accelerometer sensor works on my machine using C#.
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
var accelerometer = Accelerometer.GetDefault();
if (accelerometer != null)
{
accelerometer.ReadingChanged += accelerometer_ReadingChanged;
}
}
void accelerometer_ReadingChanged(Accelerometer sender, AccelerometerReadingChangedEventArgs args)
{
Debug.WriteLine(args.Reading.AccelerationX + ", " + args.Reading.AccelerationY + "," + args.Reading.AccelerationZ);
}
When we run that code snippet we can see the following expected output:
Just a guess for C++, do you need to cache the Accelerometer instance somewhere instead of letting it go out of scope?

Windows Phone 8 Connection Handler / Internet Availability

My team is working on a team project aplication. At the moment, we need an event handler to check the connection status (if it's on/off).
I had big hopes in the System.Net.NetworkInformation Namespace, but unfortunately most important things aren't supported in wp8.
Can anyone help me with it a bit?
Edit 1#
It seems, I didn't specifed my problem well.
I'm using Mvvm light expresion, and it does not support that namespace or at least I can't add it.
I'm a newbie in using VS and c# atm, mayby I'm doing someting wrong, but simply when im trying to add the refernce to my project it does not list.
I haven't tried the System.Net.NetworkInformation namespace on WP8. But the new WP8 Windows.Networking.Connectivity Windows Phone Runtime namespace works just fine.
Use Windows.Networking.Connectivity.NetworkInformation.NetworkStatusChanged to know when network conditions change and use Microsoft.Phone.Net.NetworkInformation.NetworkInterface properties or Windows.Networking.Connectivity.NetworkInformation properties to see what's up.
private async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
PrintNetworkStatus();
NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;
}
void NetworkInformation_NetworkStatusChanged(object sender)
{
PrintNetworkStatus();
}
private void PrintNetworkStatus()
{
Dispatcher.BeginInvoke(() =>
MessageBox.Show(NetworkInterface.NetworkInterfaceType +
Environment.NewLine +
NetworkInterface.GetIsNetworkAvailable()));
}
When I test this code snippet on my WP8 Lumia 920 it works as expected. On startup when my phone is on WiFi only I see the following MessageBox:
And once I shutdown my WiFI router and the WiFi connection on the phone is lost I see the following MessageBox:
Try this:
bool isNetwork=NetworkInterface.GetIsNetworkAvailable();
if(!isNetwork)
{
//proceed with your code
}
In App.xaml.cs, create a property like below
/// <summary>
/// check if network is available
/// </summary>
public bool IsNetworkAvailable
{
get
{
return NetworkInterface.NetworkInterfaceType != NetworkInterfaceType.None;
}
}
And you can use this property anywhere in your project as in below code
if (((App) Application.Current).IsNetworkAvailable)
{
//Lines of Code
}
else
{
MessageBox.Show("Not Connected to Network!", "Checking Connection!",
MessageBoxButton.OK);
}