public FilerView2() { InitializeComponent(); AddFilePanel.Hide(); AddLinkPanel.Hide(); AppDomain.CurrentDomain.ProcessExit += OnProcessExit; //Set background image for ClassesPanel(brown one). string ClassesBackPath = Path.Combine(ResourcesPath, "Images"); ClassesBackPath = Path.Combine(ClassesBackPath, "Classes_Background.png"); ClassesPanel.BackgroundImage = System.Drawing.Image.FromFile(ClassesBackPath); //Set background image for ResourcesPanel(The big book). string ResBackPath = Path.Combine(ResourcesPath, "Images"); ResBackPath = Path.Combine(ResBackPath, "Open_Books"); ResBackPath = Path.Combine(ResBackPath, "Blue_Green_Open_Book.png"); ResourcePanel.BackgroundImage = null; ResourcePanel.BackColor = Color.Transparent; ResourcePanel.AllowDrop = true; //Build ClassesPanelHelper. The ClassesPanelHelper is used for the background when showing the ClassesPanel. Panel ClassesPanelHelper = new Panel(); ClassesPanelHelper.Size = ResourcePanel.Size; ClassesPanelHelper.Location = ResourcePanel.Location; ClassesPanelHelper.BackgroundImage = ResourcePanel.BackgroundImage; //Add ClassesPanelHelper to the View. ClassesPanelHelper.Parent = this; ClassesPanel.Parent = ClassesPanelHelper; ClassesPanelHelper.BringToFront(); //ControlHelper.SuspendDrawing(ResourcePanel); //Keeping this here in case we need is somewhere else in the code. //Build ClassesMediator. This is used to make the ClassesPanel act like a flow layout panel. ClassesMediator = new FlowLayoutPanel(); ClassesMediator.BackColor = Color.Transparent; ClassesPanel.Controls.Add(ClassesMediator); ClassesMediator.Location = new Point(0, 0); ClassesMediator.Size = new Size(ClassesPanel.Size.Width - 20, ClassesPanel.Size.Height - 20); Copy_Right_Label.BringToFront(); EndLoading(); }
/// <summary> /// This function was made to be called by UpdateResourcesHelper only. It creates an object for every item in CurrentResources /// and paints it onto the ResourcePanel. It's in charge of knowing which resources to put on the pages and where. It updates /// Comments. /// </summary> /// <param name="Resources"></param> /// <param name="PageNum"></param> private void AddResourcesAfterWait(List <ResourceData> Resources, int PageNum) { ControlHelper.SuspendDrawing(ResourcePanel); ResourcePanel.Show(); ResourcePanel.BringToFront(); int count = 0; //Used for colors. //Add to left page for (int i = PageNum * 32; i < PageNum * 32 + 16; i++) { if (i >= Resources.Count) { break; } if (Resources[i].Name.Equals("_Class_Foot_In_Door")) //This Resource is just to keep new classes available on server. { continue; } int ColorNum; if (Resources[i].Unit == null || Resources[i].Unit.Equals("")) { ColorNum = CurrentBookColorComplement; } else { string UnitExt = Resources[i].Unit.Substring(Resources[i].Unit.Length - 3); ColorNum = ColorExtensions.IndexOf(UnitExt); } PagePanel current = new PagePanel(Resources[i].Name, Resources[i].Date, Resources[i].Type, Resources[i].Link != null, (ResourceColor)ColorNum); Comments.Add(Resources[i].Name, Resources[i].Comments); current.AddTo(ResourcesLeftPanel); current.Delete_Clicked += Received_Delete; current.Double_Clicked += Received_Double_Click; current.Right_Clicked += Received_Right_Click; Copy_Right_Label.BringToFront(); } //Add to right page for (int i = PageNum * 32 + 16; i < PageNum * 32 + 32; i++) { if (i >= Resources.Count) { break; } if (Resources[i].Name.Equals("_Class_Foot_In_Door")) //This Resource is just to keep new classes available on server. { continue; } int ColorNum; if (Resources[i].Unit == null || Resources[i].Unit.Equals("")) { ColorNum = CurrentBookColorComplement; } else { string UnitExt = Resources[i].Unit.Substring(Resources[i].Unit.Length - 3); ColorNum = ColorExtensions.IndexOf(UnitExt); } PagePanel current = new PagePanel(Resources[i].Name, Resources[i].Date, Resources[i].Type, Resources[i].Link != null, (ResourceColor)ColorNum); Comments.Add(Resources[i].Name, Resources[i].Comments); current.AddTo(ResourcesRightPanel); current.Delete_Clicked += Received_Delete; current.Double_Clicked += Received_Double_Click; current.Right_Clicked += Received_Right_Click; } ControlHelper.ResumeDrawing(ResourcePanel); }