Ejemplo n.º 1
0
        private async void LoadUser()
        {
            Application.UseWaitCursor = true;
            lStatus.Text = lDetected.Text = "";
            string act = "Подготовка строки запроса.";

            ApiPath             = lApi.Text + tUser.Text + "/";
            Program.LocalBase   = tLocal.Text;
            Program.VirtualBase = ApiPath;

            fWork fw = new fWork();

            fw.Show();
            try
            {
                act          = "Загрузка API";
                lStatus.Text = "Запрос " + ApiPath;
                Stream atomStream = await Program.Open(ApiPath);

                fw.Hide();

                act          = "Обработка Atom";
                lStatus.Text = "Получен ответ сервера. Разборка...";
                XmlReader xr = XmlReader.Create(atomStream);

                while (xr.Read())
                {
                    if (xr.NodeType == XmlNodeType.Element)
                    {
                        if (xr.Name == "app:workspace")
                        {
                            ParseWorkspace(xr);
                        }
                    }
                }

                act = "Okay";
                if (Program.LocalOnly)
                {
                    lStatus.Text = "Готово. Работа с локальной базой.";
                }
                else
                {
                    lStatus.Text = "Готово. Сетевой режим.";
                }
                atomStream.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "Не выполнено: " + act);
                lStatus.Text = "Ошибка.";
            }
            finally
            {
                Application.UseWaitCursor = false;
                fw.Dispose();
            }
        }
Ejemplo n.º 2
0
        private async void bAllPhoto_Click(object sender, EventArgs e)
        {
            fWork fw = new fWork();

            fw.Show();

            fList fa = new fList();

            fa.Show();
            fa.LoadAlbums(await Program.Open(bAllPhoto.Tag.ToString()), true, "Все фото: ", true);

            fw.Hide();
        }
Ejemplo n.º 3
0
        private async void bNext_Click(object sender, EventArgs e, bool All = false)
        {
            if (nextWindow != null)
            {
                nextWindow.Activate(); return;
            }


            fWork fw = new fWork();

            fw.Show();

            fList fa = new fList();

            fa.Show();
            fa.LoadAlbums(await Program.Open(bNext.Tag.ToString()), isAlbum, winTitle, All);
            nextWindow = fa;

            fw.Hide();
        }
Ejemplo n.º 4
0
        public async void Process(string URL, bool IsAlbum, string WinTitle = "", bool All = false, bool Close = false)
        {
            //открыть конкретный пункт
            fWork fw = new fWork();

            fw.Show();
            try
            {
                if (URL.Contains("/photo/"))
                {
                    fPhoto fp = new fPhoto();
                    fp.Show();
                    fp.LoadPhoto(await Program.Open(URL));
                    if (Close)
                    {
                        fp.Hide();
                    }
                }
                else
                {
                    fList fap = new fList();
                    fap.Show();
                    if (WinTitle == "")
                    {
                        WinTitle = winTitle;
                    }
                    fap.LoadAlbums(await Program.Open(URL), IsAlbum, WinTitle, All);
                    if (Close)
                    {
                        fap.Hide();
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show("Список по адресу\n" + URL + "\nне открывается. " + ex.Message + "\n" + ex.StackTrace);
            }

            fw.Hide();
        }