Example #1
0
        private void CurrentViewModel_PackTerminated(object sender, SimpleMvvmToolkit.NotificationEventArgs e)
        {
            EasyTracker.GetTracker().SendEvent("game_event", "pack_terminated", this.CurrentViewModel.Pack.Title, this.CurrentViewModel.Pack.Id);

            // We show the "packterminated popup" app info
            messagePackTerminatedPrompt = MessagePromptHelper.GetNewMessagePromptWithNoTitleAndWhiteStyle();
            messagePackTerminatedPrompt.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            messagePackTerminatedPrompt.VerticalAlignment        = System.Windows.VerticalAlignment.Center;

            var body = new EndPackPopupContentControl();

            body.SetNbPointsOnMessage(this.CurrentViewModel.Pack.PossiblePoints);
            Button ok    = body.OkButton;
            Button packs = body.PacksButton;

            ok.Click    += ((bt, ev) => { messagePackTerminatedPrompt.Hide(); });
            packs.Click += ((bt, ev) => { this.CurrentViewModel.NavigateToPacksListPage(true); messagePackTerminatedPrompt.Hide(); });
            //  Prompt if sure of reinit
            messagePackTerminatedPrompt.ActionPopUpButtons.Clear();
            messagePackTerminatedPrompt.Body = body;
            messagePackTerminatedPrompt.Show();
        }
Example #2
0
        private void CreateRootFrame()
        {
            RootFrame = Window.Current.Content as Frame;

            if (RootFrame != null)
            {
                return;
            }

            DispatcherHelper.Initialize();

            Locator.AppVersionHelper.OnLaunched();
            EasyTracker.GetTracker().AppVersion = Locator.AppVersionHelper.CurrentVersion
                                                  + (IsProduction ? string.Empty : "-beta");

            Current.DebugSettings.EnableFrameRateCounter = Locator.AppSettingsHelper.Read <bool>("FrameRateCounter");
            Current.DebugSettings.EnableRedrawRegions    = Locator.AppSettingsHelper.Read <bool>("RedrawRegions");

            RootFrame = new Frame {
                Style = Resources["AppFrame"] as Style
            };
            Window.Current.Content = RootFrame;
        }
Example #3
0
        public void SendEvent(string category, string action, string label, int value = 0)
        {
            if (category == null)
            {
                throw new ArgumentNullException("category");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            if (!IsOptOut)
            {
                EasyTracker.GetTracker().SendEvent(category, action, label, value);
            }

            _environmentService.WriteConsoleLine(
                "GA: Send Event - category:{0}, action:{1}, label:{2}, value:{3}",
                category,
                action,
                label,
                value);
        }
Example #4
0
 private void BorderSoundOffToOn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     (sender as Border).Background          = originalBackground;
     AppSettings.Instance.SoundOnOffSetting = true;
     EasyTracker.GetTracker().SendEvent("ui_action", "settings", "sound", 1);
 }
Example #5
0
        public async Task DoTheGenerateWin2DTask()
        {
            //Get current color
            Color c = new Color
            {
                A = (byte)BackgroundVm.ColorBackgroundVm.A,
                R = (byte)BackgroundVm.ColorBackgroundVm.R,
                G = (byte)BackgroundVm.ColorBackgroundVm.G,
                B = (byte)BackgroundVm.ColorBackgroundVm.B
            };

            RecW = UserBitmap.SizeInPixels.Width * ZoomF;
            RecH = UserBitmap.SizeInPixels.Height * ZoomF;

            if (IsManualAdjustSquareImage)
            {
                SRecW = UserBitmap.SizeInPixels.Width * SZoomF;
                SRecH = UserBitmap.SizeInPixels.Height * SZoomF;
            }
            else
            {
                SRecW = RecW;
                SRecH = RecH;
            }

            //Get save mode
            int saveMode = SettingManager.GetSaveMode();

            if (saveMode == 0 || saveMode == 1)
            {
                //Default
                SettingManager.SetSaveMode(2);
                saveMode = 2;
            }

            if (saveMode == 3)
            {
                //Check if folder is deleted
                try
                {
                    string token = SettingManager.GetSaveToken();
                    StaticData.SaveFolder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(token);
                }
                catch
                {
                    //Set default save mode
                    SettingManager.SetSaveMode(2);
                    saveMode = 2;

                    MessageDialog msg = new MessageDialog("Your selected folder has been deleted or moved", "Warning");
                    await msg.ShowAsync();
                }
            }

            switch (saveMode)
            {
            case 1:
                //Save in the same folder. Not working
                StaticData.SaveFolder = await File.GetParentAsync();

                break;

            case 2:
                //Choose where to save
                FolderPicker folderPicker = new FolderPicker
                {
                    SuggestedStartLocation = PickerLocationId.PicturesLibrary
                };
                folderPicker.FileTypeFilter.Add(".jpeg");
                folderPicker.FileTypeFilter.Add(".jpg");
                folderPicker.FileTypeFilter.Add(".png");
                folderPicker.FileTypeFilter.Add(".bmp");
                folderPicker.FileTypeFilter.Add(".tiff");
                folderPicker.FileTypeFilter.Add(".gif");
                StaticData.SaveFolder = await folderPicker.PickSingleFolderAsync();

                if (StaticData.SaveFolder == null)
                {
                    MessageDialog msg = new MessageDialog("Please choose a folder to save");
                    await msg.ShowAsync();

                    IsShowingProgress = false;
                    return;
                }
                break;

            case 3:
                //Save in specific folder
                string token = SettingManager.GetSaveToken();
                StaticData.SaveFolder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(token);

                break;
            }

            foreach (var platform in StaticData.StartVm.Data.PlatformList.Where(platform => platform.IsEnabled))
            {
                //Send google analytics
                EasyTracker.GetTracker().SendEvent("platform", platform.Name, null, 0);

                //Create folder
                var platformFolder = await StaticData.SaveFolder.CreateFolderAsync(platform.Name,
                                                                                   CreationCollisionOption.OpenIfExists);

                await RenderPlatform(platform, c, platformFolder);
            }
            if (StaticData.StartVm.CustomData != null && StaticData.StartVm.CustomData.PlatformList != null)
            {
                foreach (
                    var platform in StaticData.StartVm.CustomData.PlatformList.Where(platform => platform.IsEnabled))
                {
                    //Send google analytics
                    EasyTracker.GetTracker().SendEvent("platform", platform.Name, null, 0);

                    //Create folder
                    var platformFolder =
                        await
                        StaticData.SaveFolder.CreateFolderAsync(platform.Name,
                                                                CreationCollisionOption.OpenIfExists);

                    await RenderPlatform(platform, c, platformFolder);
                }
            }

            IsShowingProgress = false;
        }
Example #6
0
 private void CurrentViewModel_ClosedAnswer(object sender, SimpleMvvmToolkit.NotificationEventArgs e)
 {
     EasyTracker.GetTracker().SendEvent("game_event", "closed_answer", this.CurrentViewModel.SelectedMedia.Title, this.CurrentViewModel.SelectedMedia.Id);
 }
Example #7
0
 protected override void OnStart()
 {
     base.OnStart();
     EasyTracker.GetInstance(this).ActivityStart(this);
 }
Example #8
0
        private async void GetDirectLink(string link)
        {
            HttpClient httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.IfModifiedSince = new DateTimeOffset?(DateTimeOffset.get_Now());
            if (PlayVideo.ChanelPlayer.typeChannel.EndsWith("TrucTiep"))
            {
                if (this._countLink > 0 && !link.Contains("m3u8"))
                {
                    string stringAsync = await httpClient.GetStringAsync(string.Concat("http://winphonevn.com/server/getlinkbongda.php?url=", link));

                    link = stringAsync;
                }
                this._countLink = this._countLink + 1;
            }
            this.Player.Source = null;
            string[] strArray = null;
            string   str      = "";

            this.Load.set_Visibility(0);
            if (link.Contains("!"))
            {
                strArray = link.Split(new char[] { '!' });
            }
            try
            {
                if (strArray != null)
                {
                    str = await httpClient.GetStringAsync(strArray[0]);
                }
                if (link.Contains("fptlive"))
                {
                    string str1     = link;
                    char[] chrArray = new char[] { '/' };
                    string str2     = str1.Split(chrArray)[1];
                    httpClient = new HttpClient();
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("id", str2);
                    dictionary.Add("quality", "3");
                    dictionary.Add("mobile", "web");
                    dictionary.Add("type", "newchannel");
                    FormUrlEncodedContent formUrlEncodedContent = new FormUrlEncodedContent(dictionary);
                    HttpRequestMessage    httpRequestMessage    = new HttpRequestMessage()
                    {
                        Method     = HttpMethod.Post,
                        RequestUri = new Uri("http://fptplay.net/show/getlinklivetv", 1),
                        Content    = formUrlEncodedContent
                    };
                    HttpRequestMessage uri = httpRequestMessage;
                    uri.Headers.Referrer = new Uri("http://fptplay.net/");
                    uri.Headers.Add("X-Requested-With", "XMLHttpRequest");
                    HttpResponseMessage httpResponseMessage = await httpClient.SendAsync(uri, HttpCompletionOption.ResponseContentRead);

                    string str3 = await httpResponseMessage.Content.ReadAsStringAsync();

                    if (str3 != null && str3.get_Length() > 0)
                    {
                        string item = (string)JObject.Parse(str3)["stream"];
                        if (item.get_Length() > 0)
                        {
                            this._str = item;
                        }
                    }
                }
                else if (strArray != null)
                {
                    Match match = (new Regex(strArray[1], 9)).Match(str);
                    if (match.get_Success() && match.get_Groups().get_Item(1).get_Value().StartsWith("http"))
                    {
                        this._str = HttpUtility.UrlDecode(match.get_Groups().get_Item(1).get_Value());
                    }
                }
                else if (link.Contains("app.101vn"))
                {
                    Dictionary <string, string> dictionary1 = new Dictionary <string, string>();
                    dictionary1.Add("talachua", "101vn");
                    dictionary1.Add("package", "duahau3");
                    dictionary1.Add("version", "10");
                    FormUrlEncodedContent formUrlEncodedContent1 = new FormUrlEncodedContent(dictionary1);
                    HttpResponseMessage   httpResponseMessage1   = await httpClient.PostAsync(link, formUrlEncodedContent1);

                    PlayVideo playVideo = this;
                    string    str4      = playVideo._str;
                    playVideo._str = await httpResponseMessage1.Content.ReadAsStringAsync();

                    playVideo = null;
                }
                else if (link.Contains("notfreeplus"))
                {
                    string str5 = await(new WebClient()).DownloadStringTaskAsync(new Uri("https://api.vtvplus.vn/pro/index.php/api/v1/channel/stream/88/?ip_address=0&[email protected]&type_device=android&type_network=wifi&app_name=VTVPlus"));
                    str = str5;
                    ObjectPlus objectPlu = JsonConvert.DeserializeObject <ObjectPlus>(str);
                    this._str = objectPlu.Data.get_Item(0).Url;
                }
                else if (!link.Contains("notfreemtv"))
                {
                    this._str = link;
                }
                else
                {
                    string[] strArray1 = link.Split(new char[] { '=' });
                    Random   random    = new Random();
                    Dictionary <string, string> dictionary2 = new Dictionary <string, string>();
                    str = await httpClient.GetStringAsync("http://api.mytvnet.vn//getToken");

                    JObject jObjects = JObject.Parse(str);
                    if (jObjects == null || jObjects["tid"] == null)
                    {
                        return;
                    }
                    else
                    {
                        long     num = Convert.ToInt64((new Fc()).DeCodeTid(jObjects["tid"].ToString()));
                        DateTime now = DateTime.get_Now();
                        Fc       fc  = new Fc();
                        dictionary2.Add("tid", fc.GetTid(num, now));
                        Dictionary <string, string> dictionary3 = dictionary2;
                        int num1 = random.Next(1, 10);
                        dictionary3.Add("device_type", num1.ToString());
                        Dictionary <string, string> dictionary4 = dictionary2;
                        num1 = random.Next(1, 99);
                        dictionary4.Add("app_v", num1.ToString());
                        dictionary2.Add("lang", "vn");
                        dictionary2.Add("channel_id", strArray1[1]);
                        dictionary2.Add("mf_code", strArray1[2]);
                        Dictionary <string, string> dictionary5 = dictionary2;
                        num1 = random.Next(1, 10);
                        dictionary5.Add("profile", num1.ToString());
                        Dictionary <string, string> dictionary6 = dictionary2;
                        num1 = random.Next(1, 100000);
                        dictionary6.Add("member_id", num1.ToString());
                        Dictionary <string, string> dictionary7 = dictionary2;
                        num1 = random.Next(1, 1000000);
                        dictionary7.Add("manufacturer_id", num1.ToString());
                        Dictionary <string, string> dictionary8 = dictionary2;
                        num1 = random.Next(0, 100000);
                        dictionary8.Add("device_id", num1.ToString());
                        FormUrlEncodedContent formUrlEncodedContent2 = new FormUrlEncodedContent(dictionary2);
                        HttpResponseMessage   httpResponseMessage2   = await httpClient.PostAsync("http://ott.mytvnet.vn/v5/channel/mobile/url", formUrlEncodedContent2);

                        string str6 = await httpResponseMessage2.Content.ReadAsStringAsync();

                        jObjects = JObject.Parse(str6);
                        if (jObjects["result"].ToString() == "-1")
                        {
                            Dictionary <string, string> dictionary9 = new Dictionary <string, string>();
                            dictionary9.Add("tid", fc.GetTid(num, now));
                            num1 = random.Next(1, 10);
                            dictionary9.Add("device_type", num1.ToString());
                            num1 = random.Next(1, 99);
                            dictionary9.Add("app_v", num1.ToString());
                            dictionary9.Add("lang", "vn");
                            dictionary9.Add("channel_id", strArray1[1]);
                            dictionary9.Add("mf_code", strArray1[2]);
                            num1 = random.Next(1, 10);
                            dictionary9.Add("profile", num1.ToString());
                            num1 = random.Next(1, 100000);
                            dictionary9.Add("member_id", num1.ToString());
                            num1 = random.Next(1, 1000000);
                            dictionary9.Add("manufacturer_id", num1.ToString());
                            num1 = random.Next(1, 100000);
                            dictionary9.Add("device_id", num1.ToString());
                            dictionary2            = dictionary9;
                            formUrlEncodedContent2 = new FormUrlEncodedContent(dictionary2);
                            HttpResponseMessage httpResponseMessage3 = await httpClient.PostAsync("http://api.mytvnet.vn/v5/channel/mobile/url", formUrlEncodedContent2);

                            string str7 = await httpResponseMessage3.Content.ReadAsStringAsync();

                            jObjects  = JObject.Parse(str7);
                            this._str = jObjects["data"]["url"].ToString();
                        }
                        else
                        {
                            this._str = jObjects["data"]["url"].ToString();
                        }
                        strArray1   = null;
                        random      = null;
                        dictionary2 = null;
                        fc          = null;
                    }
                }
                this.Player.Source = new Uri(this._str.Trim(), 0);
                this.Player.Play();
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                EasyTracker.GetTracker().SendException(string.Concat(this._str, " :", exception.get_Message()), false);
                this.Player.Source = new Uri(this._str, 0);
                this.Player.Play();
                this.Load.set_Visibility(1);
            }
            this.Load.set_Visibility(1);
        }
Example #9
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (bc.Game == null)
            {
                var games = await GameDefinitionSource.LoadDataAsync();

                var gameDefinition = games.FirstOrDefault(g => g.UniqueId == (string)e.Parameter);
                if (gameDefinition == null)
                {
                    return;
                }

                bc.Build(gameDefinition);

                bc.Game.TileMoved += GameOnTileMoved;
                bc.NewHighScore   += GameOnNewHighScore;
                bc.NewAchievement += GameOnNewAchievement;
                bc.Game.GameWon   += GameOnGameWon;
                bc.Game.GameOver  += GameOnGameOver;
            }

            if (TotalScore == 0)
            {
                bc.LoadData();
                TotalScore = bc.Game.Score;
                BestScore  = bc.Game.GameData.BestScore;
                Rank       = BinaryGame.GetRank(bc.Game.GameData.BestPiece);
            }
            Rank = BinaryGame.GetRank(bc.Game.GameData.BestPiece);

#if GOOGLE_ANALYTICS
            EasyTracker.GetTracker().SendView("Main" + bc.Game.GameDefinition.UniqueId);
#endif

            if (TotalScore == 0)
            {
                PlayGrid.AnimateAsync(new FadeInAnimation {
                    Delay = 0.3
                });
                PlayButton.AnimateAsync(new BounceInUpAnimation {
                    Delay = 0.4
                });

                PlayGrid.IsHitTestVisible   = true;
                PlayButton.IsHitTestVisible = true;
            }
            else
            {
                PlayGrid.Opacity            = 0;
                PlayGrid.IsHitTestVisible   = false;
                PlayButton.Opacity          = 0;
                PlayButton.IsHitTestVisible = false;
            }

            DataTransferManager.GetForCurrentView().DataRequested += DataTransferManagerOnDataRequested;

            Window.Current.CoreWindow.KeyUp  += CoreWindow_KeyUp;
            Window.Current.VisibilityChanged += OnVisibilityChanged;
        }