/// <summary> /// Refresh which tabs are showing /// </summary> private void RefreshTabs() { tabcontrl.TabPages.Clear(); weekctrls.Clear(); for (int i = 0; i < Settings.Instance.rotaweekcount; i++) { //create a new work control WeekCtrl newone = new WeekCtrl(); //create a tab page for it KRBTabControl.TabPageEx page = new KRBTabControl.TabPageEx("Week " + (i + 1).ToString()) { IsClosable = false }; //add the new week contrl to the tabpage page.Controls.Add(newone); //set the week control to be fill docked newone.Dock = System.Windows.Forms.DockStyle.Fill; //add the tab page to the control tabcontrl.TabPages.Add(page); //add the week control to our list of em weekctrls.Add(newone); } tabcontrl.TabPages.Add(overviewTabPage); }
private void weekSelectionCombo_SelectedIndexChanged(object sender, EventArgs e) { try { RotaPeriod rp = (weekSelectionCombo.SelectedItem as ComboItem).obj as RotaPeriod; DateTime first = rp.dateFrom; WorkerManager.Instance.IgnoreControlRefresh = true; ServiceUserManager.Instance.IgnoreControlRefresh = true; CallManager.Instance.CurrentRotaPeriodStart = first; CurrentPeriodDateStart = first; for (int i = 0; i < weekctrls.Count; i++) { WeekCtrl weekCtrl = weekctrls[i]; //set the date the period starts weekCtrl.PeriodStartDate = first; //set which week of the period this is weekCtrl.WeekStartDate = first.AddDays(i * 7); } ((PeriodOverviewCtrl)overviewTabPage.Controls[0]).PeriodStartDate = first; WorkerManager.Instance.IgnoreControlRefresh = false; ServiceUserManager.Instance.IgnoreControlRefresh = false; WorkerManager.Instance.RefreshControls(true, false, false); ServiceUserManager.Instance.RefreshControls(true, false, false); } catch (Exception ex) { Cura.Common.Common.LogError("Error Selecting Rota Period", ex); } }