Updating Application tile using TileUpdateManager - c#

I'm developing metro app using Windows 8 release preview and C#(VS 2012),I'm using below code to update Application tile.
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
XmlDocument TileXML = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImage);
XmlNodeList imageAttribute = TileXML.GetElementsByTagName("image");
((XmlElement)imageAttribute[0]).SetAttribute("src", "ms-appx:///Assets/Tile.png");
((XmlElement)imageAttribute[0]).SetAttribute("alt", "red graphic");
TileNotification notify = new TileNotification(TileXML);
notify.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
TileUpdateManager.CreateTileUpdaterForApplication().Update(notify);
But my Application Tile is not updating, I don't know what I'm missing and where I'm doing wrong, please help me.
I got the answer, its about adding Extension file "NotificationExtensions.winmd" as my reference and also i have couple of questions
When i run above code by setting my target device as "Local
Machine" it works but when i set it to "Simulator" it doesn't, Can
any one explains me please why.
We have expiration time for tiles by using below line
notify.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
what i have to do if want the live tile to be running continuously,
Please let me know if have any links or study material
Thanks in advance.

Thank you Guys,i got the answer, my image size is <200KB and < 1024x1024, mistake i did is i haven't added extension file "NotificationExtensions.winmd" as my reference. i did that and i got it.

Related

C# MagnetLink to torrent file

I am going crazy right now. Since all other questions are several years old and the MonoTorrent developers have gone MIA I really need your help.
What I am really stuck with is parsing the magnet link and downloading it.
This is my code:
public static void DownloadTorrent(string magnetLink)
{
MagnetLink link = new MagnetLink(magnetLink);
//URL stores the magnetlink
EngineSettings settings = new EngineSettings();
settings.AllowedEncryption = EncryptionTypes.All;
settings.SavePath = destination;
string torrentFilePath = torrentDestination;
if (!Directory.Exists(settings.SavePath))
Directory.CreateDirectory(settings.SavePath);
if (!Directory.Exists(torrentFilePath))
Directory.CreateDirectory(torrentFilePath);
//Create a new engine, give it some settings and use it.
ClientEngine engine = new ClientEngine(settings);
engine.ChangeListenEndpoint(new IPEndPoint(IPAddress.Any, 6969));
TorrentManager manager = new TorrentManager(link, engine.Settings.SavePath, new TorrentSettings(), torrentFilePath);
engine.Register(manager);
manager.Start();
Console.ReadLine();
}
And my magnet link is: "magnet:?xt=urn:btih:c6df2f47d033d54b054cafe7ef683ba167222d92&dn=Windows+XP+Professional+SP3+-+Activated&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969"
Now an error throws on the magnet link saying "No such host is known and referring to udp://exodus.desync.com:6969/"(Visual Studio is on swedish so that might not be a literal translation).
Visual Studio is marking tracker = new UdpClient(announceUrl.Host, announceUrl.Port); as the error source and it's located inside one of MonoTorrent's code files; UdpTracker.cs
I am trying to make a simple application and I am just stuck on this part.
Any help is greatly appreciated. It's one of my first times posting here so if I missed to mention anything just tell me and I will add it.
Thanks on forehand! Also pardon my english, I am not a native speaker.
Update: If you know another way of solving this even without MonoTorrnet - I will take any help I can.

Issues loading different shapefiles in given sharpmap tutorial code

I am currently working on sharpmap project with the need to work on offline maps. As i am fresher in this field,I am following the sharpmap tutorial and facing a problem with loading new shape files in the given tutorial code.
For Example :\
SharpMap.Layers.VectorLayer("States");
vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("path_to_data\\states_ugl.shp", true);
At this line of code, if i pass a different shapefile, code builds with a blank background or no display.
I have tried with different shape files with different sizes but the result is the same. It only works for the mentioned states_ugl.shp file given in the code. Please need help regarding this issue as I am a fresher in this field.
Thanks.
Try giving layer styling for your layer, something like below.
layer.DataSource = DBlayer;
layer.Style.Fill = new SolidBrush(Color.Transparent);
layer.Style.Outline = new Pen(Color.Black);
layer.Style.EnableOutline = true;
layer.MaxVisible = 13000;

Show DevExpress waitform dialog without designer

I'm trying to display a Loading Please Wait dialog form using devex controls and I can't seem to do it. (using winforms, c#)
I'm using an older version of devex - not the latest. I can't do
SplashScreenManager.ShowDefaultWaitForm()
I need to do this in code without the designer.
1.
I tried:
SplashScreenManager.ShowForm(typeof(WaitDialogForm));
It looks right when it loads, but then it throws an error:
Unable to cast object of type 'DevExpress.Utils.WaitDialogForm' to type 'DevExpress.XtraSplashForm.SplashFormBase'
I tried:
SplashScreenManager.ShowForm(typeof(WaitForm));
This shows an empty form thats too big with no image and no text
I tried:
WaitDialogForm mWaitDialog = new WaitDialogForm() {Visible = false};
mWaitDialog.Show();
The wait form doesn't look right. There are white spaces instead of the image.
I tried:
WaitDialogForm mWaitDialog = new WaitDialogForm() {Visible = false};
mWaitDialog.ShowDialog();
The code doesn't continue executing.
I saw examples of
SplashScreenManager.ShowForm(typeof(WaitForm1));
I don't know how to do this without designer.
Can somebody please assist? I thought I'm doing something simple, but I can't seem to figure it out!
Probably this help u ;)
using (new DevExpress.Utils.WaitDialogForm("Please wait"))
{
//Do your stuff here
}
I don't know if this is in your 13.2 version but from looking at documentation you should be using ShowWaitForm instead of just ShowForm.
SplashScreenManager ssm = new SplashScreenManager();
ssm.ActiveSplashFormTypeInfo = typeof(WaitForm1);
ssm.ShowWaitForm();
If that does not work then i would just try preparing a working solution in the designer and then extracting the code from the designer.cs file.
Found a specific documentation example here

why CSCore equalizer SampleFilters[9] (16Khz) does not affect at all in C#

I recently found that if I want to add equalizer to my application I can use CSCore library! I tested it and it's good! but the problem is that 16Khz equalizer Band (Treble) does not have any effect at all!!
What's wrong what should I do?
I even tried real high numbers! but no effects. :(
_equalizer.SampleFilters[9].AverageGainDB = 35.5;
Other channels works well (0-8).
I found what's wrong! I've got the solution :)
the problem was from the Equalizer Sample Source Code I've downloaded from CScore Codeplex Page
var source = CodecFactory.Instance.GetCodec(ofn.FileName)
.Loop()
.ChangeSampleRate(32000)
.AppendSource(Equalizer.Create10BandEqualizer, out _equalizer)
.ToWaveSource();
I commented the ".ChangeSampleRate" Part and it has been solved!
I changed it to:
source = CodecFactory.Instance.GetCodec(ofn.FileName)
.Loop()
.ChangeSampleRate(44100)
.AppendSource(Equalizer.Create10BandEqualizer, out _equalizer)
.ToWaveSource();

Play .oni-File on loop in C# / WPF

I'd like to play a previously recordet *.oni-File in C#/WPF. While, with the help of this tutorial I was able to get to RGB- and Depth-Stream to show up on my UI, I don't know how to play an *.oni-file.
The OpenNI page mentions, that I'd just have to "connect" to the file instead of the device, but I can't find the proper piece of code to do so.
The openni::Device class provides an interface to a single physical hardware device (via a driver). It can also provide an interface to a simulated hardware device via a recorded ONI file taken from a physical device.
If connecting to an ONI file instead of a physical device, it is only required that the ONI recording be available on the system running the application, and that the application have read access to this file.
I also found some clues / discussions, but none of it did help much
C# problem with .oni player
OpenNI-dev: Not able to play the skeletonRec.oni
EDIT: I found a way to at least get the recording played using the SamplesConfig.xml. I just inserted the following code into the <ProductionNodes>:
<Recording file="\test.oni" playbackSpeed="1.0"/>
Sadly, that recording crashes to program when it's done playing - I'm now looking for a way to loop the recording...
EDIT 2: Just if anybody should be interested, I'm using those lines to set the recording on loop:
ScriptNode scriptNode;
context = Context.CreateFromXmlFile(path + "\\" + configuration, out scriptNode);
Player p = (Player)context.FindExistingNode(NodeType.Player);
if (p!=null) p.SetRepeat(true); //Make sure it's really a recording.
If anybody should need the code one day - I managed to load the file and play the recording without the need of a config file:
Context context = new Context();
// Add license
License license = new License();
license.Vendor = "vendor";
license.Key = "key";
context.AddLicense(license);
// Open file
context.OpenFileRecordingEx("record.oni");
// Set to repeat
Player p = (Player)context.FindExistingNode(NodeType.Player);
if (p != null) p.SetRepeat(true);

Categories

Resources