Пример #1
0
        public App()
            : base()
        {
            model      = SpotifyViewModel.Instance;
            client     = new ServiceReference.SpotifyClient(new InstanceContext(model));
            MainWindow = new MainWindow(model);
            AuthenticationStatus ok = AuthenticationStatus.Bad;

            try { ok = client.Authenticate(""); }
            catch { throw; }
            if (ok == AuthenticationStatus.Bad)
            {
                Shutdown();
            }
            else if (ok == AuthenticationStatus.RequireLogin)
            {
                bool loggedIn = false;
                while (!loggedIn)
                {
                    SpotifyLogin login = new SpotifyLogin();
                    login.ShowDialog();
                    if (login.Username.Text != "")
                    {
                        loggedIn = client.Login(login.Username.Text, login.Password.Password);
                    }
                }
            }
            model.Client = client;
            MainWindow.Show();
            MainWindow.Closed += new EventHandler(MainWindow_Closed);
        }
Пример #2
0
 public App()
     : base()
 {
     model = SpotifyViewModel.Instance;
     client = new ServiceReference.SpotifyClient(new InstanceContext(model));
     MainWindow = new MainWindow(model);
     AuthenticationStatus ok = AuthenticationStatus.Bad;
     try { ok = client.Authenticate(""); }
     catch { throw; }
     if (ok == AuthenticationStatus.Bad)
         Shutdown();
     else if (ok == AuthenticationStatus.RequireLogin)
     {
         bool loggedIn = false;
         while (!loggedIn)
         {
             SpotifyLogin login = new SpotifyLogin();
             login.ShowDialog();
             if (login.Username.Text != "")
                 loggedIn = client.Login(login.Username.Text, login.Password.Password);
         }
     }
     model.Client = client;
     MainWindow.Show();
     MainWindow.Closed += new EventHandler(MainWindow_Closed);
 }