Example #1
0
 private void Clear()
 {
     codeScheme = null;
     Min        = null;
     Max        = null;
     DetailTypes.Clear();
 }
 public PocketRetrieveItem(string ConsumerKey, string AccessToken, States State = States.Unread, Favorites Favorite = Favorites.Both, string Tag = null, ContentTypes ContentType = ContentTypes.All, Sorts Sort = Sorts.NoSort, DetailTypes DetailType = DetailTypes.NoType, string Search = null, string Domain = null, string Since = null, int Count = -1, int Offset = -1)
 {
     _consumerKey = ConsumerKey;
     _accessToken = AccessToken;
     _state = State;
     _favorite = Favorite;
     _tag = Tag;
     _contentType = ContentType;
     _sort = Sort;
     _detailType = DetailType;
     _search = Search;
     _domain = Domain;
     _since = Since;
     _count = Count;
     _offset = Offset;
 }
        public void ShowDetailsControl(DetailTypes type)
        {
            try
            {
                detailsTabPage.SuspendLayout();
                bool switchTab = true;

                switch (type)
                {
                    case DetailTypes.MethodBody:
                        dgBody.Visible = true;
                        dgResource.Visible = false;
                        panelResource.Visible = false;
                        switchTab = false;
                        break;

                    //case DetailTypes.Resources:
                    case DetailTypes.ResourcesRowAsBinary:
                    case DetailTypes.ResourcesRowAsText:
                    case DetailTypes.ResourcesRowAsImageList:
                    case DetailTypes.ResourcesRowAsImage:
                        if (panelResource.Dock == DockStyle.Fill)
                        {
                            panelResource.Dock = DockStyle.Bottom;
                            panelResource.Height = detailsTabPage.Height / 4;
                        }
                        dgBody.Visible = false;
                        dgResource.Visible = true;
                        panelResource.Visible = true;
                        panelResource.AutoScroll = false;
                        switch (type)
                        {
                            //case DetailTypes.Resources:
                            case DetailTypes.ResourcesRowAsText:
                                txtResource.Visible = true;                                
                                hbResource.Visible = false;
                                pbResource.Visible = false;
                                lvResource.Visible = false;
                                break;
                            case DetailTypes.ResourcesRowAsBinary:
                                txtResource.Visible = false;
                                hbResource.Visible = true;
                                pbResource.Visible = false;
                                lvResource.Visible = false;
                                break;
                            case DetailTypes.ResourcesRowAsImage:
                                txtResource.Visible = false;
                                hbResource.Visible = false;
                                pbResource.Visible = true;
                                panelResource.AutoScroll = true;
                                if (pbResource.Image != null)
                                {
                                    pbResource.Dock = DockStyle.None;
                                    pbResource.Size = pbResource.Image.Size;
                                }
                                else
                                {
                                    pbResource.Dock = DockStyle.Fill;
                                }
                                lvResource.Visible = false;
                                break;
                            case DetailTypes.ResourcesRowAsImageList:
                                txtResource.Visible = false;
                                hbResource.Visible = false;
                                pbResource.Visible = false;
                                lvResource.Visible = true;
                                break;
                        }
                        break;

                    case DetailTypes.TextResource:
                    case DetailTypes.ImageResource:
                    case DetailTypes.BinaryResource:
                        if (panelResource.Dock == DockStyle.Bottom)
                        {
                            panelResource.Dock = DockStyle.Fill;
                        }
                        dgBody.Visible = false;
                        dgResource.Visible = false;
                        panelResource.Visible = true;
                        panelResource.AutoScroll = false;
                        switch (type)
                        {
                            case DetailTypes.TextResource:
                                txtResource.Visible = true;
                                pbResource.Visible = false;
                                hbResource.Visible = false;
                                lvResource.Visible = false;
                                break;
                            case DetailTypes.ImageResource:
                                panelResource.AutoScroll = true;
                                txtResource.Visible = false;
                                pbResource.Visible = true;
                                if (pbResource.Image != null)
                                {
                                    pbResource.Dock = DockStyle.None;
                                    pbResource.Size = pbResource.Image.Size;
                                }
                                else
                                {
                                    pbResource.Dock = DockStyle.Fill;
                                }
                                hbResource.Visible = false;
                                lvResource.Visible = false;
                                break;
                            case DetailTypes.BinaryResource:
                                txtResource.Visible = false;
                                pbResource.Visible = false;
                                hbResource.Visible = true;
                                lvResource.Visible = false;
                                break;
                        }
                        break;

                    default:
                        dgBody.Visible = false;
                        dgResource.Visible = false;
                        panelResource.Visible = false;
                        break;
                }

                if (switchTab && _form.TabControl.SelectedTab != detailsTabPage)
                {
                    _form.TabControl.SelectedTab = detailsTabPage;
                }

                detailsTabPage.Tag = type;
            }
            catch
            {
                throw;
            }
            finally
            {
                detailsTabPage.ResumeLayout();
            }
        }