Beispiel #1
0
        public DataVM(int id, DataPage1 _page)
        {
            page = _page;
            string city = (App.Current as App).Userinfo.City;

            db = new Database(Database.connectStr);
            Dictionary_User = new Dictionary <int, string>();
            Dictionary_City = new Dictionary <int, string>();
            client.GetMyPointsAsync(id);
            client.GethighestPointsAlluserAsync();
            client.GetAveragePointsAllUserAsync();
            client.GetAveragePointsInCityAsync(city);
            client.GetHighestPointsInCityAsync(city);
            client.GetMyRankAsync(id);
            client.GetMyCityRankAsync(id);
            client.GetMyRankCompleted               += new EventHandler <GetMyRankCompletedEventArgs>(client_GetMyRankCompleted);
            client.GetMyCityRankCompleted           += new EventHandler <GetMyCityRankCompletedEventArgs>(client_GetMyCityRankCompleted);
            client.GetMyPointsCompleted             += new EventHandler <GetMyPointsCompletedEventArgs>(client_GetMyPointsCompleted);
            client.GethighestPointsAlluserCompleted += new EventHandler <GethighestPointsAlluserCompletedEventArgs>(client_GethighestPointsAlluserCompleted);
            client.GetAveragePointsAllUserCompleted += new EventHandler <GetAveragePointsAllUserCompletedEventArgs>(client_GetAveragePointsAllUserCompleted);
            client.GetAveragePointsInCityCompleted  += new EventHandler <GetAveragePointsInCityCompletedEventArgs>(client_GetAveragePointsInCityCompleted);
            client.GetHighestPointsInCityCompleted  += new EventHandler <GetHighestPointsInCityCompletedEventArgs>(client_GetHighestPointsInCityCompleted);
            client.GetRankUserCompleted             += new EventHandler <GetRankUserCompletedEventArgs>(client_GetRankUserCompleted);
            client.GetRankCityCompleted             += new EventHandler <GetRankCityCompletedEventArgs>(client_GetRankCityCompleted);
            if (db.DataUsers.Count() == 0)
            {
                client.GetRankCityAsync();
                client.GetRankUserAsync();
            }
            else
            {
                //db.DataUsers.DeleteAllOnSubmit(db.DataUsers);
                //db.Citys.DeleteAllOnSubmit(db.Citys);
                //client.GetRankCityAsync();
                //client.GetRankUserAsync();
                dealWithRankList();
            }
        }