Windows Phone 8.1 Tile Wont Flip - c#

How do I make my live tile for Windows Phone 8.1 Flip?
I have this piece of code, but have no clue where to add it. Or if there is anything else I need to implement.
FlipTileData TileData = new FlipTileData()
{
Title = "[title]",
BackTitle = "[back of Tile title]",
BackContent = "[back of medium Tile size content]",
WideBackContent = "[back of wide Tile size content]",
Count = 2,
SmallBackgroundImage = new Uri("/Assets/Tiles/ApplicationIcon.png", UriKind.Relative),
BackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative),
BackBackgroundImage = new Uri("/Assets/Tiles/CycleImage1Medi.png", UriKind.Relative),
WideBackgroundImage = new Uri("/Assets/Tiles/CycleTileLarge.png", UriKind.Relative),
WideBackBackgroundImage = new Uri("/Assets/Tiles/CycleImage1Wide.png", UriKind.Relative),
};
What am I suppose to do from here? Thanks for the help!

I'm not sure whether this template of FlipTileData would apply for for WP 8.1.
This thread talks about the live tiles for WP 8.1.
http://blogs.msdn.com/b/thunbrynt/archive/2014/04/10/windows-phone-8-1-for-developers-live-tiles.aspx
This one could be a reference too.
Hope it helps!

Related

Emoticons in TextBlock in WPF application

I want to add emoticons to WPF chat application. I know that wpf don't supports emoticons for that reason I am replacing emoticons with image. I am using inline property of textBlock to add images to textBlock but, I having problem with alignment of images. I am not able to make emoticon images to get properly aligned. I am sharing a screenshot of how it is looking.
Screenshot of app window
This is how emoticon is looking
the example is just a demo where I am adding elements in constructor only to see how it will look. I am sharing my code as well.
#out.Inlines.Add(new Run("Hii, my name is Ajay!!"));
Image emo = new Image();
emo.Height = 15;
emo.Width = 15;
emo.VerticalAlignment = VerticalAlignment.Bottom;
emo.Margin = new Thickness(3, 0, 0, 0);
emo.Source = new BitmapImage(new Uri(#"C:\Users\admin\Desktop\test1.jpg", UriKind.RelativeOrAbsolute));
// InlineUIContainer container = new InlineUIContainer(emo);
#out.Inlines.Add(emo);
Is there any way I can make emoticon image properly align? Is it OK to use textblock or I should use any other control for this?
Any help is highly appreciated.
A few potential options may be:
set the Top margin on the Image. it's in the format of LEFT, TOP, RIGHT, BOTTOM
emo.Margin = new Thickness(3, 4, 0, 0);
Another option is to wrap the image in a Run and set the BaselineAlignment. https://msdn.microsoft.com/en-us/library/system.windows.baselinealignment
var imageRun= new Run(emo);
imageRun.BaselineAlignment = BaselineAlignment.TextBottom; //experiment with the other enum options
#out.Inlines.Add(imageRun);
adjust the text rather than the image (though i would keep trying with the image and use this as a last resort).
var textRun = new Run("Hii, my name is Ajay!!");
textRun.Margin = experiment;
textRun.BaselineAlignment = experiment;
#out.Inlines.Add(textRun );
I tried as #Bill Tarbell suggested and it worked for me.
Final working code is as follows:
var textRun = new Run("Hii, my name is Ajay!!");
textRun.BaselineAlignment = BaselineAlignment.Center;
#out.Inlines.Add(textRun);
Image emo = new Image();
emo.Height = 20;
emo.Width = 20;
emo.VerticalAlignment = VerticalAlignment.Bottom;
emo.Margin = new Thickness(3, 0, 0, 0);
emo.Source = new BitmapImage(new Uri(#"C:\Users\admin\Desktop\test1.jpg", UriKind.RelativeOrAbsolute));
// InlineUIContainer container = new InlineUIContainer(emo);
#out.Inlines.Add(emo)

How to add marker at current location on a Windows Phone App Map

First of all I'm very new to Windows Phone dev so I might miss something obvious.
I have a ControlMap in my xaml, i'm trying to add marker at my current location. I've gone through many tutorials and I can't only find deprecated ways (tons of using not working) to do it and while it seems simple at first view, I simply can't make it work.
The map in the xaml :
<Maps:MapControl x:Name="LocateMap" Height="221" Margin="0,0,-0.167,0"/>
What should I do in the .cs to add this marker ? And where ?
The intent is to store it later, and then print when the app launch all the olds markers + the actual location marker.
If you want to set a pin on a specific location (latitude, longitude), do the following steps.
//setting the Map center
LocateMap.Center = CurrentLocation = new System.Device.Location.GeoCoordinate(lat, lon);
// Create a small circle to mark the current location.
Ellipse myCircle = new Ellipse();
myCircle.Fill = App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;
myCircle.Height = 20;
myCircle.Width = 20;
myCircle.Opacity = 50;
// Create a MapOverlay to contain the circle.
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = new System.Device.Location.GeoCoordinate(lat,
lon);
// Create a MapLayer to contain the MapOverlay.
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
//adding map layer to the map
LocateMap.Layers.Add(myLocationLayer);

Windows Phone 7 Creating video streams

Hi i am creating a project in windows phone 7 that will capture videos and transport it to some other device. Here is my code so far.
// Initialize the camera if it exists on the device.
if (videoCaptureDevice != null)
{
captureSource = new CaptureSource();
fileSink = new FileSink();
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
CompositeTransform transform = new CompositeTransform();
transform.CenterX = 0.5;
transform.CenterY = 0.5;
transform.Rotation = 90;
videoRecorderBrush.RelativeTransform = transform;
videoRecorderBrush.SetSource(captureSource);
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
// Start video capture and display it on the viewfinder.
captureSource.Start();
// Set the button state and the message.
}
What i want is to save the the video that was captured to some kind of buffer,so that i can send it and the other device can see that video (Video Call). Any ideas?
bsically you can go for this sample fro msdn
the voip sample
for a normal description of how to make application here's a link in silverlight
you can mapp at least some code and understanding from here ..
video call silverlight

Different large tile and medium tile in Windows Phone

I have a Windows Phone 8 supporting Live Tiles (the default medium and small). I update the Live Tile using a fairly standard code
var tile = ShellTile.ActiveTiles.First();
if (tile == null) return;
var data = new StandardTileData {Title = "some title"};
data.BackgroundImage = new Uri("/Background.png", UriKind.Relative);
data.Count = count;
tile.Update(data);
I want to add support for the Large tile but I want to to be different. I do not want to use the count and I want to render some custom text to the images:
var data = new StandardTileData {Title = "some title"};
data.BackgroundImage = new Uri("path to a custom rendered image", UriKind.Relative);
data.Count = 0;
My question is, how do I determine if my Live tile is Medium (small) or Large make the appropriate update? Or how do I set the tile update to be entirely different for Medium (small) and Large tile?
StandardTileData is the WP7 specific format for tile data. It's WP8 equivalent is
FlipTileData which includes separate properties for the different tile sizes:
FlipTileData TileData = new FlipTileData()
{
Title = "[title]",
BackTitle = "[back of Tile title]",
BackContent = "[back of medium Tile size content]",
WideBackContent = "[back of wide Tile size content]",
Count = [count],
SmallBackgroundImage = [small Tile size URI],
BackgroundImage = [front of medium Tile size URI],
BackBackgroundImage = [back of medium Tile size URI],
WideBackgroundImage = [front of wide Tile size URI],
WideBackBackgroundImage = [back of wide Tile size URI],
};
See also the WP8 specific docs for tiles. http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx

Live tile sometimes doesn't show local generated image, but does when its re-pinned?

I'm having a strange problem. I generate my live tile images in the BackgroundTask based on weather information. Sometimes I see that the image is being generated, but the tile only shows its background color and not the image (for instance, the tile is green or red and it shows only the title).
When I then remove the live tile, and re-pin it to the start screen the image does show. Or, on Windows Phone 8, when I change the size (Small => Medium => Wide) the live tile shows the image just fine. It sometimes happens on the Background image, and on the BackBackground image. Even re-starting the phone or open the app seems to help (but not 100% on this).
This seems like a small bug in the Windows Phone OS. What could be the problem?
This is my code:
using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream imageStream = new IsolatedStorageFileStream("/Shared/ShellContent/Image.jpg", System.IO.FileMode.Create, ISF))
{
writeableTileFinal.SaveJpeg(imageStream, writeableTileFinal.PixelWidth, writeableTileFinal.PixelHeight, 0, 100);
}
}
ShellTile appTile = ShellTile.ActiveTiles.First();
if (appTile != null)
{
StandardTileData tileData = new StandardTileData()
{
Title = "Title",
BackContent = string.Empty,
BackTitle = string.Empty,
BackgroundImage = new Uri("isostore:/Shared/ShellContent/Image.jpg", UriKind.Absolute),
};
appTile.Update(tileData);
}
UPDATE:
I seem to have fixed it (it didn't happen afterwards) by using Thread.Sleep just before the tile updates itself.:
Thread.Sleep(2000);
appTile.Update(tileData);
It works, but does someone knows what could have been the problem?

Categories

Resources