コード例 #1
0
    protected void setNoPlayingDaysNotifications()
    {
        //86400 sconds per day

        if (DataManagerKubera.GetCastedInstance <DataManagerKubera> () != null)
        {
            //3 days
            int currentLevel = DataManagerKubera.GetCastedInstance <DataManagerKubera> ().currentUser.levels.Count + 1;
            (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
                MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_3_DAYS).Replace("{{level}}", currentLevel.ToString()),
                "Kubera", 259200);
        }

        //7 days
        (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
            villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
            MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_7_DAYS),
            "Kubera", 604800);

        //14 days
        (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
            villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
            MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_14_DAYS),
            "Kubera", 1209600);

        //30 days
        (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
            villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
            MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_30_DAYS),
            "Kubera", 2592000);

        scheduled = true;
    }
コード例 #2
0
ファイル: App.cs プロジェクト: SideswipeN7/JsonFormatter
        public App(LocalNotificationManager manager)
        {
            this.manager = manager;
            formatter    = new JsonFormatter();
            FileDialogOptions readOptions = new FileDialogOptions
            {
                StartLocation  = PickerLocationId.DocumentsLibrary,
                FileExtensions = new[]
                {
                    new FileExtension {
                        Name = "JSON", FileSuffix = "json"
                    },
                    new FileExtension {
                        Name = "TEXT", FileSuffix = "txt"
                    }
                }
            };

            FileDialogOptions writeOptions = new FileDialogOptions
            {
                StartLocation   = PickerLocationId.DocumentsLibrary,
                DefaultFileName = "formattedJson",
                FileExtensions  = new[]
                {
                    new FileExtension {
                        Name = "JSON", FileSuffix = "json"
                    },
                }
            };

            reader = new FileReader(readOptions);
            writer = new FileWriter(writeOptions);
        }
コード例 #3
0
        public MainPage(IActivatedEventArgs args)
        {
            this.InitializeComponent();

            ViewModel        = new MainViewmodel(args);
            this.DataContext = ViewModel;

            #region registering for messages
            Messenger.Default.Register <LocalNotificationMessageType>(this, RecieveLocalNotificationMessage);
            Messenger.Default.Register(this, delegate(SetHeaderTextMessageType m) { SetHeadertext(m.PageName); });
            Messenger.Default.Register(this, delegate(AdsEnabledMessageType m) { ViewModel.ToggleAdsVisiblity(); });
            Messenger.Default.Register(this, delegate(HostWindowBlurMessageType m) { ConfigureWindowBlur(); });
            Messenger.Default.Register(this, delegate(UpdateUnreadNotificationMessageType m) { ViewModel.UpdateUnreadNotificationIndicator(m.IsUnread); });
            Messenger.Default.Register(this, async delegate(ShowWhatsNewPopupMessageType m) { await ShowWhatsNewPopupVisiblity(); });
            Messenger.Default.Register <User>(this, ViewModel.RecieveSignInMessage);
            #endregion

            notifManager = new LocalNotificationManager(NotificationGrid);

            Loaded      += MainPage_Loaded;
            SizeChanged += MainPage_SizeChanged;

            SimpleIoc.Default.Register <IAsyncNavigationService>(() => { return(new NavigationService(AppFrame)); });
            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            NavigationCacheMode = NavigationCacheMode.Enabled;
        }
コード例 #4
0
    public void takeALife()
    {
        KuberaUser tempUsr = currentUser;

        if (tempUsr.playerLifes == maximumLifes)
        {
            setLifeDate();

            currentMinutes = timeForLifeInMinutes;
            currentSeconds = 0;
        }

        giveLifesToUser(-1);

        showTimer = true;

        //setLifeDate ();

        //LocalNotification*******De cuando se queda sin vidas y gana 1 vida
        if (tempUsr.playerLifes == 0)
        {
            int currentLevel = tempUsr.levels.Count;

            life1NotificationID = (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                villavanilla.Notifications.ERegisteredNotification.LIFE_1,
                MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_LIFE1).Replace("{{level}}", currentLevel.ToString()),
                "Kubera", timeForLifeInMinutes * 60.0);
        }
    }
コード例 #5
0
    public void giveALife(int amount = 1, bool fromGame = false)
    {
        gotALife(amount, fromGame);

        //CancelLocalNotification*******De cuando se queda sin vidas y gana 1 vida
        if (currentUser.playerLifes == 1)
        {
            (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledNotification(life1NotificationID);
        }
    }
コード例 #6
0
        public CCTVSettingPage()
        {
            InitializeComponent();

            ViewModel.SelectDefaultCCTV();

            ViewModel.SettingPage = this as IPage;

            NotiManager = new LocalNotificationManager(NotificationGrid);
        }
コード例 #7
0
    void Awake()
    {
        if (SharedInstance != null)
        {
            GameObject.Destroy(this.gameObject);
            return;
        }

        SharedInstance = this;
    }
コード例 #8
0
 public InAppNotification()
 {
     if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
     {
         _NotificationManager = new UnNotificationManager();
     }
     else
     {
         _LocalNotificationManager = new LocalNotificationManager();
     }
 }
コード例 #9
0
 protected void setFullLifesNotification()
 {
     if (LifesManager.GetInstance() != null)
     {
         if (LifesManager.GetInstance().getTimeToWait() > 5)
         {
             (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                 villavanilla.Notifications.ERegisteredNotification.FULL_LIFES,
                 MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_FULL_LIFES),
                 "Kubera", LifesManager.GetInstance().getTimeToWait());
         }
     }
 }
コード例 #10
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ViewModel.isLoggedin = (bool)e.Parameter;

            if (ViewModel.isLoggedin)
            {
                SimpleIoc.Default.GetInstance <IAsyncNavigationService>().NavigateAsync(typeof(HomeView), "Trending");
            }

            //Listening for Sign In message
            Messenger.Default.Register <User>(this, RecieveSignInMessage);

            notifManager = new LocalNotificationManager(NotificationGrid);
        }
コード例 #11
0
    void OnGUI()
    {
        var SetButtonRect    = new Rect(10, 10, Screen.width - 20, Screen.height / 10);
        var CancelButtonRect = new Rect(10, 20 + Screen.height / 10, Screen.width - 20, Screen.height / 10);

        if (GUI.Button(SetButtonRect, "SetNotification"))
        {
            RegisterNotifications();
        }

        if (GUI.Button(CancelButtonRect, "CancelNotirication"))
        {
            LocalNotificationManager.CancelAllNotification();
        }
    }
コード例 #12
0
    void OnApplicationPause(bool pauseStatus)
    {
        if (pauseStatus && !scheduled)
        {
            setNoPlayingDaysNotifications();

            setFullLifesNotification();
        }
        else if (LocalNotificationManager.GetInstance().currentUserId != null)
        {
            (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(
                villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES);

            scheduled = false;
        }
    }
コード例 #13
0
    public void GetNotificationCallback()
    {
        if (!FrameworkValues.UseLocalNotifications)
        {
            return;
        }

        string callback;

        if (LocalNotificationManager.GetNotificationCallback(out callback))
        {
            callbackText.text         = callback;
            callbackButtonImage.color = Color.green;
        }
        else
        {
            callbackButtonImage.color = Color.red;
        }
    }
コード例 #14
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Instead of having the equivalent of <Frame x:Name="rootFrame" /> at the root of our app, we replace it with the equivalent of the following XAML,
            // Note the order in which rootFrame and notificationGrid are added to rootGrid in the C# code (i.e the latter *after* the former) that places the latter above the former.
            //
            //     <Grid x:Name="rootGrid">
            //         <Frame x:Name="rootFrame" />
            //         <Grid x:Name="notificationGrid" />
            //     </Grid>

            Grid  rootGrid  = Window.Current.Content as Grid;
            Frame rootFrame = rootGrid?.Children.Where((c) => c is Frame).Cast <Frame>().FirstOrDefault();

            if (rootGrid == null)
            {
                rootGrid = new Grid();

                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;

                var notificationGrid = new Grid();
                LocalNotificationManager = new LocalNotificationManager(notificationGrid);

                rootGrid.Children.Add(rootFrame);
                rootGrid.Children.Add(notificationGrid);

                Window.Current.Content = rootGrid;
            }

            if (!e.PrelaunchActivated)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }

                Window.Current.Activate();
            }
        }
コード例 #15
0
        public MainPage(IActivatedEventArgs args)
        {
            this.InitializeComponent();

            var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;

            coreTitleBar.LayoutMetricsChanged += delegate
            {
                AppTitleBar.Height = coreTitleBar.Height;
            };

            // Set a XAML element as title bar
            Window.Current.SetTitleBar(AppTitleBar);

            ViewModel        = new MainViewmodel(args);
            this.DataContext = ViewModel;

            #region registering for messages
            Messenger.Default.Register <LocalNotificationMessageType>(this, RecieveLocalNotificationMessage);
            Messenger.Default.Register(this, delegate(SetHeaderTextMessageType m) { SetHeadertext(m.PageName); });
            Messenger.Default.Register(this, delegate(AdsEnabledMessageType m) { ViewModel.ToggleAdsVisiblity(); });
            Messenger.Default.Register(this, delegate(UpdateUnreadNotificationMessageType m) { ViewModel.UpdateUnreadNotificationIndicator(m.IsUnread); });
            Messenger.Default.Register(this, async delegate(ShowWhatsNewPopupMessageType m) { await ShowWhatsNewPopupVisiblity(); });
            Messenger.Default.Register <User>(this, ViewModel.RecieveSignInMessage);
            #endregion

            notifManager = new LocalNotificationManager(NotificationGrid);

            Loaded      += MainPage_Loaded;
            SizeChanged += MainPage_SizeChanged;

            SimpleIoc.Default.Register <IAsyncNavigationService>(() => { return(new NavigationService(AppFrame)); });
            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            NavigationCacheMode = NavigationCacheMode.Enabled;
        }
コード例 #16
0
ファイル: MainPage.xaml.cs プロジェクト: suwakowww/CodeHub
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            await ViewModel.Initialize(AppFrame);

            if (ViewModel.isLoggedin)
            {
                await SimpleIoc.Default.GetInstance <IAsyncNavigationService>().NavigateAsync(typeof(FeedView), "News Feed");

                await ViewModel.CheckForUnreadNotifications();

                if (WhatsNewDisplayService.IsNewVersion())
                {
                    ViewModel.isLoading = true;
                    WhatsNewPopup.SetVisualOpacity(0);
                    WhatsNewPopup.Visibility = Visibility.Visible;
                    await WhatsNewPopup.StartCompositionFadeScaleAnimationAsync(0, 1, 1.1f, 1, 150, null, 0, EasingFunctionNames.SineEaseInOut);
                }
            }

            notifManager = new LocalNotificationManager(NotificationGrid);

            ConfigureWindowBlur();
            await ConfigureHamburgerMenuBlur();
        }
コード例 #17
0
        public MainPage()
        {
            this.InitializeComponent();

            ViewModel        = new MainViewmodel();
            this.DataContext = ViewModel;

            #region registering for messages
            Messenger.Default.Register <LocalNotificationMessageType>(this, RecieveLocalNotificationMessage);
            Messenger.Default.Register(this, delegate(SetHeaderTextMessageType m) { SetHeadertext(m.PageName); });
            Messenger.Default.Register(this, delegate(AdsEnabledMessageType m) { ViewModel.ToggleAdsVisiblity(); });
            Messenger.Default.Register(this, delegate(HostWindowBlurMessageType m) { ConfigureWindowBlur(); });
            Messenger.Default.Register(this, delegate(UpdateUnreadNotificationMessageType m) { ViewModel.UpdateUnreadNotificationIndicator(m.IsUnread); });
            Messenger.Default.Register(this, delegate(ShowWhatsNewPopupMessageType m) { ShowWhatsNewPopup(); });
            Messenger.Default.Register <User>(this, ViewModel.RecieveSignInMessage);
            #endregion

            notifManager = new LocalNotificationManager(NotificationGrid);

            Loaded      += MainPage_Loaded;
            SizeChanged += MainPage_SizeChanged;

            NavigationCacheMode = NavigationCacheMode.Enabled;
        }
コード例 #18
0
 public GlobalNotificationManager(LocalNotificationManager manager)
 {
     _manager = manager;
 }
コード例 #19
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            SettingDeviceListView.SelectedIndex = -1;

            manager = new LocalNotificationManager(NotificationGrid);
        }
コード例 #20
0
 public MainPage()
 {
     InitializeComponent();
     manager = new LocalNotificationManager(NotificationGrid);
     app     = new JsonApplication.App(manager);
 }
コード例 #21
0
 public void setNotification1Minute()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).scheduleNotificationByName(test1);
 }
コード例 #22
0
 public void setNotification5Minute()
 {
     lastNotification = (LocalNotificationManager.GetInstance() as LocalNotificationManager).scheduleNotificationByName(test2);
 }
コード例 #23
0
 public void cancelLastNotification()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledNotification(lastNotification);
 }
コード例 #24
0
 public void cancelAll5MinsNotifications()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(test2);
 }
コード例 #25
0
 void RegisterNotifications()
 {
     LocalNotificationManager.SetNotification("hogehoge is called", 10, "hogehoge");
     LocalNotificationManager.SetNotification("hogehoge is called", 5, "hogehoge");
 }
コード例 #26
0
 public void cancelAllNotifications()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelAllNotificationsForCurrentUser();
 }
コード例 #27
0
 void Start()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(
         villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES);
 }