private App currentApplication;                                     //The current app being used


    /// <summary>
    /// Called by "Determine Application" - sets the current app and makes new apps if necessary
    /// </summary>
    /// <param name="appName"></param>
    public void SetApplication(string appName)
    {
        App newApp = ApplicationFromStandardList(appName);

        if (newApp == currentApplication)
        {
            return;
        }

        //deactivate previous application
        if (currentApplication != null && currentApplication.active)
        {
            currentApplication.Deactivate();
        }
        currentApplication = null;

        currentApplication = newApp;


        if (currentApplication == null)
        {
            currentApplication = ApplicationFromUsedList(appName);
        }
        if (currentApplication == null)
        {
            currentApplication = MakeNewApp(appName);
        }

        //activate new application
        currentApplication.Activate();
    }
Ejemplo n.º 2
0
        internal static App UnlockHere(string[] args)
        {
            //TODO :  Check the header content and add a CRC
            App app = null;

            if (Path.GetExtension(args[1]) == ".nlk" && NLockTemplateOperations.IsNLock(args[1]) > 0)
            {
                app = new App(new MainForm(OperationModes.Unlockhere, args[1]));
                app.Activate();
                app.FocusMe();
            }
            else
            {
                MessageBox.Show(Resources.Not_a_valid_NLock_File___ + Path.GetFileName(args[1]));
            }
            return(app);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            PopupService.Init();

            AndroidEnvironment.UnhandledExceptionRaiser += HandleAndroidException;

            Forms.Init(this, bundle);

            //XXX: Must initialize the UAS first on a main thread before anything can use it
            UserAgentService.Init();
            PullToRefreshLayoutRenderer.Init();
            CachedImageRenderer.Init();
            ImageService.Instance.Initialize(new Configuration
            {
                HttpClient                   = RestService.Instance.Client,
                FadeAnimationEnabled         = false,
                FadeAnimationForCachedImages = false,
                BitmapOptimizations          = false,
                TransformPlaceholders        = false
            });

            var downloadCache = ImageService.Instance.Config.DownloadCache as DownloadCache;

            if (downloadCache != null)
            {
                downloadCache.DelayBetweenRetry = TimeSpan.FromSeconds(0);
            }
            else
            {
                Logger.Log("WARNING: Unable to cast FFImageLoading DownloadCache!");
            }


            var app = new App();

            LoadApplication(app);
            app.Activate();
            if ((int)Build.VERSION.SdkInt >= 21)
            {
                ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent)));
            }
        }