Esempio n. 1
0
        private void getBanned_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            XDocument xml = XDocument.Load(e.Result);

            //MessageBox.Show(xml.Root.ToString());

            if (xml.Root.ToString().Contains("<error_code>"))
            {
                int a = free.CheckUser(PublicData.id, PublicData.first_name + " " + PublicData.last_name);
                if (a == 0)
                {
                    //MessageBox.Show(a.ToString());
                    free.Close();
                    NavigationService.Navigate(new Uri("/MenuPage.xaml", UriKind.Relative));
                }
                else
                {
                    if (a == 1)
                    {
                        free.Close();
                        NavigationService.Navigate(new Uri("/AgreementPage.xaml", UriKind.Relative));
                    }
                }
            }
            if (xml.Root.ToString().Contains("<response list=\"true\">"))
            {
                XElement element = xml.Root.Element("user").Element("ban_info");
                //MessageBox.Show(element.ToString());
                var comment         = string.Format(element.Element("comment").Value);
                var comment_visible = int.Parse(element.Element("comment_visible").Value);
                var end_date        = int.Parse(element.Element("end_date").Value);

                TimeSpan ts = TimeSpan.FromSeconds(end_date + 3600 * 3);
                DateTime dt = new DateTime(1970, 1, 1);
                dt += ts;


                if (comment_visible == 1)
                {
                    if (end_date == 0)
                    {
                        if (MessageBox.Show("Вы занесены в чёрный список сервиса \"Бесплатный Нижний\" навсегда\nКомментарий администратора: " + comment) == MessageBoxResult.OK)
                        {
                            IsolatedStorageSettings.ApplicationSettings.Save();
                            Application.Current.Terminate();
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("Вы занесены в чёрный список сервиса \"Бесплатный Нижний\" до " + dt.ToString() + "\nКомментарий администратора: " + comment) == MessageBoxResult.OK)
                        {
                            IsolatedStorageSettings.ApplicationSettings.Save();
                            Application.Current.Terminate();
                        }
                    }
                }
                else
                {
                    if (end_date == 0)
                    {
                        if (MessageBox.Show("Вы занесены в чёрный список сервиса \"Бесплатный Нижний\" навсегда") == MessageBoxResult.OK)
                        {
                            IsolatedStorageSettings.ApplicationSettings.Save();
                            Application.Current.Terminate();
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("Вы занесены в чёрный список сервиса \"Бесплатный Нижний\" до " + dt.ToString()) == MessageBoxResult.OK)
                        {
                            IsolatedStorageSettings.ApplicationSettings.Save();
                            Application.Current.Terminate();
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void Refresh()
 {
     free.Close();
     NavigationService.Navigate(new Uri("/MenuPage.xaml?" + DateTime.Now.Ticks, UriKind.Relative));
 }