Exemplo n.º 1
0
        public async Task GetConfig()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.GetConfigAsync());
        }
Exemplo n.º 2
0
        public async Task GetTrack()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.GetTrackAsync("Tkou6ps7lrj2wz3c2ejrgar337m")); // Essence, By: Skrux
        }
Exemplo n.º 3
0
        public async Task ListPromotedTracksAsync()
        {
            var account = GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.ListPromotedTracksAsync());
        }
Exemplo n.º 4
0
        public async Task GetAlbum()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.GetAlbumAsync("Bdyocq5dfo3a72heswzl7nhni64")); // Lunch Money - EP, By: SoySauce
        }
Exemplo n.º 5
0
        public async Task ExploreTabs()
        {
            var account = GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(mc.Login(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.ExploreTabsAsync());
        }
Exemplo n.º 6
0
        public async Task ListStationCategories()
        {
            var account = GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.ListStationCategoriesAsync());
        }
Exemplo n.º 7
0
        public async Task ListPlaylists()
        {
            var account = GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(mc.Login(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.ListPlaylistsAsync());
        }
Exemplo n.º 8
0
        public async Task ListListenNowTracks()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.ListListenNowTracksAsync());
        }
Exemplo n.º 9
0
 private void OnDestroy()
 {
     if (SceneManager.GetActiveScene().name != Scenes.TitleSceneName)
     {
         CommunityData.Instance.Shutdown();
         MobileClient.Disconnect();
     }
 }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            #region Example01
            Console.WriteLine("********* Example01 **********");
            ContinentFactory africa = new AfricaFactory();
            AnimalWorld      world  = new AnimalWorld(africa);
            world.RunFoodChain();


            ContinentFactory america = new AmericaFactory();
            world = new AnimalWorld(america);
            world.RunFoodChain();

            #endregion

            Console.WriteLine("");

            #region Example02
            Console.WriteLine("********* Example02 **********");
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            #endregion

            Console.WriteLine("");

            #region Example03
            Console.WriteLine("********* Example03 **********");
            Document[] documents = new Document[2];

            documents[0] = new Resume();
            documents[1] = new Report();

            // Display document pages

            foreach (Document document in documents)
            {
                Console.WriteLine("\n" + document.GetType().Name + "--");
                foreach (Page page in document.Pages)
                {
                    Console.WriteLine(" " + page.GetType().Name);
                }
            }
            #endregion

            Console.ReadKey();
        }
Exemplo n.º 11
0
        public void OpenLeaveCommunityDialog()
        {
            string messageKey = MobileClient.FormatString(StaticDB.GetString("COMMUNITIES_CONFIRM_LEAVE_COMMUNITY_DESCRIPTION", "COMMUNITIES_CONFIRM_LEAVE_COMMUNITY_DESCRIPTION"), this.m_community.Name);

            Singleton <DialogFactory> .Instance.CreateOKCancelDialog("COMMUNITIES_CONFIRM_LEAVE_COMMUNITY", messageKey, delegate
            {
                this.m_community.LeaveOrDestroyClub();
            }, null);
        }
Exemplo n.º 12
0
        private void OnApplicationQuit()
        {
            if (Network.IsConnected() && Network.IsLoggedIn())
            {
                Network.Logout();
            }
            Singleton <Login> .instance.BnQuit();

            MobileClient.Shutdown();
        }
Exemplo n.º 13
0
        public async Task CreateDeletePlaylist()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Playlist item;

            Assert.IsNotNull(item = await mc.CreatePlaylist(Guid.NewGuid().ToString(), ""));
            Assert.IsNotNull(await mc.DetelePlaylist(item));
        }
Exemplo n.º 14
0
        public void SamsungPhoneTest()
        {
            IMobilePhone SamsungMobilePhone = new Samsung();
            MobileClient SamsungClient      = new MobileClient(SamsungMobilePhone);

            var descriptionNormalPhone = SamsungClient.GetNormalPhoneModelDetails();
            var descriptionSmartPhone  = SamsungClient.GetSmartPhoneModelDetails();

            descriptionNormalPhone.Equals(Description.SamsungGuru).Should().BeTrue();
            descriptionSmartPhone.Equals(Description.SamsungGalaxy).Should().BeTrue();
        }
Exemplo n.º 15
0
        public void NokiaPhoneTest()
        {
            IMobilePhone NokiaMobilePhone = new Nokia();
            MobileClient NokiaClient      = new MobileClient(NokiaMobilePhone);

            var descriptionNormalPhone = NokiaClient.GetNormalPhoneModelDetails();
            var descriptionSmartPhone  = NokiaClient.GetSmartPhoneModelDetails();

            descriptionNormalPhone.Equals(Description.Nokia1600).Should().BeTrue();
            descriptionSmartPhone.Equals(Description.NokiaPixel).Should().BeTrue();
        }
Exemplo n.º 16
0
        public async Task ListPlaylistItems()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            ResultList <Playlist> playlist;

            Assert.IsNotNull(playlist = await mc.ListPlaylistsAsync());
            Assert.IsNotNull(await mc.ListTracksFromPlaylist(playlist.Data.Items.First()));
        }
Exemplo n.º 17
0
        private async void InitializeGoogleMusicClient()
        {
            _mobileClient = new MobileClient();
            _isLoggedIn   = await _mobileClient.LoginAsync(LoginData.Login, LoginData.Password);

            if (_isLoggedIn)
            {
                await InitPlayLists();

                _mainWindow.SearchOnGooglePlayBtn.IsEnabled = true;
            }
        }
Exemplo n.º 18
0
 public void SetMemberInfo(CommunityMember member)
 {
     this.m_characterNameText.text = member.Name.ToUpper();
     this.m_kickButtonText.text    = MobileClient.FormatString(StaticDB.GetString("COMMUNITIES_KICK_MEMBER", "[PH] Kick %s"), this.m_characterNameText.text);
     this.m_member = member;
     this.SetRoleToggleState();
     this.SetValidAssignableRoles();
     this.m_memberRole.onValueChanged.AddListener((bool argument0) => this.SetMemberRole());
     this.m_moderatorRole.onValueChanged.AddListener((bool argument1) => this.SetModeratorRole());
     this.m_leaderRole.onValueChanged.AddListener((bool argument2) => this.SetLeaderRole());
     this.m_ownerRole.onValueChanged.AddListener((bool argument3) => this.SetOwnerRole());
 }
Exemplo n.º 19
0
        private void AddCommunitiesToContent()
        {
            GameObject gameObject = this.m_scrollContent.AddAsChildObject(this.m_scrollSectionHeaderPrefab);
            string     text       = MobileClient.FormatString("%s'S COMMUNITIES", Singleton <CharacterData> .Instance.CharacterName.ToUpper());

            gameObject.GetComponentInChildren <Text>().text = text;
            CommunityData.Instance.ForEachCommunity(delegate(Community community)
            {
                GameObject gameObject2 = this.m_scrollContent.AddAsChildObject(this.m_communityButtonPrefab);
                gameObject2.GetComponent <CommunityButton>().SetCommunity(community);
            });
        }
Exemplo n.º 20
0
        public async Task <bool> RetrieveUserData()
        {
            var info = await MobileClient.InvokeApiAsync <List <SocialLoginResult> >("/.auth/me");

            if (info.FirstOrDefault() is SocialLoginResult result)
            {
                UserName    = result.GetUserName();
                UserEmail   = result.GetUserEmail();
                UserPicture = result.GetUserPictureURL();
                return(true);
            }
            return(false);
        }
Exemplo n.º 21
0
        public void SamsungFactory()
        {
            var factory = new SamsungFactory();
            var client  = new MobileClient(factory);

            var normalPhoneRAM = client.GetNormalPhoneRAMDetails();

            Assert.AreEqual(normalPhoneRAM, RAMTypes.NA);

            var smartPhoneRAM = client.GetSmartPhoneRAMDetails();

            Assert.AreEqual(smartPhoneRAM, RAMTypes.ThreeGB);
        }
Exemplo n.º 22
0
        public void RedmiFactory()
        {
            var factory = new RedmiFactory();
            var client  = new MobileClient(factory);

            var normalPhoneRAM = client.GetNormalPhoneRAMDetails();

            Assert.AreEqual(normalPhoneRAM, RAMTypes.OneGB);

            var smartPhoneRAM = client.GetSmartPhoneRAMDetails();

            Assert.AreEqual(smartPhoneRAM, RAMTypes.TwoGB);
        }
Exemplo n.º 23
0
        static void Main(string[] args)
        {
            //Abstract Factorys.
            var nokiaFactory   = new Nokia();
            var samsungFactory = new Samsung();

            var nokiaClient   = new MobileClient(nokiaFactory);
            var samsungClient = new MobileClient(samsungFactory);

            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.ReadLine();
        }
Exemplo n.º 24
0
        private void AddInvitationsToContent()
        {
            ReadOnlyCollection <CommunityPendingInvite> pendingInvites = CommunityData.Instance.GetPendingInvites();

            if (pendingInvites.Count > 0)
            {
                GameObject gameObject = this.m_scrollContent.AddAsChildObject(this.m_scrollSectionHeaderPrefab);
                gameObject.GetComponentInChildren <Text>().text = "PENDING INVITATIONS";
                GameObject gameObject2 = this.m_scrollContent.AddAsChildObject(this.m_inviteButtonPrefab);
                string     text        = (pendingInvites.Count <= 1) ? "1 INVITE" : "%s INVITATIONS";
                text = MobileClient.FormatString(text, pendingInvites.Count.ToString());
                gameObject2.GetComponentInChildren <Text>().text = text;
                gameObject2.GetComponentInChildren <Button>().onClick.AddListener(new UnityAction(this.OpenPendingInvitesDialog));
            }
        }
Exemplo n.º 25
0
        public async Task ChangePlaylistShareState()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Playlist item;

            Assert.IsNotNull(item = await mc.CreatePlaylist(Guid.NewGuid().ToString(), "", ShareState.Public));
            Assert.IsTrue(await mc.IsPlaylistSharedAsync(item));
            item.ShareState       = ShareState.Private;
            Assert.IsNotNull(item = await mc.UpdatePlaylistAsync(item));
            Debug.WriteLine(item);
            Assert.IsFalse(await mc.IsPlaylistSharedAsync(item));
            Assert.IsNotNull(await mc.DetelePlaylist(item));
        }
Exemplo n.º 26
0
        public static async void PlayTrack(MobileClient client, Track track)
        {
            if (track == null || client == null)
            {
                return;
            }

            var streamUrl = await client.GetStreamUrlAsync(track);

            if (streamUrl == null)
            {
                return;
            }
            _currentTrack = track;
            PlayTrack(streamUrl);
        }
        public static void AbstractFactory()
        {
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());
        }
Exemplo n.º 28
0
        static void Main(string[] args)
        {
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            Console.Read();
        }
Exemplo n.º 29
0
        public static string MainFn()
        {
            string       result           = string.Empty;
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            result += nokiaClient.GetSmartPhoneModelDetails();
            result += nokiaClient.GetNormalPhoneModelDetails();

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            result += samsungClient.GetSmartPhoneModelDetails();
            result += samsungClient.GetNormalPhoneModelDetails();

            return(result);
        }
Exemplo n.º 30
0
        private static void GetAbstractFactoryPattern()
        {
            ImobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            ImobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            Console.ReadKey();
        }