Display more than 5 messages in TileUpdater - c#

I use in my application ScheduledTileNotifications and push 10 until 20 messages in the TileUpdateManager. But on the metro there are only 5 messages active. What can I do to display more than 5 notifications in the metro-Tile?
string tileXmlString = "<tile>"
+ "<visual>"
+ "<binding template='TileWideSmallImageAndText03' branding='name'>"
+ "<image id='1' src='ms-appx:///Assets/icons/cube_for_kachel.png'/>"
+ "<text id='1'>" + longSubject + "\n" + message.title + "</text>"
+ "</binding>"
+ "<binding template='TileSquareText04' branding='name'>"
+ "<text id='1'>" + shortSubject + "\n" + message.title + "</text>"
+ "</binding>"
+ "</visual>"
+ "</tile>";
XmlDocument tileXml = new XmlDocument();
tileXml.LoadXml(tileXmlString);
ScheduledTileNotification sceduleNotification = new ScheduledTileNotification(tileXml, DateTime.Now.AddSeconds(15));
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(sceduleNotification);
When I set the EnableNotificationQueue to true, five of my notification run in a circle. When I set it to false, my notification donĀ“t run in a circle. But I have 10 until 20 Notifications, which should run in a circle. Do you think it is possible.
When I use the AddToSchedule method an push 10 Notifications, each notification will show for one time.

The problem is related to the use of the EnableNotificationQueue method. In fact, as you can read at http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.enablenotificationqueue:
When queuing is enabled, a maximum of five tile notifications can
automatically cycle on the tile.
Try to pass false to this method.
According to the documentation, you can schedule up to 4096 notifications. Reref to http://hansstan.wordpress.com/2012/09/02/windows-8-advanced-tile-badge-topics/ for a working example.

Related

C# Windows 10 Toast Notifications

I'm trying to display a toast notification after a timer run out of time.
The notification works on one of my PC's but the other one won't display it. I get no error when I'm debugging it.
I also tried to set something in the Settings>Notifications but in the list of apps which are allowed/not allowed to display notifications I can't see my application.
This is my Notifications Class:
class NewToastNotification
{
public NewToastNotification(string text)
{
string Toast = String.Format("<toast>"+
"<visual>+" +
"<binding template=\"ToastImageAndText04\">" +
"<text id = \"1\" >Toast Test </text>+" +
"<text id = \"2\" >{0}</text>+" +
"<text id = \"2\" >{1}</text>+" +
"</binding>+" +
"</visual>+" +
"</toast>", text, DateTime.Now);
var tileXml = new Windows.Data.Xml.Dom.XmlDocument();
tileXml.LoadXml(Toast);
var toast = new ToastNotification(tileXml);
ToastNotificationManager.CreateToastNotifier("1").Show(toast);
}
}
Use
ToastNotificationManager.CreateToastNotifier().Show(toast);
instead of
ToastNotificationManager.CreateToastNotifier("1").Show(toast);

How to show multiple images on a secondary tile in windows 10 uwp?

I'm trying to create a secondary tile, which shows pictures in rotation like in the photos app. I have tried something like this:
SecondaryTile tile = GenerateSecondaryTile("NewTile", "SecondaryTile");
await tile.RequestCreateAsync();
var ImageUrl = selectedFileList.ElementAt(0).Path;
string tileXmlString =
"<tile>"
+ "<visual>"
+ "<binding template='TileSmall'>"
+ "<image src='" + selectedFileList.ElementAt(0).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(1).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(2).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(3).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(4).Path + "' alt='image'/>"
+ "</binding>"
+ "</visual>"
+ "</tile>";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(tileXmlString);
TileNotification notifyTile = new TileNotification(xmlDoc);
TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(notifyTile);
I have tried setting the type as both background and peek but it doesn't give the required result. And also I would not like to use a background task as my app already uses one and I wouldn't want to increase the overhead which might cause the task to fail entirely. I wouldn't mind if the images were limited to 5 like earlier in Windows phone 8.1.
For reference : check this out : Skip to 0:30
This is for Primary Tile, but it should work the same way. Make your own XML Template, then reference your image. Enable notification queue then update the Tile with the TileNotification. Do this up to five times to put five images on the Live Tile stack.
var myStorageFile = await Package.Current.InstalledLocation.GetFileAsync("LiveTileTemplate.xml");
string liveTileTemplate = await FileIO.ReadTextAsync(myStorageFile);
liveTileTemplate = liveTileTemplate.Replace("squareImageSource", FilePathFullPrefix + GetFilePathSquareTile(imageID));
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(mergedXML));

Sending CTCP action to an IRC server using C#

I have encountered a problem that others seem to have also encountered, but their solutions don't seem to work for me:
Using \x01 send the message as "ACTION wave" with nothing else.
The solutions I've found but haven't worked are:
Using \001: message is interpret as "01ACTION waves" but I get a "No
text to send" error.
Using \0001: same issue. Using \u0001: only
sends "ACTION waves" but prints an unknown symbol before action.
Apparently the issue is the '\0' part where it interprets it as an escape character, is there a way to avoid this? I have tried the following three methods already:
writer.WriteLine("PRIVMSG " + CHANNEL + " :" + CONTROL + "ACTION " +
message.Remove(0, 3) + CONTROL);
writer.WriteLine("PRIVMSG " + CHANNEL + " :" + "\u0001" + "ACTION " +
message.Remove(0, 3) + "\u0001");
writer.Write(string.Format("PRIVMSG {0} :{1} ACTION {2}{1}", CHANNEL,
CONTROL, message.Remove(0,3)));
Where CONTROL = either one of the values before mentioned.
A better more simple way will be using hex character \x01.
Code:
writer.WriteLine("PRIVMSG {0} :{1}ACTION {2}{1}", CHANNEL, '\x01', message.Remove(0, 3))

Toast notifications do not work in windows 8 app

I have some toast notifications with alarm scenario. I used the following toast schema, but when notification is raised, there are no buttons(snooze or dismiss).
Here is my xml content. So why cant i use this toast commands?
var contentString = "<toast duration=\"long\">\n" +
"<visual>\n" +
"<binding template=\"ToastText02\">\n" +
"<text id=\"1\">" + alarmTitle + "</text>\n" +
"<text id=\"2\">" + alarmNote + "</text>\n" +
"</binding>\n" +
"</visual>\n" +
"<commands scenario=\"alarm\">\n" +
"<command id=\"snooze\"/>\n" +
"<command id=\"dismiss\"/>\n" +
"</commands>\n" +
"<audio src=\"ms-winsoundevent:Notification.Looping.Alarm2\"\n" +
"loop=\"true\"/>\n" +
"</toast>\n";
As is normal, Windows Phone 8 RT does not have the all features of Windows Store Apps.
There is a link on the MSDN that says what is not available on WinRT apps.
One of the entries is Alarms and reminders, so sadly you will not be able to use alarms on WP8.1.

C# / Webservice app on server throwing strange exception

We use ADP for employee information. I had to create a small app that called some web services that ADP has to pull employee information. The app is fairly procedural..not really object orientated in a sense. Basically I go through some web services to pull general information, work information, employee status, etc.
I have most of this data writing out to a text file as a log so I can ensure that everything is working correctly. Finally got it all done, and it works perfect on my local machine. Thought I'd just copy the entire structure onto a server and use windows scheduler to schedule the exe to run nightly (once a day). When it tries to run the app it looks like it is dying when it calls the first web service. The task scheduler log says:
""ADP.job" (ADP.exe)
Started 2/11/2010 2:14:34 PM
"ADP.job" (ADP.exe)
Finished 2/11/2010 2:14:38 PM
Result: The task completed with an exit code of (e0434f4d)."
So I checked the event viewer and it says this:
EventType clr20r3, P1 adp.exe, P2 1.0.0.0, P3 4b745bb9, P4 adp, P5 1.0.0.0, P6 4b745bb9, P7 289, P8 2d, P9 system.io.filenotfoundexception, P10 NIL.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
I put in some console.writelines to see where it is failing...
Here is a simple example of main:
static void Main(string[] args)
{
OpenTextFile();
Console.WriteLine("About to process employee work information...");
tw.WriteLine("About to process employee work information...");
//work info service
EmpWorkInfo();
}
And inside of opentextfile:
public static void OpenTextFile()
{
//used to log data
String sLogName;
Console.WriteLine("Inside of opentextfile");
if (Directory.Exists(logPath))
{
//directory exists
}
else
{
Directory.CreateDirectory(logPath);
}
Console.WriteLine("Inside of opentextfile2");
sLogName = "log_" + DateTime.Today.ToString("MM_dd_yyyy") + ".txt";
tw = new StreamWriter(logPath + sLogName);
}
I see all the console.writelines on the server but as soon as it hits this line from main:
EmpWorkInfo();
Thats when all hell breaks lose (basically it doesn't work). The EmpWorkInfo() is simply a function to get work related information from a web service (as I said this works locally).
static void EmpWorkInfo()
{
Console.Writeline("THIS NEVER PRINTS!!!");
SQLClass s=null;
// Create the web service proxy client.
GetEmployeeWorkInfoService oService = new GetEmployeeWorkInfoService();
oService.Timeout = Int32.MaxValue;
// Serialize the UsernameToken into XML.
// Create the UsernameToken as defined in the WS-I secure profile.
UsernameToken oUsernameToken = new UsernameToken(USERNAME, SECRET);
System.Xml.XmlElement oSecurityHeaderXml =
oUsernameToken.GetXml(new System.Xml.XmlDocument());
ADP.GetEmployeeWorkInfoWebService.SecurityHeaderType oSecurityHeader = new ADP.GetEmployeeWorkInfoWebService.SecurityHeaderType();
oSecurityHeader.Any = new System.Xml.XmlElement[] { oSecurityHeaderXml };
oService.Security = oSecurityHeader;
GetEmployeeWorkInfoRequestFilter oFilter = new GetEmployeeWorkInfoRequestFilter();
//filter by thyssenkrupp company
oFilter.Companies = new String[] { COMPANY_IDENTIFIER };
GetEmployeeWorkInfoRequest oRequest = new GetEmployeeWorkInfoRequest();
oRequest.Filter = oFilter;
try
{
EmployeeWorkInfoType[] arPersonalInfo = oService.GetEmployeeWorkInfo(oRequest);
try
{
s = new SQLClass();
}
catch (Exception e)
{
throw new System.Exception(e.Message.ToString());
}
for (int i = 0; i < arPersonalInfo.Length; i++)
{
String stID = arPersonalInfo[i].EmployeeKey.Identifier.EmployeeId; //employee number
String stEmailAddress = arPersonalInfo[i].WorkInfo.EmailAddress; //employee email address (work)
String stFax = arPersonalInfo[i].WorkInfo.Fax; //employee fax number
DateTime dtHireDate = arPersonalInfo[i].WorkInfo.OriginalHireDate;
String stPhone = arPersonalInfo[i].WorkInfo.Phone; //employee phone number
String stWireless = arPersonalInfo[i].WorkInfo.Wireless; //employee wireless number
tw.WriteLine("Processing ID:" + stID + " Email Work: " + stEmailAddress + " Fax Work: " + stFax + " Hire Date: " + dtHireDate + " Phone Work: " + stPhone + " Wireless Work: " + stWireless + ".");
Console.WriteLine("Processing ID:" + stID + " Email Work: " + stEmailAddress + " Fax Work: " + stFax + " Hire Date: " + dtHireDate + " Phone Work: " + stPhone + " Wireless Work: " + stWireless + ".");
s.SetSQLCommand("dbo.ADP_uiEmployeeWorkInfo");
s.AddSQLCmdParameter("#EmployeeNumber", System.Data.SqlDbType.VarChar, stID);
s.AddSQLCmdParameter("#EmailAddress", System.Data.SqlDbType.VarChar, stEmailAddress);
s.AddSQLCmdParameter("#Fax", System.Data.SqlDbType.VarChar, stFax);
s.AddSQLCmdParameter("#HireDate", System.Data.SqlDbType.DateTime, dtHireDate);
s.AddSQLCmdParameter("#Telephone", System.Data.SqlDbType.VarChar, stPhone);
s.AddSQLCmdParameter("#Mobile", System.Data.SqlDbType.VarChar, stWireless);
s.SQLExecuteNonQuery();
Console.WriteLine("Processed ID:" + stID + " Email Work: " + stEmailAddress + " Fax Work: " + stFax + " Hire Date: " + dtHireDate + " Phone Work: " + stPhone + " Wireless Work: " + stWireless + ".");
Console.WriteLine(Environment.NewLine);
}
s.CloseSQLDB();
s.Dispose();
}
//catch any exception from adp side.
catch (Exception e)
{
throw new System.Exception(e.Message.ToString());
}
}
This functions code is irrelevant (its ugly but do not let that bother you, the code works...). My issue is I cannot even get to the first console.writeline of that function. Is there anything special I need to do when it comes to working with webservices?
Edit
Logpath is defined as simply a static string outside of main:
private static string logPath = Environment.CurrentDirectory + "\\log\\";
I suspect that your application is not able to load the types referenced in that function - EmpWorkInfo.
1) Can you run this application on the target server in a commannd window (cmd.exe) ?
2) Are you using any assemblies from ADP that are installed in the global assembly cache (GAC)? Run "gacutil -l" on your localmachine to see if you are using any assemblies from ADP that are installed in thr gac. If they are, you will need to install these into the machine on which you are running the app.
Does logPath have a trailing backslash? Either way, you ought to use Path.Combine, rather than the string catenation operator (+).
What happens if you comment out all the code in EmpWorkInfo() apart from the first Console.Writeline? Does it still not get written out?
Found out I need the Microsoft.Web.Services3 dll installed on the server.
Continuation on "feroze" answer;
If you want to figure out if the 'loading of dependencies' is causing you grief here, i suggest using the "FUSLOGVW.EXE" tool *(part of .Net). When you run this it will give you a little dialog window with a few options. Create a directory somewhere (like "c:\temp\fusion_logs"), set the mode of FUSLOGVW to "log bind failures only", "custom location->c:\temp\fusion_logs".
Now restart your application and check that it failed. Now look into your fusion_logs directory. This should give you sub directories with different (maybe only 1 for now) application names. Inside each directory you will find the log files. These log files contain the "failed assembly loads" and who (which calling assembly) caused them.
They might help your hunt for a working application,
Hope this helps,
Edit: Posted this after you found the cause. The fuslogvw.exe would have shown you the missing assembly.

Categories

Resources