Пример #1
0
        public vwHomePage(MainPage pmainPage, Intent screenshareIntent)
        {
            ScreenshareIntent = screenshareIntent;
#endif

            oMainPage = pmainPage;
            InitializeComponent();
            NavigationPage.SetBackButtonTitle(this, "");
            NavigationPage.SetHasNavigationBar(this, false);
            BindingContext = _HomeViewModel = new HomeViewModel(this);

            InitFormulario();
            this.cpFeeds = DependencyService.Get <ICPFeeds>();
            //this.oCometChatService = new CometChatService(this);
            this.oInternetService = new InternetService(this);
            Settings.bClicButton  = false;
            _loginPopup           = new PopupLoad();

            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += async(s, e) =>
            {
                // handle the tap

                oMainPage.IsPresented = true;
                //Settings.COVIDFolio = "";
                await Navigation.PopAsync();
            };
            tabMenu.GestureRecognizers.Add(tapGestureRecognizer);

#if __ANDROID__
            statusBarHeigth = new Thickness(0, 40, 0, 0);
            mainMarginTop   = 168;
            Console.WriteLine("__ANDROID__ is defined");
#endif
        }
        public void ShouldBeAbleToSetLength()
        {
            const int expected = 9;
            var       service  = new InternetService(new DataManager(), new RandomNumberGenerator());

            service.GetPassword(expected).Length.ShouldBe(expected);
        }
Пример #3
0
        public PaymentModel(PaymentView page, List <ProductItemDTO> items)
        {
#endif
            this.view       = page;
            internetService = new InternetService(page);
            BuildDataSource(items);
        }
Пример #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            MainViewModel mainViewModel = MainViewModel.MainViewModelInstance;
            MainWindow    mainWindow    = new MainWindow();

            mainViewModel.View = mainWindow;

            if (!mainWindow.IsLoaded)
            {
                mainWindow.Show();
            }

            base.OnStartup(e);

            if (!InternetService.IsInternetConnected())
            {
                MessageBox.Show("Sorry! You do NOT have internet connection! Please, try again later!",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                Current.Shutdown();
            }

            //Login();
            SynchronizeWithServiceDB();
        }
Пример #5
0
        public LoginViewModel(Page page, Intent screenshareIntent) : base(page)
        {
            ScreenshareIntent = screenshareIntent;
            ovwPopupTerminos  = new vwPopupTerminos(ScreenshareIntent);
#endif

            if (Device.RuntimePlatform == Device.iOS)
            {
                ShowLogo = true;
            }

            this.cpFeeds = DependencyService.Get <ICPFeeds>();
            Settings.bChatInicializado = false;
            oInternetService           = new InternetService(page);

            // ejecutamos la verificacion de la tienda.
            // cuando se crea el modelo.
            //Task.Run(async () => {
            //    IsBusy = true;
            //    if(await oInternetService.VerificaInternet())
            //    {
            //        await VerifyStoreVersion();
            //    }
            //    IsBusy = false;
            //});
        }
Пример #6
0
 public PromotionalCodeView(InternetService internetService, double Total)
 {
     InitializeComponent();
     BindingContext       = this;
     this.internetService = internetService;
     this.Total           = Total;
 }
Пример #7
0
        public async Task <List <PlaylistFile> > GetMorePlaylist(CancellationToken token, uint offset)
        {
            if (InternetService.Connected)
            {
                try
                {
                    IList <IPlaylistFile> playlistsVk;
                    List <PlaylistFile>   playlists = new List <PlaylistFile>();
                    try
                    {
                        IsLoading = true;
                        Changed("IsLoading");
                        playlistsVk = await Library.Playlists(20, Playlists.Count);

                        foreach (var playlist in playlistsVk)
                        {
                            playlists.Add(await Services.VKontakte.PlaylistsService.ConvertToPlaylistFile(playlist));
                        }
                    }
                    catch (Flurl.Http.FlurlHttpException)
                    {
                        IsLoading = false;
                        Changed("IsLoading");
                        hasMorePlaylists = false;
                        await ContentDialogService.Show(new ErrorConnectContentDialog());

                        InternetService.GoToOfflineMode();
                    }

                    if (playlists.Count == 0)
                    {
                        VisibilityNoPlaylists = Visibility.Visible;
                        Changed("VisibilityNoPlaylists");
                    }

                    if (playlists.Count < 20)
                    {
                        hasMorePlaylists = false;
                    }
                    IsLoading = false;
                    Changed("IsLoading");
                    return(playlists);
                }catch (Exception e)
                {
                    IsLoading = false;
                    Changed("IsLoading");
                    await ContentDialogService.Show(new ExceptionDialog("Неизвестная ошибка при получении плейлистов", "Мы не смогли получить информацию о Ваших плейлистах", e));

                    return(new List <PlaylistFile>());
                }
            }
            else
            {
                IsLoading = false;
                Changed("IsLoading");
                InternetService.GoToOfflineMode();
                return(new List <PlaylistFile>());
            }
        }
        public void ShouldBeAbleToMakeLower()
        {
            var service  = new InternetService(new DataManager(), new RandomNumberGenerator());
            var actual   = service.GetPassword(casing: "lower");
            var expected = actual.ToLower();

            actual.ShouldMatch(expected);
        }
Пример #9
0
        public MainFrameView()
        {
            this.InitializeComponent();
            Window.Current.SetTitleBar(TitleBar);
            StaticContent.PlayerMenuFrame          = PlayerMenuFrame;
            StaticContent.NavigationContentService = new Services.NavigationService()
            {
                RootFrame = ContentFrame
            };
            PlayerMenuFrame.Navigate(typeof(PlayerMenuView));
            PlayerBottomFrame.Navigate(typeof(MiniPlayerView));
            if (StaticContent.IsPro)
            {
                AdsPanel.Height = new GridLength(0, GridUnitType.Pixel);
            }
            else
            {
                BottomAdsFrame.Navigate(typeof(AdsBottomPanelView));
            }

            Windows.UI.ViewManagement.ApplicationView appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
            appView.SetPreferredMinSize(new Size(600, 800));

            this.SizeChanged += MainPage_SizeChanged;

            var timer2 = new DispatcherTimer();

            _timer2         = timer2;
            timer2.Interval = TimeSpan.FromSeconds(80);
            timer2.Tick    += Timer2_Tick;
            timer2.Start();

            if (!StaticContent.Config.IsRateMe & StaticContent.IsAuth)
            {
                var timer = new DispatcherTimer();
                this._timer    = timer;
                timer.Interval = TimeSpan.FromSeconds(60);
                timer.Tick    += Timer_Tick;
                timer.Start();
            }
            if (StaticContent.IsAuth)
            {
                if (InternetService.CheckConnection())
                {
                    StaticContent.NavigationContentService.Go(typeof(VKontakte.HomeView));
                }
                else
                {
                    InternetService.GoToOfflineMode();
                    //StaticContent.NavigationContentService.Go(typeof(HomeLocalView));
                }
            }
            else
            {
                StaticContent.NavigationContentService.Go(typeof(HomeLocalView));
            }
        }
Пример #10
0
        public medicSpecialityModel(MedicSpecialityView page) : base(page)
        {
#endif
            ViewContext      = page;
            oInternetService = new InternetService(page);

            this.cpFeeds     = DependencyService.Get <ICPFeeds>();
            oInternetService = new InternetService(page);
        }
Пример #11
0
        public MedicDirectoryModel(MeditocDirectoryView page) : base(page)
        {
#endif
            ViewContext      = page;
            oInternetService = new InternetService(page);

            this.cpFeeds     = DependencyService.Get <ICPFeeds>();
            oInternetService = new InternetService(page);
        }
        public void ShouldReturnVpIPAddress()
        {
            _mockRandomGenerator
            .Setup(x => x.GetRandomIntegerBetween(0, 255))
            .Returns(255);
            var service = new InternetService(_dataManager.Object, _mockRandomGenerator.Object);
            var ip      = service.GetIPV4();

            ip.ShouldBe("255.255.255");
        }
Пример #13
0
        public async Task <List <AudioFile> > GetMoreAudio(CancellationToken token, uint offset)
        {
            if (InternetService.Connected)
            {
                try
                {
                    if (firstLoading)
                    {
                        IsLoading = true;
                        Changed("IsLoading");
                    }
                    IList <IAudioFile> tracks = new List <IAudioFile>();
                    List <AudioFile>   music  = new List <AudioFile>();
                    try
                    {
                        tracks = await Popular.Tracks(20, Tracks.Count);

                        music = await MusicService.ConvertToAudioFile(tracks);
                    }
                    catch (Flurl.Http.FlurlHttpException)
                    {
                        music          = new List <AudioFile>();
                        hasMoreLoading = false;

                        await ContentDialogService.Show(new ErrorConnectContentDialog());

                        InternetService.GoToOfflineMode();
                    }

                    if (music.Count < 20)
                    {
                        hasMoreLoading = false;
                    }

                    firstLoading = false;

                    IsLoading = false;
                    Changed("IsLoading");
                    return(music);
                }catch (Exception e)
                {
                    await ContentDialogService.Show(new ExceptionDialog("Неизвестная ошибка при получении списка популярного", "Мы не смогли получить нужную нам информацию о треках", e));

                    return(new List <AudioFile>());
                }
            }
            else
            {
                hasMoreLoading = false;
                InternetService.GoToOfflineMode();
                return(new List <AudioFile>());
            }
        }
Пример #14
0
        public HomeSwitchView()
        {
            model = new HomeSwitchModel(this);
#endif
            InitializeComponent();
            BindingContext = model;
            //stkActivity.SetBinding(IsVisibleProperty, "IsBusy");
            //iaIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            _InternetService  = new InternetService(this);
            versionLabel.Text = string.Format(" V{0}", DependencyService.Get <IAppInfo>().GetVersion());
            NavigationPage.SetBackButtonTitle(this, "");
        }
Пример #15
0
        private void LoadRates()
        {
            if (Rates != null)
            {
                return;
            }
            IsRunning = true;
            Result    = Languajes.MsgLoadingRates;

            if (InternetService.CheckConnection().IsSuccess)
            {
                LoadDataFromApi();
            }
            else
            {
                LoadLocalData();
            }
        }
Пример #16
0
        //
        public void Configure()
        {
            oInternetService = new InternetService(mainPage);

            // obtenemos el numero de telefono.
            PhoneNumber = "";
            if (!string.IsNullOrEmpty(Settings.sUserNameLogin))
            {
                List <string> split_login = Settings.sUserNameLogin
                                            .Split("_")
                                            .ToList();

                if (split_login.Count() > 1)
                {
                    PhoneNumber = split_login[1];
                }
            }
        }
Пример #17
0
        public async Task LoadingInfo()
        {
            try
            {
                var user = await Fooxboy.MusicX.Core.VKontakte.Users.Info.CurrentUser();

                NameUser  = $"{user.FirstName} {user.LastName}";
                ImageUser = await ImagesService.AvatarUser(user.PhotoUser);

                Changed("NameUser");
                Changed("ImageUser");
            }catch (Flurl.Http.FlurlHttpException)
            {
                await ContentDialogService.Show(new ErrorConnectContentDialog());

                InternetService.GoToOfflineMode();
            }catch (Exception e)
            {
                await ContentDialogService.Show(new ExceptionDialog("Невозможно получить информацию о вашем аккаунте", "", e));
            }
        }
        public void ShouldReturnGetInvalidExampleEmailAddress()
        {
            var service = new InternetService(new DataManager(), new RandomNumberGenerator());

            service.GetInvalidEmailAddress().ShouldContain("@example.com");
        }
        public void ShouldReturnRandomPassword()
        {
            var service = new InternetService(new DataManager(), new RandomNumberGenerator());

            service.GetPassword().Length.ShouldBeGreaterThan(0);
        }
        public void ShouldHaveDefaultLengthOfEight()
        {
            var service = new InternetService(new DataManager(), new RandomNumberGenerator());

            service.GetPassword().Length.ShouldBe(8);
        }
Пример #21
0
        public async static Task PlayMusic(AudioFile audioFile, int typePlay, PlaylistFile playlistPlay = null)
        {
            if (StaticContent.Config.StreamMusic)
            {
                await MusicX.Core.VKontakte.Music.Library.StreamToStatus(audioFile.Id, audioFile.OwnerId);
            }
            try
            {
                //type play:
                //1 - проигрования из списка треков
                //2 - проигрование трека из плейлиста
                StaticContent.AudioService.Seek(TimeSpan.Zero);
                var playlistNowPlay = new PlaylistFile()
                {
                    Artist      = "Music X",
                    Cover       = "ms-appx:///Assets/Images/now.png",
                    Id          = 1000,
                    Name        = "Сейчас играет",
                    TracksFiles = new List <AudioFile>(),
                    IsLocal     = false
                };


                if (typePlay == 1)
                {
                    foreach (var trackMusic in StaticContent.MusicVKontakte)
                    {
                        playlistNowPlay.TracksFiles.Add(trackMusic);
                    }
                    var index = playlistNowPlay.TracksFiles.IndexOf(playlistNowPlay.TracksFiles.Single(t => t.Id == audioFile.Id));

                    if (index != 0)
                    {
                        StaticContent.AudioService.SetCurrentPlaylist(playlistNowPlay.ToAudioPlaylist(), false);
                        StaticContent.AudioService.CurrentPlaylist.CurrentItem = audioFile;
                    }
                    else
                    {
                        StaticContent.AudioService.SetCurrentPlaylist(playlistNowPlay.ToAudioPlaylist(), true);
                        StaticContent.AudioService.SwitchNext();
                    }

                    StaticContent.NowPlayPlaylist = playlistNowPlay;
                }
                else if (typePlay == 2)
                {
                    StaticContent.NowPlayPlaylist = playlistPlay;
                    playlistNowPlay.TracksFiles   = playlistPlay.TracksFiles;
                    playlistNowPlay.Tracks        = playlistPlay.Tracks;

                    var index = playlistPlay.TracksFiles.IndexOf(playlistPlay.TracksFiles.Single(t => t.Id == audioFile.Id));

                    if (index != 0)
                    {
                        StaticContent.AudioService.SetCurrentPlaylist(playlistPlay.ToAudioPlaylist(), false);
                        StaticContent.AudioService.CurrentPlaylist.CurrentItem = audioFile;
                    }
                    else
                    {
                        StaticContent.AudioService.SetCurrentPlaylist(playlistPlay.ToAudioPlaylist(), true);
                        StaticContent.AudioService.SwitchNext();
                    }
                }

                if (!(StaticContent.PlaylistsVKontakte.Any(p => p.Id == 1000)))
                {
                    StaticContent.PlaylistsVKontakte.Insert(0, playlistNowPlay);
                }
            }catch (Flurl.Http.FlurlHttpException)
            {
                InternetService.GoToOfflineMode();
            } catch (HttpRequestException)
            {
                InternetService.GoToOfflineMode();
            }catch (Exception e)
            {
                await ContentDialogService.Show(new ExceptionDialog("Ошибка при воспроизведении трека", "Произошла неизвестная ошибка.", e));
            }
        }
Пример #22
0
        public static async Task <PromotionalCodeResult> Show(IPopupNavigation navigator, InternetService internetService, double Total)
        {
            var view = new PromotionalCodeView(internetService, Total);
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(result);
        }
Пример #23
0
 public COVIDSurveyViewModel(vwCOVIDSurvey context)
 {
     viewContext      = context;
     oInternetService = new InternetService(context);
 }
Пример #24
0
        /// <summary>
        /// Инициализирует одноэлементный объект приложения. Это первая выполняемая строка разрабатываемого
        /// кода, поэтому она является логическим эквивалентом main() или WinMain().
        /// </summary>
        public App()
        {
            var settings = ApplicationData.Current.LocalSettings;

            InternetService.Init();

            try
            {
                var a = (int)settings.Values["CountDownloads"];
            }
            catch
            {
                settings.Values["CountDownloads"] = 0;
            }
            try
            {
                Windows.Storage.ApplicationDataCompositeValue composite =
                    (Windows.Storage.ApplicationDataCompositeValue)settings.Values["themeApp"];

                Windows.Storage.ApplicationDataCompositeValue composite2 =
                    (Windows.Storage.ApplicationDataCompositeValue)settings.Values["IsPro"];

                if (composite == null)
                {
                    this.RequestedTheme = ApplicationTheme.Light;
                }
                else
                {
                    var theme = (int)settings.Values["themeApp"];
                    if (theme == 0)
                    {
                        this.RequestedTheme = ApplicationTheme.Light;
                    }
                    else
                    {
                        this.RequestedTheme = ApplicationTheme.Dark;
                    }
                }

                if (composite2 == null)
                {
                    StaticContent.IsPro = false;
                }
                else
                {
                    var IsPro = (bool)settings.Values["IsPro"];
                    StaticContent.IsPro = IsPro;
                }
            }
            catch
            {
                var theme = (int)settings.Values["themeApp"];
                if (theme == 0)
                {
                    this.RequestedTheme = ApplicationTheme.Light;
                }
                else
                {
                    this.RequestedTheme = ApplicationTheme.Dark;
                }

                try
                {
                    var IsPro = (bool)settings.Values["IsPro"];
                    StaticContent.IsPro = IsPro;
                } catch
                {
                    StaticContent.IsPro = false;
                }
            }



            Log.Run();
            Log.Trace("Инициализация объекта приложения");
            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }
        public ContractMembershipModel(ContractMembershipView page) : base(page)
        {
#endif
            ViewContext      = page;
            oInternetService = new InternetService(page);
        }
        public UniqueOrientationModel(UniqueOrientationView page) : base(page)
        {
#endif
            ViewContext      = page;
            oInternetService = new InternetService(page);
        }
        public void ShouldReturnStringIncludingSeparators()
        {
            var service = new InternetService(new DataManager(), new RandomNumberGenerator());

            service.GetUserName("--").ShouldContain("--");
        }
Пример #28
0
 private Internet()
 {
     _service = new InternetService(new DataManager(), new RandomNumberGenerator());
 }
Пример #29
0
        public TrackControl()
        {
            this.InitializeComponent();

            PlayCommand = new RelayCommand(async() =>
            {
                if (Track.IsLocal)
                {
                    await PlayMusicService.PlayMusicForLibrary(Track, 1);
                }
                else
                {
                    await MusicService.PlayMusic(Track, 1);
                }
            });



            DeleteCommand = new RelayCommand(async() =>
            {
                try
                {
                    if (Track.IsLocal)
                    {
                        StaticContent.Music.Remove(Track);
                        AudioFile trackByPlaylist = null;
                        if (Track.PlaylistId != 0)
                        {
                            var playlist    = await Services.PlaylistsService.GetById(Track.PlaylistId);
                            trackByPlaylist = playlist.TracksFiles.Single(t => t.SourceString == Track.SourceString);
                            playlist.TracksFiles.Remove(trackByPlaylist);
                            await Services.PlaylistsService.SavePlaylist(playlist);
                        }
                        if (trackByPlaylist != null)
                        {
                            if (trackByPlaylist.Source == null)
                            {
                                trackByPlaylist.Source = await StorageFile.GetFileFromPathAsync(Track.SourceString);
                            }
                            await trackByPlaylist.Source.DeleteAsync();
                        }
                        else
                        {
                            if (Track.Source == null)
                            {
                                Track.Source = await StorageFile.GetFileFromPathAsync(Track.SourceString);
                            }
                            await Track.Source.DeleteAsync();
                        }

                        await MusicFilesService.UpdateMusicCollection();
                    }
                    else
                    {
                        //TODO: удаление трека ебаный врот
                    }
                }catch (Exception e)
                {
                    await ContentDialogService.Show(new ExceptionDialog("Невозможно удалить этот трек", "Возможно, этот трек был уже удален.", e));
                }
            });

            AddToFavoriteCommand = new RelayCommand(async() =>
            {
                try
                {
                    if (Track.IsLocal)
                    {
                        var playlist = await Services.PlaylistsService.GetById(2);
                        if (playlist.TracksFiles.Any(t => t.SourceString == Track.SourceString))
                        {
                            var dialog = new MessageDialog("Данный трек уже добавлен в избранное", "Ошибка при добавлении в избранное");
                            await dialog.ShowAsync();
                        }
                        else
                        {
                            Like.Visibility    = Visibility.Collapsed;
                            LikeAdd.Visibility = Visibility.Visible;
                            Track.IsFavorite   = true;
                            playlist.TracksFiles.Add(Track);
                            await Services.PlaylistsService.SavePlaylist(playlist);
                        }
                    }
                    else
                    {
                    }
                }catch (Exception e)
                {
                    await ContentDialogService.Show(new ExceptionDialog("Невозможно добавить трек в избранное", "Возможно, этот трек поврежден или не существует плейлиста, если ошибка будет повторяться, переустановите приложение.", e));
                }
            });

            RemoveFavoriteCommand = new RelayCommand(() =>
            {
            });

            AddOnLibraryCommand = new RelayCommand(async() =>
            {
                try
                {
                    await Fooxboy.MusicX.Core.VKontakte.Music.Add.ToLibrary(Track.Id, Track.AccessKey);
                    await new MessageDialog("Трек добавлен в Вашу библиотеку").ShowAsync();
                }catch (Flurl.Http.FlurlHttpException)
                {
                    InternetService.GoToOfflineMode();
                }
                catch (Exception e)
                {
                    await ContentDialogService.Show(new ExceptionDialog("Ошибка при добавлении трека", "Возникла ошибка при добавлении трека в Вашу библиотеку", e));
                }
            });

            GetPropertyCommand = new RelayCommand(async() =>
            {
                await ContentDialogService.Show(new PropertiesTrackContentDialog(Track));
            });

            GoToArtistCommand = new RelayCommand(() =>
            {
                StaticContent.NavigationContentService.Go(typeof(ArtistView), new ArtistParameter()
                {
                    Id   = Track.ArtistId,
                    Name = Track.Artist
                });
            });
        }