Example #1
0
        //***********************************************************************************************************************

        //***********************************************************************************************************************
        /// <summary>
        /// Extrait les informations de la page Web.
        /// </summary>
        /// <param name="Sender">Source de l'appel.</param>
        /// <param name="Args">Données de l'appel Web.</param>
        //-----------------------------------------------------------------------------------------------------------------------
        private static void MarketPlaceAppContentCompleted(object Sender, DownloadStringCompletedEventArgs Args)
        {
            //-------------------------------------------------------------------------------------------------------------------
            ApplicationInfosEventArgs Result = null;
            //-------------------------------------------------------------------------------------------------------------------

            //-------------------------------------------------------------------------------------------------------------------
            AsyncState State = Args.UserState as AsyncState;

            //-------------------------------------------------------------------------------------------------------------------

            //-------------------------------------------------------------------------------------------------------------------
            try
            {
                //---------------------------------------------------------------------------------------------------------------
                if (!string.IsNullOrEmpty(Args.Result))
                {
                    //-----------------------------------------------------------------------------------------------------------
                    Result = new ApplicationInfosEventArgs(XElement.Parse(FixContent(Args.Result)), State.CultureInfo);
                    //-----------------------------------------------------------------------------------------------------------

                    //-----------------------------------------------------------------------------------------------------------
                    if (!Result.IsEmpty)
                    {
                        StorageSettings.SetValue("last-check-update", DateTime.Now.ToString("yyyy-MM-dd"));
                    }
                    //-----------------------------------------------------------------------------------------------------------
                }
                //---------------------------------------------------------------------------------------------------------------
            }
            //-------------------------------------------------------------------------------------------------------------------
            catch {}
            //-------------------------------------------------------------------------------------------------------------------
            finally
            {
                //---------------------------------------------------------------------------------------------------------------
                var Callback = State.Callback;

                if (State.Callback != null)
                {
                    //-----------------------------------------------------------------------------------------------------------
                    if (Result == null)
                    {
                        Result = new ApplicationInfosEventArgs(State.AppGuid);
                    }

                    Callback(null, Result);
                    //-----------------------------------------------------------------------------------------------------------
                }
                //---------------------------------------------------------------------------------------------------------------
            }
            //-------------------------------------------------------------------------------------------------------------------
        }
Example #2
0
        //-----------------------------------------------------------------------------------------------------------------------

        //***********************************************************************************************************************
        #region         // Section des Procédures Constructeurs
        //-----------------------------------------------------------------------------------------------------------------------

        //***********************************************************************************************************************
        /// <summary>
        /// Initialise une nouvelle instance de l'objet <b>Instance</b>.
        /// </summary>
        //-----------------------------------------------------------------------------------------------------------------------
        public Instance()
        {
            //-------------------------------------------------------------------------------------------------------------------
            this.UnhandledException += this.OnUnhandledException;

            this.InitializeComponent();
            this.InitializePhoneApplication();
            //-------------------------------------------------------------------------------------------------------------------

            //-------------------------------------------------------------------------------------------------------------------
            // Mise à jour ?
            //-------------------------------------------------------------------------------------------------------------------
            string Version = StorageSettings.GetValue("version", string.Empty);

            if (!Version.Equals(VersionUtils.Current.ToString()))
            {
                //---------------------------------------------------------------------------------------------------------------
                System.IO.AppWebCache.Clear();

                StorageSettings.SetValue("version", VersionUtils.Current.ToString());
                StorageSettings.SetValue("panel-mode", (int)PanelMode.Popup);
                //---------------------------------------------------------------------------------------------------------------
            }
            //-------------------------------------------------------------------------------------------------------------------

            //-------------------------------------------------------------------------------------------------------------------
            // Gestion de l'Agent
            //-------------------------------------------------------------------------------------------------------------------
            Instance.CheckScheduledAgentStatus();
            //-------------------------------------------------------------------------------------------------------------------

            //-------------------------------------------------------------------------------------------------------------------
            if (Debugger.IsAttached)
            {
                //---------------------------------------------------------------------------------------------------------------
                Application.Current.Host.Settings.EnableFrameRateCounter = false;
                //---------------------------------------------------------------------------------------------------------------

                //---------------------------------------------------------------------------------------------------------------
                PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Enabled;
                PhoneApplicationService.Current.UserIdleDetectionMode        = IdleDetectionMode.Enabled;
                //---------------------------------------------------------------------------------------------------------------
            }
            //-------------------------------------------------------------------------------------------------------------------
        }