public bool IsPremiumUser()
        {
            if (_licenseInfo == null)
            {
                // Get License Info
                //_licenseInfo = CurrentAppSimulator.LicenseInformation;
                _licenseInfo = CurrentApp.LicenseInformation;
            }

            try
            {
                ProductLicense pl;
                if (_licenseInfo.ProductLicenses.TryGetValue("premium_user", out pl))
                {
                    return(pl.IsActive);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public Application()
        {
            licenseInfo = CurrentApp.LicenseInformation;

            InitializeComponent();
            Suspending += OnSuspending;
        }
        // Load data for the ViewModel Items
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            LicenseInformation info = new LicenseInformation();
            #if DEBUG
            if (true)
            #else
            if (info.IsTrial())
            #endif
            {
                // running in trial mode
            #if DEBUG
                AdControl ac = new AdControl("TextAd", "test_client", true);
                // Other options in case you want to test other ads
                //AdControl ac = new AdControl("Image480_80", "test_client", true);
                //AdControl ac = new AdControl("Image300_50", "test_client", true);
            #else
                AdControl ac = new AdControl("012345", "01234567-1234-1234-1234-0123456789012", true);
            #endif
                ac.Width = 480;
                ac.Height = 80;

                AdControlHolder.Child = ac;
            }

            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();

            }
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            licenseInfo = CurrentApp.LicenseInformation;

            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            MainDisplayFrame.Navigate(typeof(DashboardPage));

            try
            {
                await StoreServices.SetupStoreServices();

                LicenseInformation LicenseInformation = CurrentApp.LicenseInformation;
                StoreServices.CheckFreemiumStatus();
                StoreServices.CheckForPremiumStatus();

                AdVisibility = StoreServices.RemoveAds || StoreServices.IsPremium ? Visibility.Collapsed : Visibility.Visible;
                PremiumFeatures = StoreServices.IsPremium;
   
                _tutorialModels = ConfigurationServices.GetTutorialLinks();
            }
            catch
            {
                //if this fails we want to eat it silently. 
                //we have a backup for tutorials null and 
                //the user doesn't care about telemetry
            }

            this.DataContext = this;
        }
Esempio n. 6
0
        /// <summary>
        /// Richiamato quando la pagina sta per essere visualizzata in un Frame.
        /// </summary>
        /// <param name="e">Dati dell'evento in cui vengono descritte le modalità con cui la pagina è stata raggiunta. La proprietà
        /// Parameter viene in genere utilizzata per configurare la pagina.</param>

        void initializeLicense()
        {
            // Initialize the license info for use in the app that is uploaded to the Store.
            // uncomment for release
            licenseInformation = CurrentApp.LicenseInformation;

            // Initialize the license info for testing.
            // comment the next line for release
            //licenseInformation = CurrentAppSimulator.LicenseInformation;

            // Register for the license state change event.
            licenseInformation.LicenseChanged += new LicenseChangedEventHandler(licenseChangedEventHandler);

            if (licenseInformation.IsActive)
            {
                if (licenseInformation.IsTrial)
                {
                    var longDateFormat = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longdate");
                    var daysRemaining  = (licenseInformation.ExpirationDate - DateTime.Now).Days;

                    MessageDialog msgDialog = new MessageDialog("Grazie per aver acquistato la versione di prova della tastiera fonetica! \n\r La versione trial dura " + "quantigiornidura.toString()" + " .", "Versione di prova");
                    //msgDialog.ShowAsync();
                }
            }
        }
        /// <summary>
        /// Invoked when the user asks purchase the app.
        /// </summary>
        private async void PurchaseFullLicense()
        {
            LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

            rootPage.NotifyUser("Buying the full license...", NotifyType.StatusMessage);
            if (licenseInformation.IsTrial)
            {
                try
                {
                    await CurrentAppSimulator.RequestAppPurchaseAsync(false);

                    if (!licenseInformation.IsTrial && licenseInformation.IsActive)
                    {
                        rootPage.NotifyUser("You successfully upgraded your app to the fully-licensed version.", NotifyType.StatusMessage);
                    }
                    else
                    {
                        rootPage.NotifyUser("You still have a trial license for this app.", NotifyType.ErrorMessage);
                    }
                }
                catch (Exception)
                {
                    rootPage.NotifyUser("The upgrade transaction failed. You still have a trial license for this app.", NotifyType.ErrorMessage);
                }
            }
            else
            {
                rootPage.NotifyUser("You already bought this app and have a fully-licensed version.", NotifyType.ErrorMessage);
            }
        }
Esempio n. 8
0
        private async void Buy2(object sender, RoutedEventArgs e)
        {
            LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

            if (!licenseInformation.ProductLicenses["product2"].IsActive)
            {
                try
                {
                    await CurrentAppSimulator.RequestProductPurchaseAsync("product2");

                    if (licenseInformation.ProductLicenses["product2"].IsActive)
                    {
                        //rootPage.NotifyUser("You bought " + productName + ".", NotifyType.StatusMessage);
                        tb2.Text = "You have bought Product2";
                    }
                    else
                    {
                        //rootPage.NotifyUser(productName + " was not purchased.", NotifyType.StatusMessage);
                        tb2.Text = "Product2 was not purchased";
                    }
                }
                catch (Exception)
                {
                    //rootPage.NotifyUser("Unable to buy " + productName + ".", NotifyType.ErrorMessage);
                }
            }
            else
            {
                //rootPage.NotifyUser("You already own " + productName + ".", NotifyType.ErrorMessage);
            }
        }
        private void ExpiringProductRefreshScenario()
        {
            LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

            if (licenseInformation.IsActive)
            {
                if (licenseInformation.IsTrial)
                {
                    rootPage.NotifyUser("You don't have full license", NotifyType.ErrorMessage);
                }
                else
                {
                    var productLicense1 = licenseInformation.ProductLicenses["product1"];
                    if (productLicense1.IsActive)
                    {
                        var longdateTemplate = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longdate");
                        Product1Message.Text = "Product 1 expires on: " + longdateTemplate.Format(productLicense1.ExpirationDate);
                        var remainingDays = (productLicense1.ExpirationDate - DateTime.Now).Days;
                        rootPage.NotifyUser("Product 1 expires in: " + remainingDays + " days.", NotifyType.StatusMessage);
                    }
                    else
                    {
                        rootPage.NotifyUser("Product 1 is not available.", NotifyType.ErrorMessage);
                    }
                }
            }
            else
            {
                rootPage.NotifyUser("You don't have active license.", NotifyType.ErrorMessage);
            }
        }
Esempio n. 10
0
        private async void loadTestData(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
        {
            bool pass = true;

            try
            {
                // create xml obj
                var currentApp = new InAppTestObjects.CurrentApp();
                currentApp.ListingInformation.Products = new InAppTestObjects.ListingInformation_Product[desc.WinRT_MicrosoftStore_InAppIDs.Length];
                currentApp.LicenseInformation.Products = new InAppTestObjects.LicenseInformation_Product[desc.WinRT_MicrosoftStore_InAppIDs.Length];
                for (int i = 0; i != currentApp.ListingInformation.Products.Length; ++i)
                {
                    var listingProduct = new InAppTestObjects.ListingInformation_Product();
                    listingProduct.ProductId                  = desc.WinRT_MicrosoftStore_InAppIDs[i].ID;
                    listingProduct.ProductType                = desc.WinRT_MicrosoftStore_InAppIDs[i].Type == InAppPurchaseTypes.NonConsumable ? null : "Consumable";
                    listingProduct.MarketData.Name            = desc.WinRT_MicrosoftStore_InAppIDs[i].ID;
                    listingProduct.MarketData.Description     = null;
                    listingProduct.MarketData.Price           = desc.WinRT_MicrosoftStore_InAppIDs[i].Price.ToString();
                    listingProduct.MarketData.CurrencySymbol  = desc.WinRT_MicrosoftStore_InAppIDs[i].CurrencySymbol;
                    currentApp.ListingInformation.Products[i] = listingProduct;

                    var licenseProduct = new InAppTestObjects.LicenseInformation_Product();
                    licenseProduct.ProductId = desc.WinRT_MicrosoftStore_InAppIDs[i].ID;
                    currentApp.LicenseInformation.Products[i] = licenseProduct;
                }

                // serialize obj
                var    xml  = new XmlSerializer(typeof(InAppTestObjects.CurrentApp));
                byte[] data = null;
                using (var stream = new MemoryStream())
                {
                    xml.Serialize(stream, currentApp);
                    stream.Position = 0;
                    data            = new byte[stream.Length];
                    stream.Read(data, 0, data.Length);
                }

                // write and read test InApp data
                StorageFile writeFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("TEST_InAppPurchase.xml", CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteBytesAsync(writeFile, data);

                StorageFile readFile = await ApplicationData.Current.LocalFolder.GetFileAsync("TEST_InAppPurchase.xml");

                await CurrentAppSimulator.ReloadSimulatorAsync(readFile);

                licenseInformation = CurrentAppSimulator.LicenseInformation;
                licenseInformation.LicenseChanged += licenseChanged;
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (createdCallback != null)
            {
                createdCallback(pass);
            }
        }
Esempio n. 11
0
        public static bool getProductStatus()
        {
            LicenseInformation license = CurrentApp.LicenseInformation;
            ProductLicense     product = license.ProductLicenses[prodotto];

            return(product.IsActive);
        }
Esempio n. 12
0
        /// <summary>
        /// Vérifie la license en cours sur l'application et passe la valeur en base à true si elle est achetée
        /// </summary>
        public async Task CheckLicense()
        {
            if (_licenseInfo == null)
            {
                _licenseInfo = CurrentApp.LicenseInformation;
                _licenseInfo.LicenseChanged += LicenseInfoOnLicenseChanged;
            }
            var applicationBusiness = new ApplicationBusiness();
            await applicationBusiness.Initialization;

            var licenseTrial = _licenseInfo.IsTrial;
            var licenseBase  = false;

            if (licenseTrial)
            {
                licenseBase = await applicationBusiness.GetFullMode();
            }

            //si je vois qu'en base la valeur est false alors que la license est activée, je corrige
            if (!licenseBase && !licenseTrial)
            {
                await applicationBusiness.ActiverFullMode();
            }
            IsFull = !licenseTrial || licenseBase;

            #if DEBUG
            //IsFull = true;
            #endif
        }
Esempio n. 13
0
        public async Task BuyProductAsync(string productId, string productName)
        {
            LicenseInformation licenseInformation = CurrentApp.LicenseInformation;

            if (!licenseInformation.ProductLicenses[productId].IsActive)
            {
                try
                {
                    await CurrentApp.RequestProductPurchaseAsync(productId);

                    if (licenseInformation.ProductLicenses[productId].IsActive)
                    {
                        LayoutHelper.InvokeFromUiThread(() =>
                        {
                            MessageBox.Show($"{AppResources.YouBought} {productName}.");
                        });
                    }
                    else
                    {
                        throw new PurchaseException($"{AppResources.UnableToBuy} {productName}.");
                        //rootPage.NotifyUser(productName + " was not purchased.", NotifyType.StatusMessage);
                    }
                }
                catch (Exception)
                {
                    throw new PurchaseException($"{AppResources.UnableToBuy} {productName}.");
                }
            }
            else
            {
                throw new PurchaseException($"{AppResources.YouAlreadyOwn} {productName}.");
            }
        }
Esempio n. 14
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();

            // 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 handed off to GPU 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;
            }

            m_licenseInfo = new LicenseInformation();

            detectCurrentTheme();
        }
Esempio n. 15
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

            if (!licenseInformation.ProductLicenses["product2"].IsActive)
            {
                try
                {
                    await CurrentAppSimulator.RequestProductPurchaseAsync("product2");

                    if (licenseInformation.ProductLicenses["product2"].IsActive)
                    {
                        AdMediator.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        AdMediator.Visibility = Visibility.Visible;
                    }
                }
                catch (Exception)
                {
                    //rootPage.NotifyUser("Unable to buy " + productName + ".", NotifyType.ErrorMessage);
                }
            }
            else
            {
                //rootPage.NotifyUser("You already own " + productName + ".", NotifyType.ErrorMessage);
            }
        }
Esempio n. 16
0
        public MicrosoftStore_InAppPurchasePlugin_Native(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
        {
            testing       = desc.Testing;
            testTrialMode = desc.TestTrialMode;

                        #if WINDOWS_PHONE
            InAppIDs = desc.WP8_MicrosoftStore_InAppIDs;
                        #else
            InAppIDs = desc.WinRT_MicrosoftStore_InAppIDs;
                        #endif

            if (desc.Testing)
            {
                loadTestData(desc, createdCallback);
            }
            else
            {
                licenseInformation = CurrentApp.LicenseInformation;
                licenseInformation.LicenseChanged += licenseChanged;
                if (createdCallback != null)
                {
                    createdCallback(true);
                }
            }
        }
Esempio n. 17
0
        public static bool IsTrialMode(bool forceRefresh)
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return(false);
            }

            if (forceRefresh || (cachedIsTrialMode == null))
            {
#if DEBUG
                MessageBoxResult result = MessageBox.Show("Click ok to simulate paid version", "Simulate paid version?", MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.OK)
                {
                    cachedIsTrialMode = false;
                }
                else
                {
                    cachedIsTrialMode = true;
                }
#else
                LicenseInformation licenseInfo = new LicenseInformation();
                cachedIsTrialMode = licenseInfo.IsTrial();
#endif
            }
            return(cachedIsTrialMode.Value);
        }
Esempio n. 18
0
 private void ExpiringProductRefreshScenario()
 {
     var task = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;
         if (licenseInformation.IsActive)
         {
             if (licenseInformation.IsTrial)
             {
                 rootPage.NotifyUser("You don't have a full license to this app.", NotifyType.ErrorMessage);
             }
             else
             {
                 var productLicense1 = licenseInformation.ProductLicenses["product1"];
                 if (productLicense1.IsActive)
                 {
                     var longdateTemplate = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longdate");
                     Product1Message.Text = "Product 1 expires on " + longdateTemplate.Format(productLicense1.ExpirationDate) + ". Days remaining: " + (productLicense1.ExpirationDate - DateTime.Now).Days;
                 }
                 else
                 {
                     rootPage.NotifyUser("Product 1 is not available.", NotifyType.ErrorMessage);
                 }
             }
         }
         else
         {
             rootPage.NotifyUser("You don't have active license.", NotifyType.ErrorMessage);
         }
     });
 }
Esempio n. 19
0
        public async Task <InAppPurchaseHelper> Setup()
        {
            // license
            if (Simulate)
            {
#if DEBUG
                await SetupSimulation();

                m_License = CurrentAppSimulator.LicenseInformation;
                m_Listing = await CurrentAppSimulator.LoadListingInformationAsync();

                CanPurchase = true;
#endif
            }
            else
            {
                try
                {
                    m_License = CurrentApp.LicenseInformation;
                    m_Listing = await CurrentApp.LoadListingInformationAsync();

                    CanPurchase = true;
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(string.Format("Setup/License [{0}, {1}, {2}]", this.Key, this.Simulate, e.Message));
                    CanPurchase = false;
                }
            }

            if (!CanPurchase)
            {
                return(this); // :(
            }
            try
            {
                // test setup
                m_License.LicenseChanged += () => { RaiseLicenseChanged(IsPurchased); };
                IReadOnlyDictionary <string, ProductLicense> _Licenses = m_License.ProductLicenses;
                if (!_Licenses.Any(x => x.Key.Equals(Key, StringComparison.CurrentCultureIgnoreCase)))
                {
                    throw new KeyNotFoundException(Key);
                }

                IReadOnlyDictionary <string, ProductListing> _Products = m_Listing.ProductListings;
                if (!_Products.Any(x => x.Key.Equals(Key, StringComparison.CurrentCultureIgnoreCase)))
                {
                    throw new KeyNotFoundException(Key);
                }

                // product
                m_Product = _Products[Key];
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Setup/Tests [{0}, {1}, {2}]", this.Key, this.Simulate, e.Message));
                CanPurchase = false;
            }
            return(this);
        }
Esempio n. 20
0
        public DicomEditorComponent()
        {
            var setTagValueDelegate = new TableColumn <DicomEditorTag, string> .SetColumnValueDelegate <DicomEditorTag, string>((d, value) =>
            {
                if (d.IsEditable())
                {
                    d.Value = value;
                    _dirtyFlags[_position] = true;
                    EventsHelper.Fire(_tagEditedEvent, this, EventArgs.Empty);
                }
            });

            if (!LicenseInformation.IsFeatureAuthorized(FeatureTokens.DicomEditing))
            {
                setTagValueDelegate = null;
            }

            _dicomTagData = new Table <DicomEditorTag>();
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingGroupElement, delegate(DicomEditorTag d) { return(d.DisplayKey); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.GroupElement)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingTagName, delegate(DicomEditorTag d) { return(d.TagName); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.TagName)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingVR, delegate(DicomEditorTag d) { return(d.Vr); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.Vr)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingLength, delegate(DicomEditorTag d) { return(d.Length); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.Length)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingValue, delegate(DicomEditorTag d) { return(d.Value); }, setTagValueDelegate, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.Value)); }));
            _title       = "";
            _loadedFiles = new List <DicomFile>();
            _position    = 0;
            _dirtyFlags  = new List <bool>();

            _anonymizer = new DicomAnonymizer();
            _anonymizer.ValidationOptions = ValidationOptions.RelaxAllChecks | ValidationOptions.AllowUnchangedValues;
        }
Esempio n. 21
0
        internal async void PurchaseFullLicense()
        {
            MainPageViewModel mainPageVM = ServiceLocator.Current.GetInstance <MainPageViewModel>();

            licenseInformation = CurrentAppSimulator.LicenseInformation;
            if (licenseInformation.IsTrial)
            {
                try
                {
                    await CurrentAppSimulator.RequestAppPurchaseAsync(false);

                    if (!licenseInformation.IsTrial && licenseInformation.IsActive)
                    {
                        mainPageVM.ResumeDownloadAction();
                    }
                    else
                    {
                        mainPageVM.CancelDownloadAction();
                    }
                }
                catch (Exception)
                {
                    mainPageVM.CancelDownloadAction();
                }
            }
        }
        /// <summary>
        ///   Refreshes the trail mode value - should be called after every app start or resume
        /// </summary>
        public static void RefreshTrailMode() {
#if DEBUG
            ApplicationIsTrialPrivate = false;
#else
            ApplicationIsTrialPrivate = new LicenseInformation().IsTrial();
#endif
        }
        /// <summary>
        /// Refresh the license information for the app
        /// </summary>
        private async Task RefreshLicenseInfoAsync()
        {
            // Do we already have a license information object?
            if (_licenseInfo == null)
            {
                // No, so create one now
#if DEBUG
                // Get a reference to the project's WindowsStoreProxy.xml file
                var sourceFile = await Package.Current.InstalledLocation.GetFileAsync("WindowsStoreProxy.xml");

                // Get the output location for the file
                var destFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Microsoft\\Windows Store\\ApiData", CreationCollisionOption.OpenIfExists);

                // Create the output file
                var destFile = await destFolder.CreateFileAsync("WindowsStoreProxy.xml", CreationCollisionOption.ReplaceExisting);

                // Copy the WindowsStoreProxy.xml file to the output file
                await sourceFile.CopyAndReplaceAsync(destFile);

                // Use CurrentAppSimulator to simulate access to the license data
                _licenseInfo = CurrentAppSimulator.LicenseInformation;
#else
                // Use the genuine application license information
                _licenseInfo = CurrentApp.LicenseInformation;
#endif
                // Add an event listener in case the license data is updated while the app is running
                _licenseInfo.LicenseChanged += LicenseInfo_LicenseChanged;
            }

            // Check if we're in trial mode
            IsTrial = (_licenseInfo.IsTrial == true || _licenseInfo.IsActive == false);
        }
Esempio n. 24
0
 void LoadLicenseInformation()
 {
     // TODO: Implement licence handling
     mLicenseInfo = LicenseInformation.Load();
     paidLicense  = true;
     isGenuine    = true;
 }
Esempio n. 25
0
        private async void BuyProduct(string productID)
        {
            MessageDialog      msg;
            LicenseInformation licenseInformation = CurrentApp.LicenseInformation;

            if (!licenseInformation.ProductLicenses[productID].IsActive)
            {
                try
                {
                    await CurrentApp.RequestProductPurchaseAsync(productID);

                    if (licenseInformation.ProductLicenses[productID].IsActive)
                    {
                        msg = new MessageDialog("You have successed Donation and Remove ADS, Thank you!");
                        RemoveAds();
                    }
                    else
                    {
                        msg = new MessageDialog("You have not buy Remove ADS");
                    }
                }
                catch (Exception)
                {
                    msg = new MessageDialog("Something not right try again later, Thank you!");
                    throw;
                }
            }
        }
Esempio n. 26
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            // Remove these lines of code before publishing!
            // The actual CurrentApp will create a WindowsStoreProxy.xml
            // in the package's \LocalState\Microsoft\Windows Store\ApiData
            // folder where it stores the actual purchases.
            // Here we're just giving it a fake version of that file
            // for testing.
            StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");

            StorageFile proxyFile = await proxyDataFolder.GetFileAsync("test.xml");

            await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);

            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            // You may want to put this at the App level
            AppLicenseInformation = CurrentAppSimulator.LicenseInformation;

            if (AppLicenseInformation.ProductLicenses["RemoveAdsOffer"].IsActive)
            {
                // Customer can access this feature.
                AdMediator_40F141.Visibility = Visibility.Collapsed;
                PurchaseButton.Visibility    = Visibility.Collapsed;
            }
            else
            {
                // Customer can NOT access this feature.
                AdMediator_40F141.Visibility = Visibility.Visible;
                PurchaseButton.Visibility    = Visibility.Visible;
            }
        }
Esempio n. 27
0
        private async void BuyProduct1Button_Click(object sender, RoutedEventArgs e)
        {
            LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

            if (!licenseInformation.ProductLicenses["product1"].IsActive)
            {
                rootPage.NotifyUser("Buying Product 1...", NotifyType.StatusMessage);
                try
                {
                    await CurrentAppSimulator.RequestProductPurchaseAsync("product1", false);

                    if (licenseInformation.ProductLicenses["product1"].IsActive)
                    {
                        rootPage.NotifyUser("You bought Product 1.", NotifyType.StatusMessage);
                    }
                    else
                    {
                        rootPage.NotifyUser("", NotifyType.StatusMessage);
                    }
                }
                catch (Exception)
                {
                    rootPage.NotifyUser("Unable to buy Product 1.", NotifyType.ErrorMessage);
                }
            }
            else
            {
                rootPage.NotifyUser("You already own Product 1.", NotifyType.ErrorMessage);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            FavoritesDataSource favoritesDataSource = (FavoritesDataSource)App.Current.Resources["favoritesDataSource"];

            if (favoritesDataSource != null)
            {
                var items = new ObservableCollection <ConnectionData>(favoritesDataSource.Favorites.OrderBy(f => f.Name));
                this.DefaultViewModel["Items"] = items;

                this.emptyHint.Visibility = this.itemGridView.Items.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
                this.SetupAppBar();
            }

#if DEBUG
            this.licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
            this.licenseInformation = CurrentApp.LicenseInformation;
#endif
            this.RefreshTrialHint();
            this.licenseInformation.LicenseChanged += RefreshTrialHint;

            if (TerminalManager.Terminals.Count > 0)
            {
                this.previewGrid.ItemsSource = TerminalManager.Terminals;
                this.TopAppBar.IsOpen        = true;
                await Task.Delay(1000);

                this.TopAppBar.IsOpen = false;
            }
            else
            {
                this.TopAppBar = null;
            }
        }
        private async Task BuyProductAsync(string productId, string productName)
        {
            LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

            if (!licenseInformation.ProductLicenses[productId].IsActive)
            {
                rootPage.NotifyUser("Buying " + productName + "...", NotifyType.StatusMessage);
                try
                {
                    await CurrentAppSimulator.RequestProductPurchaseAsync(productId);

                    if (licenseInformation.ProductLicenses[productId].IsActive)
                    {
                        rootPage.NotifyUser("You bought " + productName + ".", NotifyType.StatusMessage);
                    }
                    else
                    {
                        rootPage.NotifyUser(productName + " was not purchased.", NotifyType.StatusMessage);
                    }
                }
                catch (Exception)
                {
                    rootPage.NotifyUser("Unable to buy " + productName + ".", NotifyType.ErrorMessage);
                }
            }
            else
            {
                rootPage.NotifyUser("You already own " + productName + ".", NotifyType.ErrorMessage);
            }
        }
Esempio n. 30
0
        private async Task PurchaseProduct(string productId, ushort featureLevel)
        {
            LicenseInformation licenseInformation = IAPs.LicenseInformation;

            if (!licenseInformation.ProductLicenses[productId].IsActive)
            {
                try
                {
                    await IAPs.RequestProductPurchaseAsync(productId);
                }
                catch (Exception ex)
                {
                    var dlg = new ContentDialog
                    {
                        Content = new TextBlock()
                        {
                            Text         = "Error occured : " + ex.Message,
                            TextWrapping = TextWrapping.Wrap
                        },
                        PrimaryButtonText = ResourceLoader.GetForCurrentView().GetString("Confirm"),
                    };

                    await dlg.ShowAsync();
                }
            }
            else
            {
                VersionHelper.FeatureLevel |= featureLevel;
            }
        }
Esempio n. 31
0
        public static void Init()
        {
#if DEBUG
            licenseInformation = Debug ? CurrentAppSimulator.LicenseInformation : CurrentApp.LicenseInformation;
#else
            licenseInformation = CurrentApp.LicenseInformation;
#endif
        }
Esempio n. 32
0
        public void init()
        {
#if DEBUG
            licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
            licenseInformation = CurrentApp.LicenseInformation;
#endif
        }
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            LicenseInformation lic = new LicenseInformation();

            if (!lic.IsTrial())
            {
                GoToMainPage();
            }
        }
        public TrialHelper()
        {
            _settings = new ApplicationSettingsService();
#if TRIAL
            IsTrial = true;
#else
            IsTrial = new LicenseInformation().IsTrial();
#endif
        }
Esempio n. 35
0
        public TrialHelper()
        {
            _settings = new ApplicationSettingsService().Legacy;
#if TRIAL
            IsTrial = true;
#else
            IsTrial = new LicenseInformation().IsTrial();
            _settings.Set(Constants.Settings.AppIsBought, !IsTrial);
#endif
        }
Esempio n. 36
0
        // Load data for the ViewModel Items
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
                App.ViewModel.LoadData();

            //if (Session.Emp.StartDate == DateTime.Today)
            //    NavigationService.Navigate(new Uri("/NewHire.xaml", UriKind.Relative));
            var li = new LicenseInformation();
            //if (li.IsTrial() || System.Diagnostics.Debugger.IsAttached)
            //    Ads.Visibility = System.Windows.Visibility.Visible;
        }
Esempio n. 37
0
 //private void button1_Click(object sender, RoutedEventArgs e)
 //{
 //    border1.Visibility = Visibility.Collapsed;
 //}
 private void panoramaControl_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
 {
     LicenseInformation lic = new LicenseInformation();
     if (lic.IsTrial())
     {
         if (panoramaControl.SelectedIndex >= 2)
         {
             NavigationService.Navigate(new Uri("/BuyFullversion.xaml", UriKind.RelativeOrAbsolute));
         }
     }
 }
 public void isTrial(string options)
 {
     bool isTrial;
     #if DEBUG
     isTrial = true; // change this enable debugging in non-trial mode
     #else
     var licenseInfo = new LicenseInformation();
     isTrial = licenseInfo.IsTrial();
     #endif
     DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "{\"trial\": " + isTrial.ToString().ToLower() + "}"));
 }
        // Sample code for building a localized ApplicationBar
        //private void BuildLocalizedApplicationBar()
        //{
        //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
        //    ApplicationBar = new ApplicationBar();
        //    // Create a new button and set the text value to the localized string from AppResources.
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);
        //    // Create a new menu item with the localized string from AppResources.
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            LicenseInformation licenseInfo = new LicenseInformation();
            bool isTrial = licenseInfo.IsTrial();
            if (isTrial)
                homePageButton.Content = "Buy this application";
            else
                homePageButton.Content = "Marketplace home";

            base.OnNavigatedTo(e);
        }
Esempio n. 40
0
        public EventEdit()
        {
            InitializeComponent();
            prefillListPickers();
            NameBox.Text = Session.EventForEditing.Description;
            HourBox.SelectedItem = Session.EventForEditing.Hours;
            DateBox.Value = Session.EventForEditing.Date;

            var li = new LicenseInformation();
            //if (li.IsTrial() || System.Diagnostics.Debugger.IsAttached)
            //    Ads.Visibility = System.Windows.Visibility.Visible;
        }
Esempio n. 41
0
 static Store()
 {
     var information = CurrentApp.LicenseInformation;
     if (information != null)
     {
         information.LicenseChanged += OnLicenseChanged;
         var license = new LicenseInformation();
         license.ExpirationDate = information.ExpirationDate;
         license.IsActive = information.IsActive;
         license.IsTrial = information.IsTrial;
         license.ProductLicenses = new Dictionary<string, ProductLicense>();
     }
 }
Esempio n. 42
0
        void AppInit()
        {
            // some app initialization functions 

            // Get the license info
            mLicenseInformation = CurrentApp.LicenseInformation;

            // add event handler to catch changes in license state.
            mLicenseInformation.LicenseChanged += new LicenseChangedEventHandler(LicenseChangedEventHandler);

            // other app initialization functions
            GetListingInfo();
        }
        // Constructor
        public HelloPage()
        {
            InitializeComponent();
            globeBrush = (SolidColorBrush)ContentPanel.Resources["GlobeBrush"];

            LicenseInformation licenseInfo = new LicenseInformation();
            #if TRIAL_LICENSE
            bool isInTrialMode = true;
            #else
            bool isInTrialMode = licenseInfo.IsTrial();
            #endif
            if (isInTrialMode)
            {
                ApplicationTitle.Text += " (TRIAL)";
            }
        }
Esempio n. 44
0
        public static void Init()
        {
            if (initalized)
                return;


            _appLicenseInformation = new LicenseInformation
                                         {
                                             ExpirationDate = DateTimeOffset.Now,
                                             IsActive = true,
                                             IsTrial = false,
                                             ProductLicenses = new Dictionary<string, ProductLicense>()
                                         };

            StateInformation = new MockReceiptState();

            initalized = true;
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            globeBrush = (SolidColorBrush)ContentPanel.Resources["GlobeBrush"];

            LicenseInformation licenseInfo = new LicenseInformation();
            #if TRIAL_LICENSE
            bool isInTrialMode = true;
            #else
            bool isInTrialMode = licenseInfo.IsTrial();
            #endif
            if (isInTrialMode)
            {
                ApplicationTitle.Text += " (TRIAL)";
            }
        }
Esempio n. 46
0
        // 생성자
        public MainPage()
        {
            InitializeComponent();
            licenseInfo = new LicenseInformation();

            ApplicationBar = new ApplicationBar();
            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            ApplicationBar.Opacity = 0.5;
            this.seledtedDeleteButton.Text = "Delete";
            this.seledtedViewButton.Text = "View";

            ApplicationBar.Buttons.Add(seledtedViewButton);
            ApplicationBar.Buttons.Add(seledtedDeleteButton);
            seledtedDeleteButton.Click += new EventHandler(seledtedDeleteButton_Click);
            seledtedViewButton.Click += new EventHandler(seledtedViewButton_Click);

            //드롭박스 파일 다운로드 탭 초기화
            InitTextFileDownloadTab();

            //리스트박스 아이템 소스 지정
            this.lb_library.ItemsSource = TextLists;
            ReadFileList();

            // ListBox 컨트롤의 데이터 컨텍스트를 샘플 데이터로 설정합니다.
            //DataContext = App.ViewModel;
            //this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            string backgroundcolor="";
            string fontcolor = "";
            try
            {
                 backgroundcolor = IsolatedStorageSettings.ApplicationSettings["Appsetting_backgroundcolor"].ToString();
                 fontcolor = IsolatedStorageSettings.ApplicationSettings["Appsetting_fontcolor"].ToString();
            }
            catch
            {
                 backgroundcolor = "White";
                 fontcolor = "Black";
            }
            setColorSetting(backgroundcolor, fontcolor);
        }
Esempio n. 47
0
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     Loaded += (sender, e) =>
     {
         var li = new LicenseInformation();
         if (!li.IsTrial())
         {
             MyAdControl.Visibility = Visibility.Collapsed;
         }
         var ints = new List<string>();
         for (int i = 1; i < 150; i++)
         {
             ints.Add(i.ToString());
         }
         var ds = new LoopingSelectorDataSource<string>(ints);
         NumberOfQuestions.DataSource = ds;
         var initialValue = RetrieveInitialValue();
         ds.SelectedItem = initialValue.ToString();
         Calculate(initialValue);
     };
 }
Esempio n. 48
0
 static Store()
 {
     var information = CurrentApp.LicenseInformation;
     if (information != null)
     {
         information.LicenseChanged += OnLicenseChanged;
         licenseInformation = new LicenseInformation();
         licenseInformation.ExpirationDate = information.ExpirationDate;
         licenseInformation.IsActive = information.IsActive;
         licenseInformation.IsTrial = information.IsTrial;
         licenseInformation.ProductLicenses = new Dictionary<string, ProductLicense>();
         var dict = information.ProductLicenses;
         foreach (var keyValuePair in dict)
         {
             var value = keyValuePair.Value;
             var productLicense = new ProductLicense();
             productLicense.ExpirationDate = value.ExpirationDate;
             productLicense.IsActive = value.IsActive;
             productLicense.ProductId = productLicense.ProductId;
             licenseInformation.ProductLicenses.Add(keyValuePair.Key, productLicense);
         }
     }
 }
Esempio n. 49
0
        public AppViewModel()
        {
            #if TRIAL
            _isTrial = true;
            #else
            _isTrial = new LicenseInformation().IsTrial();
            #endif
            Solutions = new ObservableCollection<Word>();
            ConstraintState cs;
            if (!IsolatedStorageSettings.ApplicationSettings.TryGetValue("LastUsedValues", out cs))
            {
                cs = new ConstraintState();
                IsolatedStorageSettings.ApplicationSettings.Add("LastUsedValues", cs);
            }

            SettingsModel settings;
            if (!IsolatedStorageSettings.ApplicationSettings.TryGetValue("Settings", out settings))
            {
                settings = new SettingsModel();
                settings.Dictionary = new DictionaryDisplay { File = "twl06.txt" };
                IsolatedStorageSettings.ApplicationSettings.Add("Settings", settings);
            }

            if (cs.TemplateFactory == null)
                cs.TemplateFactory = new StartsWithTemplateFactory();

            ActiveConstraints = cs;
            Settings = settings;

            Settings.PropertyChanged += new PropertyChangedEventHandler(Settings_PropertyChanged);
            ActiveConstraints.PropertyChanged += new PropertyChangedEventHandler(ActiveConstraints_PropertyChanged);

            _solverInitialized = new ManualResetEvent(false);
            _queryId = 0;
            _querySync = new object();
            InitializeSolver();
        }
Esempio n. 50
0
        public static bool IsTrialMode(bool forceRefresh)
        {
            if (DesignerProperties.IsInDesignTool)
                return false;

            if (forceRefresh || (cachedIsTrialMode == null))
            {
            #if DEBUG
                   MessageBoxResult result = MessageBox.Show("Click ok to simulate paid version", "Simulate paid version?", MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.OK)
                {
                cachedIsTrialMode = false;
                }
                else
                {
                cachedIsTrialMode = true;
                }
            #else
                LicenseInformation licenseInfo = new LicenseInformation();
                cachedIsTrialMode = licenseInfo.IsTrial();
            #endif
            }
            return cachedIsTrialMode.Value;
        }
Esempio n. 51
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            //Init
            removedStrokes=new Stack<Stroke>();
            licenseInfo = new LicenseInformation();

            //Only support Portrait mode for now
            SupportedOrientations = SupportedPageOrientation.Portrait;

            //Camera Event
            cameraTask = new CameraCaptureTask();
            cameraTask.Completed += new EventHandler<PhotoResult>(cameraTask_Completed);

            //Photo Event
            photoTask = new PhotoChooserTask();
            photoTask.Completed += new EventHandler<PhotoResult>(photoTask_Completed);

            //About Event
            spAboutOpen.Completed+=new System.EventHandler(spAboutOpen_Completed);

            //Set Up Ink
            App.inkStorage = inkSketch;
            App.inkStorage.Visibility = Visibility.Visible;
            if (App.inkStrokes.Strokes.Count > 0)
            {
                App.inkStorage.Strokes = App.inkStrokes.Strokes;
            }
            ink = new InkCollector(App.inkStorage);

            //Custom Color Handler
            colorPicker.ColorSelected += new SilverlightColorPicker.ColorPicker.ColorSelectedHandler(colorPicker_ColorSelected);

            //Set default brush properties
            SetBrushDefaults();

            //Load any custom colors that have been created
            LoadCustomGlobalBrushes();

            spAbout.Visibility = Visibility.Collapsed;
            btnPurchase.Visibility=Visibility.Collapsed;
            imgEraser.Visibility = Visibility.Collapsed;
            spSettings.Visibility = Visibility.Collapsed;

            this.BackKeyPress += new EventHandler<System.ComponentModel.CancelEventArgs>(MainPage_BackKeyPress);

            if (App.customBG)
            {
                imgBG.Source = App.WBMP;
                App.imgTemp = imgBG;
            }

            //Dynamically create AppBar
            LoadAppBar();
        }
Esempio n. 52
0
 public bool IsTrial()
 {
     var license = new LicenseInformation();
     return license.IsTrial();
 }
Esempio n. 53
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();

            // 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 handed off to GPU 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;
            }

            licenseInfo = new LicenseInformation();

            detectCurrentTheme();

            // Initialize diagnostics
            radDiagnostics = new RadDiagnostics();
            radDiagnostics.EmailTo = "*****@*****.**";
            radDiagnostics.Init();
        }
Esempio n. 54
0
 private static void LoadIsTrial()
 {
     IsTrial = new LicenseInformation().IsTrial();
     #if DEBUG_TRIAL
     IsTrial = true;
     #endif
 }
Esempio n. 55
0
 /// <summary>
 /// Check the current license information for this application.
 /// </summary>
 private static void CheckLicense()
 {
     IsTrial = new LicenseInformation().IsTrial();
 }
Esempio n. 56
0
 private void ValidateTrialMode()
 {
     IsInTrialMode = new LicenseInformation().IsTrial();
     TriggerTrialModeChanged();
 }