Adobe Air - Application updater - air

Is it possible to skip the Adobe Air application updater check for updates window to start the search for updates directly?
This is my code that launches the check for updates window:
applicationUpdaterUI.addEventListener(UpdateEvent.INITIALIZED, applicationUpdaterUI_INITIALIZED);
applicationUpdaterUI.initialize();
function applicationUpdaterUI_INITIALIZED(event:UpdateEvent):void {
applicationUpdaterUI.checkNow();
}
Thanks. Uli

Add before initialization:
applicationUpdaterUI.isCheckForUpdateVisible = false; // We won't ask permission to check for an update

Related

Changing language in UWP doesn't change system features language - only on app restart

I have a UWP application.
And i have a need to change locale on the fly, so i have this for language changing:
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = language.FourDigitCode;
ResourceContext.GetForViewIndependentUse().Reset();
ResourceContext.GetForCurrentView();
But there is a problem that system features language doesn't switch ( only after application relaunch ) how can i fix it?
Here is an example:
Now i run this code:
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "lv-LV";
ResourceContext.GetForViewIndependentUse().Reset();
ResourceContext.GetForCurrentView();
The UI gets localized, but system features still remain unlocalized:
But when i restart the app, all is OK:
Any ideas how can i fix it?
I'm afraid there is no fix for this and what you've seen is by design. Ref Remarks of PrimaryLanguageOverride property:
When you set the PrimaryLanguageOverride, this is immediately reflected in the Languages property. However, this change may not take effect immediately on resources loaded in the app UI. To make sure the app responds to such changes, you can listen to the QualifierValues property on a default resource context and take whatever actions may be needed to reload resources. Those requirements may vary depending on the UI framework used by the app, and it may be necessary to restart the app.
For your scenario, a restart is needed. I'd suggest that you can add a tip to tell users to restart the app and also a button to close the app like what used in News App.
And to close the app, we can call Application.Exit method like the following.
Application.Current.Exit();
Maybe page reloading can fix it? Try to re-navigate to the same page.
Found the example below here.
//like this
private bool Reload(object param = null)
{
var type = Frame.CurrentSourcePageType;
Frame.Navigate(type, param);
Frame.BackStack.Remove(Frame.BackStack.Last());
}
// or like this
private bool Reload(object param = null)
{
var frame = Window.Current.Content as Frame;
frame.Navigate(frame.CurrentSourcePageType, param);
frame.BackStack.Remove(frame .BackStack.Last());
}

Windows Phone ThemeManager

is it possible to for example - write a background service, which randomly changes the windows phone theme, I mean is it possible to access the windows phone theme under settings via code? and change it?
if so can you please give me an example of the API's I can use or additional libraries I can dl
thank you
Unfortunately you can't. It is not possible to change the Windows Phone theme by code. The only one who can is the user. This is part of the Windows Phone concept.
The only thing you can do is defining themes that are used in your own apps.
Sorry for the bad news...
You are allowed to change the theme for your application. There is a Nuget package available that makes this even easier. You could accomplish changing it in a background task by setting a property that you check when the app opens.
// background agent code
// get random value
IsolatedStorageSettings.ApplicationSettings["Theme"] = randomValue; // this is just a string or something simple
IsolatedStorageSettings.ApplicationSettings.Save();
When your app opens, you would check this value
var theme = "Standard";
if(IsolatedStorageSettings.ApplicationSettings.ContainsValue("Theme"))
{
theme = IsolatedStorageSettings.ApplicationSettings["Theme"];
// Set the theme
}
You can modify the source of the Theme Manager by downloading the source from github. Here is some more info on the Theme Manager. If you would like to change values yourself, you can accomplish this by setting the resource values when the papp starts
((SolidColorBrush)Resources["PhoneAccentBrush"]).Color = myAccentBrush;
((SolidColorBrush)Resources["PhoneBackgroundBrush"]).Color = myBackgroundBrush;
((SolidColorBrush)Resources["PhoneChromeBrush"]).Color = myChromeBrush;
((SolidColorBrush)Resources["PhoneForegroundBrush"]).Color = myForegroundBrush;

Fiddler Reissue and Edit and Reissue from composer

I'm using Fiddler on daily life. However, the most used feature for me, such as Reissue and Edit and Reissue from composer don't have any shortcuts. I don't know how to use fiddler script for this. Can anybody point a solution for this?
Hit CTRL+R to open the FiddlerScript editor.
Inside the OnBoot() function add the following code:
FiddlerApplication.UI.lvSessions.add_KeyDown(HandleAKey);
Immediately after the closing brace for the OnBoot function, add the following code:
static function HandleAKey(Sender, theKey:KeyEventArgs) {
if (theKey.KeyData == Keys.E)
{
var oS: Session = FiddlerApplication.UI.GetFirstSelectedSession();
if (null == oS) return;
theKey.Handled = theKey.SuppressKeyPress = true;
FiddlerApplication.DoComposeByCloning(oS);
}
}
Save the file. Restart Fiddler. Now, when you press the E key on any selected session in the Web Sessions list, that session will be cloned to the composer to resend.
Currently, the FiddlerApplication.UI.actReissueSelected() function is not public, which means that there's no simple way to invoke that functionality without calling FiddlerApplication.oProxy.SendRequest() directly.

AIR application Mouse.hide() not working

I created a fullscreen app with the following to hide the mouse...
// need this hack to hide the mouse for AIR for some reason...for OSX
// http://blog.formatlos.de/2008/11/16/air-hiding-the-mouse/
stage.nativeWindow.activate();
stage.nativeWindow.orderToBack();
stage.nativeWindow.orderToFront();
Mouse.hide();
This works on my machine at home running OSX Lion...but when this is installed on the client's machine (also running OSX...I need to find out the version), the mouse does not hide?
When I take out the 3 line hack before the Mouse.hide(), the mouse does not hide on my machine. Will test this out on the client's machine too.
Anyone experience this before?
Are you including flash.ui.Mouse in your code?
import flash.ui.Mouse;
Take a look in this site: http://samhassan.co.uk/2008/10/08/air-10-mousehide-work-around/
You could try to hide mouse cursor when the first enterFrame event is fired. Some elements are not fully available till the first frame is build:
// i.e. on main app initilize event handler
addEventListener(Event.ENTER_FRAME, onEnterFrame);
private function onEnterFrame(event:Event):void {
Mouse.hide();
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
This way, you have not to rely on hacks or workarounds.

Toast Notification not working

Below method executes on call for set Toast, but doesnot display any Toast after time elasped.
Is any more setting required for Windows 8 Metro app Toast notification
int scheduledToastCounter = 1;
public void Set_Future_Toast()
{
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);
XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
stringElements.Item(0).AppendChild(toastXml.CreateTextNode("Scheduled Toast"));
DateTimeOffset displayTime = DateTimeOffset.UtcNow.AddSeconds(3);
ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, displayTime);
scheduledToast.Id = "Future_" + this.scheduledToastCounter++;
ToastNotifier notifier = ToastNotificationManager.CreateToastNotifier();
notifier.AddToSchedule(scheduledToast);
int scheduledToastCount = notifier.GetScheduledToastNotifications().Count;
}
}
You should set toast capable to yes in app package.
Be sure that you checked the box in the App's config file to enable Notifications.
The property settings of your object notifier told you why the toast can't be displayed:
0: Enabled, All notifications raised by this app can be displayed.
1: DisabledForApplication, The user has disabled notifications for this app.
2: DisabledForUser, The user or administrator has disabled all notifications for this user on this computer.
3: DisabledByGroupPolicy, An administrator has disabled all notifications on this computer through group policy. The group policy setting overrides the user's setting.
4: DisabledByManifest, This app has not declared itself toast capable in its package.appxmanifest file. This setting is found on the manifest's Application UI page, under the Notification section. For an app to send toast, the Toast Capable option must be set to "Yes".
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.notificationsetting.aspx
You can change directly your Package.appxmanifest from code page :
add ToastCapable to the VisualElements Tag
<VisualElements ToastCapable="true">
Some times the screen of the Package.appxmanifest dosen't have the option to change it:
Need set small icon for notifications!!!
Have you tried to make the application Toast Capable? check this thread: Toast notification isn't working?
An interesting issue I ran into is I was using toast with images. I had the images in a dependent assembly with copy to output directory. Scheduling toast just failed silently. Ondemand toast failed with an HRESULT of E_FAIL (no other information). When I finally copied the images into the main project (with copy to output directory) then they started working.