Exemplo n.º 1
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);

            var version = nameHelper.Version;
            var full    = nameHelper.FullName;
            var name    = nameHelper.Name;

            ApplicationUsageHelper.Init(version.ToString());

            RadRateApplicationReminder radRateApplicationReminder = new RadRateApplicationReminder();

            radRateApplicationReminder.AllowUsersToSkipFurtherReminders = true;
            //radRateApplicationReminder.AreFurtherRemindersSkipped = false;
            radRateApplicationReminder.RecurrencePerUsageCount = 5;
            radRateApplicationReminder.Notify();

            RadTrialApplicationReminder applicationReminder = new RadTrialApplicationReminder();

            //applicationReminder.SimulateTrialForTests = true;
            //applicationReminder.OccurrencePeriod = new TimeSpan(15, 0, 0, 0);
            //applicationReminder.AllowedTrialPeriod = new TimeSpan(30, 0, 0, 0);
            //applicationReminder.OccurrencePeriod = new TimeSpan(0, 0, 5, 0);
            //applicationReminder.AllowedTrialPeriod = new TimeSpan(0, 0, 15, 0);
            applicationReminder.AllowedTrialUsageCount = 30;
            applicationReminder.FreeUsageCount         = 15;
            //applicationReminder.OccurrenceUsageCount = 1;
            applicationReminder.Notify();
        }
Exemplo n.º 2
0
        private static void InitializeTrialReminder()
        {
            _trialReminder = new RadTrialApplicationReminder
            {
                AllowedTrialPeriod               = TimeSpan.FromDays(30),
                AreFurtherRemindersSkipped       = false,
                AllowUsersToSkipFurtherReminders = false,
                OccurrenceUsageCount             = 1,
                TrialExpiredMessageBoxInfo       = CreateTrialExpiredMessageBoxInfo()
            };

            _trialReminder.TrialReminderMessageBoxInfo = CreateTrialReminderMessageBoxInfo(_trialReminder);
        }
Exemplo n.º 3
0
        private static MessageBoxInfoModel CreateTrialReminderMessageBoxInfo(RadTrialApplicationReminder trialReminder)
        {
            var remainingTrialPeriod = trialReminder.RemainingTrialPeriod ?? TimeSpan.FromDays(0);

            return(new MessageBoxInfoModel
            {
                Buttons = MessageBoxButtons.YesNo,
                Title = "Trial Reminder",
                Content = string.Format("You are using the trial version of this application. You have " +
                                        "{0:0} day(s) left.{1}" +
                                        "We hope you are enjoying this app as much as we do. You know what " +
                                        "else we enjoy? Getting paid. You know what annoys us too? Frequent " +
                                        "trial reminders. See how much we have in common? Please consider " +
                                        "supporting new feature development for less than you probably chip " +
                                        "in when you go in on a pizza with friends, and all these trial " +
                                        "reminders will just go away as if by magic.{1}" +
                                        "Do you want to purchase this app now? If you choose Yes - you will " +
                                        "be redirected to the marketplace.",
                                        remainingTrialPeriod.TotalDays, Environment.NewLine)
            });
        }
Exemplo n.º 4
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);

            var version = nameHelper.Version;
            var full = nameHelper.FullName;
            var name = nameHelper.Name;

            ApplicationUsageHelper.Init(version.ToString());

            RadRateApplicationReminder radRateApplicationReminder = new RadRateApplicationReminder();
            radRateApplicationReminder.AllowUsersToSkipFurtherReminders = true;
            //radRateApplicationReminder.AreFurtherRemindersSkipped = false;
            radRateApplicationReminder.RecurrencePerUsageCount = 5;
            radRateApplicationReminder.Notify();

            RadTrialApplicationReminder applicationReminder = new RadTrialApplicationReminder();
            //applicationReminder.SimulateTrialForTests = true;
            //applicationReminder.OccurrencePeriod = new TimeSpan(15, 0, 0, 0);
            //applicationReminder.AllowedTrialPeriod = new TimeSpan(30, 0, 0, 0);
            //applicationReminder.OccurrencePeriod = new TimeSpan(0, 0, 5, 0);
            //applicationReminder.AllowedTrialPeriod = new TimeSpan(0, 0, 15, 0);
            applicationReminder.AllowedTrialUsageCount = 30;
            applicationReminder.FreeUsageCount = 15;
            //applicationReminder.OccurrenceUsageCount = 1;
            applicationReminder.Notify();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            MergeCustomColors();

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            TelemetryClient = new TelemetryClient();

            KernelService.Kernel = new StandardKernel();
            KernelService.Kernel.Bind <TelemetryClient>().ToConstant <TelemetryClient>(TelemetryClient);
            KernelService.Kernel.Bind <INavigationService>().To <PhoneNavigationService>().InSingletonScope();
            KernelService.Kernel.Bind <ISettingsService>().To <PhoneSettingsService>().InSingletonScope();
            KernelService.Kernel.Bind <IWebNavigationService>().To <PhoneWebNavigationService>().InSingletonScope();
            KernelService.Kernel.Bind <IBirthdaySource>().To <PhoneBirthdaySource>().InSingletonScope();
            KernelService.Kernel.Bind <MainViewModel>().To <PhoneMainViewModel>().InSingletonScope();
            KernelService.Kernel.Bind <ContactViewModel>().To <PhoneContactViewModel>();
            KernelService.Kernel.Bind <AboutViewModel>().To <PhoneAboutViewModel>();
            KernelService.Kernel.Bind <SettingsViewModel>().ToSelf();
            KernelService.Kernel.Bind <IAgentManagementService>().To <PhoneAgentManagementService>().InSingletonScope();
            KernelService.Kernel.Bind <ITileUpdateService>().To <PhoneTileUpdateService>().InSingletonScope();
            KernelService.Kernel.Bind <ILoggingService>().To <PhoneLoggingService>().InSingletonScope();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                //Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            //Creates an instance of the Diagnostics component.
            diagnostics = new RadDiagnostics();

            //Defines the default email where the diagnostics info will be send.
            diagnostics.EmailTo = "*****@*****.**";
            diagnostics.MessageBoxInfo.Title   = Shane.Church.StirlingBirthday.Strings.Resources.Diagnostics_MessageBox_Title;
            diagnostics.MessageBoxInfo.Content = Shane.Church.StirlingBirthday.Strings.Resources.Diagnostics_MessageBox_Content;
            diagnostics.IncludeScreenshot      = true;
            diagnostics.ExceptionOccurred     += diagnostics_ExceptionOccurred;

            //Initializes this instance.
            diagnostics.Init();

            //Creates an instance of the RadTrialApplicationReminder component.
            trialReminder = new RadTrialApplicationReminder();
            trialReminder.TrialReminderMessageBoxInfo.Title   = Shane.Church.StirlingBirthday.Strings.Resources.AppTrialReminder_MessageBox_Title;
            trialReminder.TrialReminderMessageBoxInfo.Content = Shane.Church.StirlingBirthday.Strings.Resources.AppTrialReminder_MessageBox_Content;
            trialReminder.TrialReminderMessageBoxInfo.SkipFurtherRemindersMessage = Shane.Church.StirlingBirthday.Strings.Resources.AppTrialReminder_MessageBox_SkipFurtherRemindersMessage;
            trialReminder.TrialExpiredMessageBoxInfo.Title   = Shane.Church.StirlingBirthday.Strings.Resources.AppTrialEnd_MessageBox_Title;
            trialReminder.TrialExpiredMessageBoxInfo.Content = Shane.Church.StirlingBirthday.Strings.Resources.AppTrialEnd_MessageBox_Content;
            trialReminder.TrialExpiredMessageBoxInfo.SkipFurtherRemindersMessage = Shane.Church.StirlingBirthday.Strings.Resources.AppTrialEnd_MessageBox_SkipFurtherRemindersMessage;

            //Sets the length of the trial period.
            trialReminder.AllowedTrialPeriod = TimeSpan.MaxValue;

#if DEBUG_TRIAL
            //The reminder is shown only if the application is in trial mode. When this property is set to true the application will simulate that it is in trial mode.
            trialReminder.SimulateTrialForTests = true;
            trialReminder.OccurrenceUsageCount  = 1;
#else
            trialReminder.FreePeriod = TimeSpan.FromDays(7);

            //Sets how often the trial reminder is displayed.
            trialReminder.OccurrencePeriod = TimeSpan.FromDays(7);
#endif

            trialReminder.AllowUsersToSkipFurtherReminders = true;

            //Creates a new instance of the RadRateApplicationReminder component.
            rateReminder = new RadRateApplicationReminder();
            rateReminder.MessageBoxInfo.Title   = Shane.Church.StirlingBirthday.Strings.Resources.RateReminder_MessageBox_Title;
            rateReminder.MessageBoxInfo.Content = Shane.Church.StirlingBirthday.Strings.Resources.RateReminder_MessageBox_Content;
            rateReminder.MessageBoxInfo.SkipFurtherRemindersMessage = Shane.Church.StirlingBirthday.Strings.Resources.RateReminder_MessageBox_SkipFurtherRemindersMessage;
            rateReminder.MessageBoxInfo.Buttons = MessageBoxButtons.YesNo;

            //Sets how often the rate reminder is displayed.
            rateReminder.RecurrencePerUsageCount          = 5;
            rateReminder.AllowUsersToSkipFurtherReminders = true;

            rateReminder.ReminderClosed += rateReminder_ReminderClosed;

            InitializeBackgroundAgent();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            ThemeManager.ToLightTheme();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
               // Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            //Creates an instance of the Diagnostics component.
            diagnostics = new RadDiagnostics();

            //Defines the default email where the diagnostics info will be send.
            diagnostics.EmailTo = "*****@*****.**";
            diagnostics.IncludeScreenshot = true;
            diagnostics.ApplicationName = "BettrDiet";
            XDocument doc = XDocument.Load("WMAppManifest.xml");
            var app = doc.Root.Element("App");
            var vers = app.Attribute("Version");
            diagnostics.ApplicationVersion = vers.Value;
            //Initializes this instance.
            diagnostics.Init();
            //Creates an instance of the RadTrialApplicationReminder component.
            trialReminder = new RadTrialApplicationReminder();

            //Sets the lenght of the trial period.
            trialReminder.AllowedTrialUsageCount = 30;

            //Sets how often the trial reminder is displayed.
            trialReminder.OccurrenceUsageCount = 2;

            //The reminder is shown only if the application is in trial mode. When this property is set to true the application will simulate that it is in trial mode.
            trialReminder.SimulateTrialForTests = true;

              //Creates a new instance of the RadRateApplicationReminder component.
            rateReminder = new RadRateApplicationReminder();

            //Sets how often the rate reminder is displayed.
            rateReminder.RecurrencePerUsageCount = 2;

            var setup = new Setup(RootFrame);
            setup.Initialize();

            DeviceNetworkInformation.NetworkAvailabilityChanged += DeviceNetworkInformation_NetworkAvailabilityChanged;

            _messenger = Mvx.Resolve<IMvxMessenger>();
        }