public virtual void GoFullScreenClient(Server server, bool isTopMostWindow) { RdpClient client = server.Client; Rectangle rectangle = Screen.GetBounds(client.Control); if (Program.Preferences.UseMultipleMonitors && (rectangle.Height < client.MsRdpClient.DesktopHeight || rectangle.Width < client.MsRdpClient.DesktopWidth)) { int num = 0; int num2 = 65535; Screen[] allScreens = Screen.AllScreens; foreach (Screen screen in allScreens) { num += screen.Bounds.Width; num2 = Math.Min(screen.Bounds.Height, num2); } num = Math.Min(num, RdpClient.MaxDesktopWidth); num2 = Math.Min(num2, RdpClient.MaxDesktopHeight); rectangle = new Rectangle(0, 0, num, num2); } _savedBounds = base.Bounds; _savedBorderStyle = base.FormBorderStyle; DrawingControl.SuspendDrawing(this); SuspendLayout(); base.FormBorderStyle = FormBorderStyle.None; SetMainMenuVisibility(show: false); SetBounds(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height); server.SetClientSizeProperties(); client.Control.Bounds = new Rectangle(0, 0, base.Width, base.Height); ResumeLayout(); base.TopMost = isTopMostWindow; client.Control.Show(); DrawingControl.ResumeDrawing(this); BringToFront(); Activate(); }
/// <summary> /// This event fires when the user, using the Zoom Tool, has clicked on the Canvas. The normal Changed event is suppressed, /// and this one fires instead. The CanvasPane should be scrolled such that the click point is centered on the screen, and the new Zoom Level /// set. /// </summary> private void Document_ClickZoom(object sender, ZoomEventArgs e) { _settingZoom = true; _settingScroll = true; DrawingControl.SuspendDrawing(pnlWorkspace); float OldZoom = _Document.Scaling.Zoom.GetValueOrDefault(); // Perform the changes to zoom _Document.Scaling.Zoom = e.ZoomLevel; SetCanvasSize(); SetCanvasPosition(); // Regenerate the composite background image with the correct zoom scale //_Document.Background.Set(); PointF ZoomPoint = e.ZoomPoint; SizeF Size = _Document.Scaling.CanvasSizeF; // Convert the zoom point from old zoom, to the new value. // We do this because the Zoom event has already fired by the time this event fires, and we need to scale the // point accordingly ZoomPoint = new PointF((ZoomPoint.X / OldZoom) * e.ZoomLevel, (ZoomPoint.Y / OldZoom) * e.ZoomLevel); OldZoom = e.ZoomLevel; _hScrollPct = ZoomPoint.X / Size.Width; _vScrollPct = ZoomPoint.Y / Size.Height; _settingScroll = false; _settingZoom = false; SetScrollPercent(); DrawingControl.ResumeDrawing(pnlWorkspace); }
public virtual void LeaveFullScreenClient(Server server) { DrawingControl.SuspendDrawing(this); SuspendLayout(); base.FormBorderStyle = _savedBorderStyle; SetMainMenuVisibility(); base.Bounds = _savedBounds; ResumeLayout(); base.TopMost = false; DrawingControl.ResumeDrawing(this); server.SetClientSizeProperties(); Activate(); }
private void btnLoad_Click(object sender, EventArgs e) { dgvSharedParameters.Rows.Clear(); List <string> sharedParamList = SharedParameterList(); DrawingControl.SetDoubleBuffered(dgvSharedParameters); DrawingControl.SuspendDrawing(dgvSharedParameters); if (myRevitDoc.IsFamilyDocument) { List <string> familyParamList = FamilyParameters(); foreach (string item in sharedParamList) { char[] chrSeparator = new char[] { '\t' }; string[] arrValues = item.Split(chrSeparator, StringSplitOptions.None); string paramName = arrValues[1]; string paramType = arrValues[2]; string paramGroup = arrValues[3]; if (!familyParamList.Contains(paramName)) { dgvSharedParameters.Rows.Add(paramName, paramGroup, paramType, "", ""); } } } else { List <string> projectParamList = ProjectParameterList(); foreach (string item in sharedParamList) { char[] chrSeparator = new char[] { '\t' }; string[] arrValues = item.Split(chrSeparator, StringSplitOptions.None); string paramName = arrValues[1]; string paramType = arrValues[2]; string paramGroup = arrValues[3]; if (!projectParamList.Contains(paramName)) { dgvSharedParameters.Rows.Add(paramName, paramGroup, paramType, "", "", ""); } } } DrawingControl.ResumeDrawing(dgvSharedParameters); }
private void LoadSheets(DataGridView dataGridView) { DrawingControl.SetDoubleBuffered(dataGridView); DrawingControl.SuspendDrawing(dataGridView); foreach (ViewSheet viewSheet in viewSheets_ENTIRE_PROJECT) { string number = viewSheet.SheetNumber; string name = viewSheet.Name; dataGridView.Rows.Add(number, name, false); } DrawingControl.ResumeDrawing(dataGridView); }
private void LoadSelectionDetails(int scrollAt = -1) { try { Cursor = Cursors.WaitCursor; DrawingControl.SuspendDrawing(pMovieDetailsContainer); var selectedMovieData = (MovieShortInfo)dgvMoviesList.SelectedRows[0].DataBoundItem; var opRes = DAL.LoadMTD(selectedMovieData.Id, true); if (!opRes.Success) { MsgBox.Show(string.Format("The following error occurred while loading the file details:{0}{0}{1}", Environment.NewLine, opRes.CustomErrorMessage), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var prevInstance = pMovieDetailsContainer.Controls.Find("ucMovieInfo", false); if (prevInstance.Any()) { ((ucMovieInfo)prevInstance[0]).RefreshControls(DAL.CurrentMTD); } else { var ucMovieInfo = new ucMovieInfo(false) { Dock = DockStyle.Top }; ucMovieInfo.RefreshControls(DAL.CurrentMTD); pMovieDetailsContainer.Controls.Add(ucMovieInfo); ucMovieInfo.BringToFront(); } } finally { if (scrollAt > -1) { pMovieDetailsContainer.VerticalScroll.Value = scrollAt; } SetSaveButtonState(false); DrawingControl.ResumeDrawing(pMovieDetailsContainer); Cursor = Cursors.Default; } }
private void lbSwitchToSimpleFilter_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { DrawingControl.SuspendDrawing(scMovies.Panel1); pBasicFilter.Visible = true; pAdvFilter.Visible = false; ResetAdvancedFilter(); } finally { DrawingControl.ResumeDrawing(scMovies.Panel1); } }
/// <summary> /// Occurs when the Document has finished loading. Reformat the display with the proper settings. /// </summary> private void Document_Loaded(object sender, EventArgs e) { DrawingControl.SuspendDrawing(pnlWorkspace); SetCanvasSize(); SetCanvasPosition(); // Regenerate the composite background image with the correct zoom scale //CanvasPane.BackColor = _Document.Background.Color; //_Document.Background.Set(); if (_Document.Scaling.Zoom > Scaling.MIN_ZOOM) { SetScrollPercent(); } DrawingControl.ResumeDrawing(pnlWorkspace); CanvasPane.Refresh(); }
private void cxmnuExclude_Click(object sender, EventArgs e) { TaskDialog td = new TaskDialog("Exclude Parameter"); td.MainInstruction = "Are you sure you want to exclude the selected parameters from insertion?"; td.CommonButtons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No; if (td.Show() == TaskDialogResult.Yes) { DrawingControl.SetDoubleBuffered(dgvSharedParameters); DrawingControl.SuspendDrawing(dgvSharedParameters); foreach (DataGridViewRow row in dgvSharedParameters.SelectedRows) { dgvSharedParameters.Rows.Remove(row); } DrawingControl.ResumeDrawing(dgvSharedParameters); } }
private void ColorRows() { DrawingControl.SetDoubleBuffered(dgvSheets); DrawingControl.SuspendDrawing(dgvSheets); foreach (DataGridViewRow row in dgvSheets.Rows) { bool set = bool.Parse(row.Cells["Set"].Value.ToString()); if (set) { row.DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen; } else { row.DefaultCellStyle.BackColor = System.Drawing.Color.White; } } DrawingControl.ResumeDrawing(dgvSheets); }
/// <summary> /// Occurs when one of the Document's properties changed. /// </summary> private void Document_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (string.Compare(e.PropertyName, "Zoom", true) != 0) { return; } if (!_settingZoom) { DrawingControl.SuspendDrawing(pnlWorkspace); SetCanvasSize(); SetCanvasPosition(); if (_Document.Scaling.Zoom > Scaling.MIN_ZOOM) { SetScrollPercent(); } DrawingControl.ResumeDrawing(pnlWorkspace); } CanvasPane.Refresh(); }
private void btnLoad_Click(object sender, EventArgs e) { dgvSharedParameters.Rows.Clear(); List <string> sharedParamList = SharedParameterList(); List <string> projectParamList = ProjectParameterList(); foreach (string item in sharedParamList) { char[] chrSeparator = new char[] { '\t' }; string[] arrValues = item.Split(chrSeparator, StringSplitOptions.None); string paramName = arrValues[0]; string paramGroup = arrValues[2]; if (!projectParamList.Contains(paramName)) { dgvSharedParameters.Rows.Add(paramName, paramGroup, "", "", ""); } } DrawingControl.SetDoubleBuffered(dgvSharedParameters); DrawingControl.SuspendDrawing(dgvSharedParameters); foreach (DataGridViewRow row in dgvSharedParameters.Rows) { string sharedParam = ""; sharedParam = row.Cells["clmParamName"].Value.ToString(); if (projectParamList.Contains(sharedParam)) { row.DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen; } } DrawingControl.ResumeDrawing(dgvSharedParameters); }
private void lbSwitchToAdvFilters_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { DrawingControl.SuspendDrawing(scMovies.Panel1); if (cbAdvFilter_Audio.DataSource == null) { var listOfLanguagesWithAny = new List <LanguageObject>(Languages.Iso639); listOfLanguagesWithAny.Insert(0, new LanguageObject() { Name = "<Any>" }); cbAdvFilter_Audio.DataSource = listOfLanguagesWithAny; cbAdvFilter_Audio.ValueMember = "Code"; cbAdvFilter_Audio.DisplayMember = "Name"; cbAdvFilter_Audio.SetSeparator(4); var listOfThemesWithAny = new List <string>(DAL.MovieThemes); listOfThemesWithAny.Insert(0, "<Any>"); cbAdvFilter_Theme.DataSource = listOfThemesWithAny; var toolTip = new ToolTip(); toolTip.SetToolTip(lbAdvFilterReset, "Reset the advanced filter values"); toolTip.SetToolTip(chkIncludeUnknownRec, "Include the movies with missing or unknown recommendation"); } pBasicFilter.Visible = false; pAdvFilter.Visible = true; } finally { DrawingControl.ResumeDrawing(scMovies.Panel1); } }
private void dgvSheets_MouseClick(object sender, MouseEventArgs e) { DrawingControl.SetDoubleBuffered(dgvSheets); DrawingControl.SuspendDrawing(dgvSheets); if (e.Button == MouseButtons.Left && shiftKeyIsDown && dgvSheets.CurrentCell is DataGridViewCheckBoxCell) { foreach (DataGridViewColumn col in dgvSheets.Columns) { foreach (DataGridViewRow row in dgvSheets.Rows) { if (dgvSheets[col.Index, row.Index] is DataGridViewCheckBoxCell) { if (row.Selected) { bool set = bool.Parse(dgvSheets[col.Index, row.Index].Value.ToString()); row.Cells["Set"].Value = !set; if (bool.Parse(row.Cells["Set"].Value.ToString())) { row.DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen; } else { row.DefaultCellStyle.BackColor = System.Drawing.Color.White; } } } } } } ColorRows(); DrawingControl.ResumeDrawing(dgvSheets); }
public void RefreshControls(MovieTechnicalDetails mtd) { try { Cursor = Cursors.WaitCursor; DrawingControl.SuspendDrawing(this); _bsControlsData.DataSource = mtd; _bsControlsData.ResetBindings(false); ttTitleContent.RemoveAll(); if (mtd.HasTitle && !string.IsNullOrEmpty(mtd.Title)) { ttTitleContent.SetToolTip(chbTitle, mtd.Title); chbTitle.Cursor = Cursors.Help; } else { ttTitleContent.SetToolTip(chbTitle, "The file doesn't have a 'Title' tag"); chbTitle.Cursor = Cursors.Default; } //having it on "InitControls" will cause a crash, the column being NOT recognized! //only for this custom TextBox //todo: why? if (tbSize.DataBindings.Count == 0) { tbSize.DataBindings.Add("Text", _bsControlsData, "FileSize2"); } //CheckSizeMismatch(); if (mtd.Id > 0) { var cachedMovieStills = DAL.CachedMoviesStills.FirstOrDefault(ms => ms.FileDetailId == mtd.Id); if (cachedMovieStills != null) { SetMovieStills(cachedMovieStills.MovieStills); } else { cachedMovieStills = DAL.LoadMovieStills(mtd.Id); DAL.CachedMoviesStills.Add(cachedMovieStills); SetMovieStills(cachedMovieStills.MovieStills); } LoadControls2(); } else { SetMovieStills(mtd.MovieStills); } var tt3 = new ToolTip(); //ttTitleContent not working?!! tt3.SetToolTip(bGotoRecommendedSite, mtd.HasRecommendedDataSaved ? "Displays a window showing the last scraped/passed data from CommmonSenseMedia site" : "Navigate using the default system browser to the current CommonSenseMedia link"); _hasRecommendedDataSaved = mtd.HasRecommendedDataSaved; } finally { DrawingControl.ResumeDrawing(this); Cursor = Cursors.Default; } }
private void BuildDirectoryTree(object cancelationObject) { ThreadSafeTimerStart(); ThreadSafeSetControlEnabled(btnProcess, false); ThreadSafeSetControlEnabled(btnCancel, true); ThreadSafeSetControlEnabled(chkSuspendTreeViewRedrawing, false); ThreadSafeSetTreeViewBackColor(SystemColors.Window); ThreadSafeClearTree(); if (chkSuspendTreeViewRedrawing.Checked) { DrawingControl.SuspendDrawing(panel1); } m_Canceled = false; string p = String.Empty; try { p = Path.GetFullPath(txtPath.Text.Replace("\"", "")) + "\\"; p = p.Replace("\\\\", "\\"); } catch { } if (!Directory.Exists(p)) { MessageBox.Show("The specified folder does not exists."); return; } m_Path = p; logger.Info("Starting build directory tree for " + m_Path + " ..."); var node = new TreeNode(Path.GetDirectoryName(m_Path)); ThreadSafeAddNode(node); m_Start = DateTime.Now; // Processing: var size = EnumerateSubdirs(m_Path, node, cancelationObject); ThreadSafeSetNodeText(node, FormatSize(size) + " : " + node.Text); // Finished. var end = DateTime.Now; var duration = end - m_Start; ThreadSafeSetControlEnabled(btnProcess, true); ThreadSafeSetControlEnabled(btnCancel, false); ThreadSafeSetControlEnabled(chkSuspendTreeViewRedrawing, true); DrawingControl.ResumeDrawing(panel1); m_CancelationTokenSource = null; ThreadSafeTimerStop(); if (m_Canceled) { ThreadSafeSetTreeViewBackColor(SystemColors.Control); logger.Info("Canceled by user."); } else { ThreadSafeSetTreeViewBackColor(SystemColors.Window); var durationStr = duration.ToString(@"hh\:mm\:ss\.fff"); lblTimer.Text = durationStr; logger.Info("Directory tree is built in " + durationStr + " (" + m_Path + ")."); } }
private void MainGameTimerEvent(object sender, EventArgs e) { DrawingControl.SuspendDrawing(this); txtScore.Text = "Score: " + score; player.Top += jumpSpeed; if (goLeft == true) { player.Left -= playerSpeed; } if (goRight == true) { player.Left += playerSpeed; } if (jumping == true && force < 0) { jumping = false; } if (jumping == true) { jumpSpeed = -8; force -= 1; } else { jumpSpeed = 10; } foreach (Control x in this.Controls) { if (x is PictureBox) { if ((string)x.Tag == "platform") { if (player.Bounds.IntersectsWith(x.Bounds)) { force = 8; player.Top = x.Top - player.Height; if ((string)x.Name == "horizontalPlatform" && goLeft == false || (string)x.Name == "horizontalPlatform" && goRight == false) { player.Left -= horizontalSpeed; } } x.BringToFront(); } if ((string)x.Tag == "coin") { if (player.Bounds.IntersectsWith(x.Bounds) && x.Visible == true) { x.Visible = false; score++; } } if ((string)x.Tag == "enemy") { if (player.Bounds.IntersectsWith(x.Bounds)) { gameTime.Stop(); isGameOver = true; txtScore.Text = "Score: " + score + Environment.NewLine + "Oh no! You were killed during your journey!!"; } } } DrawingControl.ResumeDrawing(this); } horizontalPlatform.Left -= horizontalSpeed; if (horizontalPlatform.Left < 0 || horizontalPlatform.Left + horizontalPlatform.Width > this.ClientSize.Width) { horizontalSpeed = -horizontalSpeed; } verticalPlatform.Top += verticalSpeed; if (verticalPlatform.Top < 132 || verticalPlatform.Top > 596) { verticalSpeed = -verticalSpeed; } EnemyOne.Left -= enemyOneSpeed; if (EnemyOne.Left < pictureBox5.Left || EnemyOne.Left + EnemyOne.Width > pictureBox5.Left + pictureBox5.Width) { enemyOneSpeed = -enemyOneSpeed; } EnemyTwo.Left += enemyTwoSpeed; if (EnemyTwo.Left < pictureBox2.Left || EnemyTwo.Left + EnemyTwo.Width > pictureBox2.Left + pictureBox2.Width) { enemyTwoSpeed = -enemyTwoSpeed; } if (player.Top + player.Height > this.ClientSize.Height + 50) { gameTime.Stop(); isGameOver = true; txtScore.Text = "Score: " + score + Environment.NewLine + "You fell to your death!"; } if (player.Bounds.IntersectsWith(Door.Bounds) && score == 43) { gameTime.Stop(); isGameOver = true; txtScore.Text = "Score: " + score + Environment.NewLine + "Congratulations, you completed your quest!"; } else { txtScore.Text = "Score: " + score + Environment.NewLine + "Your quest still needs to be completed to unlock the door!"; } }
private void UpdateControlsDisplay() { // Clear existing nodes and controls flowPanel.SuspendLayout(); DrawingControl.SuspendDrawing(flowPanel); for (int i = currentPageControls.Count - 1; i > 0; i--) { currentPageControls[i].Dispose(); } currentPageControls.Clear(); flowPanel.Controls.Clear(); // Show loading message flowPanel.ResumeLayout(); DrawingControl.ResumeDrawing(flowPanel); flowPanel.Controls.Add(widthGuide); flowPanel.Controls.Add(GenerateHeading("Loading...")); flowPanel.SuspendLayout(); DrawingControl.SuspendDrawing(flowPanel); if (nodes.Count > 0) { Node startingNode = nodes[(pageNumber - 1) * (int)nodesPerPageNumUpDown.Value]; bool lookingForNode = true; int objectIndex = 0; int index = 0; while ((lookingForNode) && (index < allObjects.Count)) { if (allObjects[index] == startingNode) { objectIndex = index; lookingForNode = false; } index++; } if (objectIndex == 1) { currentPageControls.Add(GenerateHeading((string)allObjects[0])); } int nodeCounter = 0; while ((nodeCounter < (int)nodesPerPageNumUpDown.Value) && (objectIndex < allObjects.Count)) { if (allObjects[objectIndex] is Node) { if (((Node)allObjects[objectIndex] == NodeEditPanel.RootNodePanel.DisplayedNode) && (!displayingPageControlPanel)) { currentPageControls.Add(NodeEditPanel.RootNodePanel); } else { NodeEditPanel nodeEditPanel = new NodeEditPanel((Node)allObjects[objectIndex]); currentPageControls.Add(nodeEditPanel); } nodeCounter++; } else if (allObjects[objectIndex] is string) { currentPageControls.Add(GenerateHeading((string)allObjects[objectIndex])); } objectIndex++; } } // Add new nodes/controls flowPanel.Controls.Clear(); flowPanel.Controls.Add(widthGuide); flowPanel.Controls.AddRange(currentPageControls.ToArray()); flowPanel.ResumeLayout(); DrawingControl.ResumeDrawing(flowPanel); }
private void LoadSelectionDetails(int scrollAt = -1) { if (tvCollections.SelectedNode == null) { return; //why?? } try { Cursor = Cursors.WaitCursor; DrawingControl.SuspendDrawing(pCollectionElementDetailsContainer); var seShortInfo = (SeriesEpisodesShortInfo)tvCollections.SelectedNode.Tag; var isElementSeleted = tvCollections.SelectedNode.Level == 2; btnImportElements.Enabled = !isElementSeleted; btnLoadPoster.Enabled = (!isElementSeleted /*&& (CollectionsSiteSectionType)seShortInfo.SectionType == CollectionsSiteSectionType.SeriesType*/) || (isElementSeleted && (CollectionsSiteSectionType)seShortInfo.SectionType == CollectionsSiteSectionType.MovieType); btnRefreshElementData.Enabled = isElementSeleted; btnDeleteElement.Enabled = isElementSeleted; //the collection is deleted by action in the main form toolbar btnAddMovieToCollection.Enabled = (CollectionsSiteSectionType)seShortInfo.SectionType == CollectionsSiteSectionType.MovieType; if (!isElementSeleted) //collection level { ////when moving focus from ElementDetail to CollectionDetail, the "ucCollectionElements" must be removed //var prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucCollectionElements", false); //if (prevInstance.Any()) // pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); //attempting to reuse the "ucCollectionInfo" user control var prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucCollectionInfo", false); if (seShortInfo.Poster == null /*&& (CollectionsSiteSectionType)seShortInfo.SectionType == CollectionsSiteSectionType.SeriesType*/) { seShortInfo.Poster = DAL.GetPoster(seShortInfo.Id); } if (prevInstance.Any()) { ((ucCollectionInfo)prevInstance[0]).RefreshControls(seShortInfo); } else { if (pCollectionElementDetailsContainer.Controls.Count > 0) { pCollectionElementDetailsContainer.Controls.Clear(); } var baseInfoControl = new ucCollectionInfo() { Dock = DockStyle.Top }; baseInfoControl.ParentEl = pCollectionElementDetailsContainer; baseInfoControl.RefreshControls(seShortInfo); pCollectionElementDetailsContainer.Controls.Add(baseInfoControl); } prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucCollectionElements", false); //attempting to reuse the "ucSeriesEpisodes" user control if (prevInstance.Any()) { ((ucCollectionElements)prevInstance[0]).LoadControls(seShortInfo); pCollectionElementDetailsContainer.Invalidate(); } else { if (!_isFiltered) { var ucCollectionElements = new ucCollectionElements(seShortInfo, this) { Dock = DockStyle.Top }; pCollectionElementDetailsContainer.Controls.Add(ucCollectionElements); ucCollectionElements.BringToFront(); } } _prevSelectedSeriesId = seShortInfo.Id; } else { var opRes = DAL.LoadMTD(seShortInfo.Id, true); if (!opRes.Success) { MsgBox.Show(string.Format("The following error occurred while loading the file details:{0}{0}{1}", Environment.NewLine, opRes.CustomErrorMessage), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucCollectionElements", false); if (prevInstance.Any()) { pCollectionElementDetailsContainer.Controls.Clear(); } switch ((CollectionsSiteSectionType)seShortInfo.SectionType) { case CollectionsSiteSectionType.MovieType: prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucEpisodeDetails", false); if (prevInstance.Any()) { pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); } prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucMovieInfo", false); if (prevInstance.Any()) { ((ucMovieInfo)prevInstance[0]).RefreshControls(DAL.CurrentMTD); } else { var ucMovieInfo = new ucMovieInfo(false) { Dock = DockStyle.Top }; ucMovieInfo.RefreshControls(DAL.CurrentMTD); pCollectionElementDetailsContainer.Controls.Add(ucMovieInfo); ucMovieInfo.BringToFront(); } break; case CollectionsSiteSectionType.SeriesType: prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucMovieInfo", false); if (prevInstance.Any()) { pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); } prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucEpisodeDetails", false); if (prevInstance.Any()) { ((ucEpisodeDetails)prevInstance[0]).LoadControls(seShortInfo.Id, null, "aaaa"); } else { var seriesNode = tvCollections.AllNodes.FirstOrDefault(x => ((SeriesEpisodesShortInfo)x.Tag).Id == seShortInfo.SeriesId && ((SeriesEpisodesShortInfo)x.Tag).IsSeries); var seriesName = seriesNode == null ? "unknown !!!" : ((SeriesEpisodesShortInfo)seriesNode.Tag).FileName; var ucEpisodeDetails = new ucEpisodeDetails(seShortInfo.Id, seShortInfo.SeriesId, seriesName) { Dock = DockStyle.Top }; pCollectionElementDetailsContainer.Controls.Add(ucEpisodeDetails); ucEpisodeDetails.BringToFront(); } break; } } /* * var prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucCollectionInfo", false); * * if (!isElementSeleted) * { * if (prevInstance.Any()) * { * ((ucCollectionInfo)prevInstance[0]).RefreshControls(seShortInfo); * } * else * { * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucMovieInfo", false); * if (prevInstance.Any()) * pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); * * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucEpisodeDetails", false); * if (prevInstance.Any()) * pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); * * var ucCol = new ucCollectionInfo() { Dock = DockStyle.Top }; * ucCol.RefreshControls(seShortInfo); * * pCollectionElementDetailsContainer.Controls.Add(ucCol); * } * } * else * { * if (prevInstance.Any()) //the CollectionInfo UserControl * pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); * * var opRes = DAL.LoadMTD(seShortInfo.Id, true); * * if (!opRes.Success) * { * MsgBox.Show(string.Format("The following error occurred while loading the file details:{0}{0}{1}", Environment.NewLine, opRes.CustomErrorMessage), * "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } * * * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucCollectionInfo", false); * * switch ((CollectionsSiteSectionType)seShortInfo.SectionType) * { * case CollectionsSiteSectionType.MovieType: * * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucEpisodeDetails", false); * if (prevInstance.Any()) * pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); * * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucMovieInfo", false); * * if (prevInstance.Any()) * ((ucMovieInfo)prevInstance[0]).RefreshControls(DAL.CurrentMTD); * else * { * var ucMovieInfo = new ucMovieInfo(false) { Dock = DockStyle.Top }; * ucMovieInfo.RefreshControls(DAL.CurrentMTD); * * pCollectionElementDetailsContainer.Controls.Add(ucMovieInfo); * ucMovieInfo.BringToFront(); * } * * break; * * case CollectionsSiteSectionType.SeriesType: * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucMovieInfo", false); * if (prevInstance.Any()) * pCollectionElementDetailsContainer.Controls.Remove(prevInstance[0]); * * prevInstance = pCollectionElementDetailsContainer.Controls.Find("ucEpisodeDetails", false); * * if (prevInstance.Any()) * ((ucEpisodeDetails)prevInstance[0]).LoadControls(seShortInfo.Id, null, "aaaa"); * else * { * var seriesNode = tvCollections.AllNodes.FirstOrDefault(x => ((SeriesEpisodesShortInfo)x.Tag).Id == seShortInfo.SeriesId && ((SeriesEpisodesShortInfo)x.Tag).IsSeries); * var seriesName = seriesNode == null * ? "unknown !!!" * : ((SeriesEpisodesShortInfo)seriesNode.Tag).FileName; * * var ucEpisodeDetails = new ucEpisodeDetails(seShortInfo.Id, seShortInfo.SeriesId, seriesName) { Dock = DockStyle.Top }; * * pCollectionElementDetailsContainer.Controls.Add(ucEpisodeDetails); * ucEpisodeDetails.BringToFront(); * } * * break; * } * } */ } finally { if (scrollAt > -1) { pCollectionElementDetailsContainer.VerticalScroll.Value = scrollAt; } SetSaveButtonState(false); DrawingControl.ResumeDrawing(pCollectionElementDetailsContainer); pCollectionElementDetailsContainer.PerformLayout(); //to refresh the vertical scrollbar Cursor = Cursors.Default; } }