示例#1
0
        public void addAlbum(HGAlbumItem hgai)
        {
            if (m_albums.Count == 0)
            {
                setupNewAlbum();
            }

            AlbumInfo ai = new AlbumInfo(m_album_type, hgai);

            ai.AlbumName = hgai.AlbumName;
            if (!String.IsNullOrEmpty(hgai.FileUrl))
            {
                try
                {
                    MemoryStream ms = new MemoryStream();
                    Util.Download(HGRestfulAPI.FileServerBaseUrl + hgai.FileUrl, ms);
                    ai.AlbumImage = Image.FromStream(ms);
                }
                catch (Exception ex)
                {
                    //TODO; don't do that, just log
                    MessageBox.Show("下载网络图片" + hgai.FileUrl + "失败:" + ex.Message);
                }
            }
            // ai.AlbumImage =
            ai.ClickEventHandler += ShowAlbumDetail;
            m_albums.Add(ai);

            //if (m_albums.Count > 9)
            //{
            //    return;
            //    // m_albums[index].AlbumName = hgai.AlbumName;
            //    // m_albums[index].AlbumImage = Image.LoadImage(HGRestfulAPI.getInstance().FileServerBaseUrl + hgai.FileUrl);
            //}
        }
示例#2
0
 private void ShowAlbumDetail(ContentPublishPanel.AlbumType at, HGAlbumItem hgai)
 {
     // MessageBox.Show("显示专辑详情");
     if (SwitchToPP != null)
     {
         SwitchToPP(hgai);
     }
 }
示例#3
0
        public ProgramPanel(HGAlbumItem hgai)
        {
            InitializeComponent();

            HGAI            = hgai;
            SuggestedHeight = 600;
            // SetupPanel();
            // InitFakePrograms();
        }
示例#4
0
        /*
         * private void LoadAlbums()
         * {
         *  for (int i = 0; i < 10; i++)
         *  {
         *      AlbumInfo ai = new AlbumInfo(m_album_type);
         *
         *      if (i == 0)
         *      {
         *          ai.ClickEventHandler += NewAlbum;
         *          ai.AlbumName = "新建专辑";
         *      }
         *      else
         *          ai.ClickEventHandler += ShowAlbumDetail;
         *
         *      m_albums.Add(ai);
         *  }
         * }
         */
        private void NewAlbum(ContentPublishPanel.AlbumType album_type, HGAlbumItem hgai)
        {
            NewAlbumForm naf = new NewAlbumForm(album_type);

            // OpacityWindow naf2 = new OpacityWindow(naf);
            // naf2.ShowDialog();
            naf.ShowDialog();
            // naf2.Close();
        }
示例#5
0
        private void LoadAlbums()
        {
            // TODO: 这个判断很重要,因为PagerControl会多次调用PageChange,没有必要我们不要多次调用网络。
            if (m_curr_page == m_pgc_morealbum.CurrentPage && m_curr_rows_per_page == m_pgc_morealbum.RowsPerPage)
            {
                Console.WriteLine("No need to do duplicated operation");
                return;
            }
            HGAlbumSearchParams hgasp = new HGAlbumSearchParams(m_pgc_morealbum.CurrentPage, m_pgc_morealbum.RowsPerPage);

            m_curr_page          = m_pgc_morealbum.CurrentPage;
            m_curr_rows_per_page = m_pgc_morealbum.RowsPerPage;
            HGData.getInstance().Album = HGRestfulAPI.getInstance().getHGAlbum(hgasp);
            HGAlbum hga = HGData.getInstance().Album;

            if (hga == null)
            {
                return;
            }
            m_pgc_morealbum.RecordCount = hga.Total;

            foreach (AlbumInfo ai in m_albums)
            {
                this.Controls.Remove(ai);
            }
            m_albums.Clear();
            for (int i = 0; i < hga.Data.Length; i++)
            {
                HGAlbumItem hgai = hga.Data[i];

                AlbumInfo ai = new AlbumInfo(m_album_type, hgai);
                ai.AlbumName = hgai.AlbumName;
                if (!String.IsNullOrEmpty(hgai.FileUrl))
                {
                    try
                    {
                        MemoryStream ms = new MemoryStream();
                        Util.Download(HGRestfulAPI.FileServerBaseUrl + hgai.FileUrl, ms);
                        ai.AlbumImage = Image.FromStream(ms);
                    }
                    catch (Exception ex)
                    {
                        //TODO; don't do that, just log
                        MessageBox.Show("下载网络图片" + hgai.FileUrl + "失败:" + ex.Message);
                    }
                }
                ai.ClickEventHandler += ShowAlbumDetail;

                m_albums.Add(ai);
            }
            ShowAlbums();
        }
示例#6
0
        private void SwitchToPP(HGAlbumItem hgai)
        {
            // System.Windows.Forms.MessageBox.Show("显示专辑详情");
            if (m_ctl_navbar == null)
            {
                m_ctl_navbar             = new NavigationBar();
                m_ctl_navbar.SwitchToMAP = SwitchToMAP;
                this.Controls.Add(m_ctl_navbar);
                m_ctl_navbar.Size     = new Size(this.Width, m_ctl_navbar.Height); // TODO:
                m_ctl_navbar.Location = new Point(0, m_searchbar_y);
            }
            if (m_ctl_program == null)
            {
                m_ctl_program = new ProgramPanel(hgai);
                this.Controls.Add(m_ctl_program);
                m_ctl_program.HeightChanged += HeightChanged;
                m_ctl_program.Location       = new Point(0, m_searchbar_y + m_ctl_navbar.Height);
            }
            else
            {
                m_ctl_program.HGAI = hgai;
            }

            if (m_searchbar != null)
            {
                m_searchbar.Hide();
            }
            if (m_map != null)
            {
                m_map.Hide();
            }
            if (m_alp_video != null)
            {
                m_alp_video.Hide();
            }
            if (m_alp_audio != null)
            {
                m_alp_audio.Hide();
            }
            m_ctl_navbar.PanelAlbumType = m_current_album_type;
            m_ctl_navbar.Show();
            m_ctl_program.Show();
            m_ctl_navbar.BringToFront();
            m_ctl_program.BringToFront();
        }
示例#7
0
        public void displayAlbums()
        {
            HGAlbum hga = HGData.getInstance().Album;

            if (hga == null)
            {
                return;
            }
            for (int i = 0; i < hga.Data.Length; i++)
            {
                HGAlbumItem hgai = hga.Data[i];
                AlbumType   at   = (AlbumType)hgai.AlbumType;
                if (at == AlbumType.AudioAlbum)
                {
                    Console.WriteLine("Audio : " + hga.Data[i].AlbumName + " Url: " + hga.Data[i].FileUrl);
                    m_alp_audio.addAlbum(hga.Data[i]);
                }
                else if (at == AlbumType.VideoAlbum)
                {
                    Console.WriteLine("Video : " + hga.Data[i].AlbumName + " Url: " + hga.Data[i].FileUrl);
                    m_alp_video.addAlbum(hga.Data[i]);
                }
            }
        }
示例#8
0
 public AlbumInfo(ContentPublishPanel.AlbumType album_type, HGAlbumItem hgai)
 {
     InitializeComponent();
     m_album_type = album_type;
     m_hgai       = hgai;
 }