/// <summary> /// Start logging and write logs into logfile /// </summary> /// <param name="logFilePath">logfile path + filename</param> /// <param name="backupFileCount">number of backup files to be created circularly</param> public void StartLogging(string logFilePath = "", int backupFileCount = 1) { // enable re-entrance if (!LoggingHasBeenStarted) { if (logFilePath != "") { try { FileInfo fi = new FileInfo(logFilePath); logFilePath = fi.FullName; // resolve logfile path to full name to be independent of "System.Environment.CurrentDirectory" which might change within the current thread (or process) } catch (Exception ex) { Log(LogSeverityType.Error, $"Failed to start logging: Logfile path '{logFilePath}' is not valid: '{ex.Message}'"); return; // error } // start log writer Logger.StartLogFileWriter(logFilePath, false, backupFileCount, LogFilterCallBack); LogFileWriterHasBeenStarted = true; } LogFilePath = logFilePath; // subscribe log call event handler to log call event Logger.LogCall += new Logger.LogEventHandler(OnLogIntoListView); LoggingHasBeenStarted = true; Log((object)(ParentForm.ToString().StartsWith(ParentForm.GetType().ToString()) ? ParentForm.Text : ParentForm.ToString()), LogSeverityType.Info, "Start Logging..."); } }
private void FormOpen(FrmMatricula obj) { if (ParentForm != null && ParentForm.GetType() == typeof(FrmPrincipal)) { ((FrmPrincipal)ParentForm).OpenForm(obj, "Cadastro de Matrículas"); } Close(); }
private void FormOpen(FrmAlunoEdicao obj) { if (ParentForm != null && ParentForm.GetType() == typeof(FrmPrincipal)) { ((FrmPrincipal)ParentForm).OpenForm(obj, "Edição do Aluno"); } Close(); }
private void FormOpen(FrmMatriculaEdicao obj) { if (ParentForm != null && ParentForm.GetType() == typeof(FrmPrincipal)) { ((FrmPrincipal)ParentForm).OpenForm(obj, "Edição da Matrícula"); } Close(); }
private void FormClose() { if (ParentForm != null && ParentForm.GetType() == typeof(FrmPrincipal)) { ((FrmPrincipal)ParentForm).OpenForm(new FrmAluno(), "Cadastro de Alunos"); } Close(); }
private void NotePanel_Load(object sender, EventArgs e) { if (ParentForm == null || ParentForm.GetType() != typeof(Form1)) { return; } ControlUtil.SetContextMenuStrip(this, new[] { nodeTextTextBox, noteTitleTextBox }); }
private void SearchInFilesPanel_Load(object sender, EventArgs e) { if (ParentForm == null || ParentForm.GetType() != typeof(Form1)) { return; } ControlUtil.SetContextMenuStrip(this, new[] { infoDirLabel, infoTextLabel }); }
private void btnLogoff_Click(object sender, EventArgs e) { if (ParentForm != null && ParentForm.GetType() == typeof(FrmUI)) { ((FrmUI)ParentForm).OpenForm(new FrmLogin()); } Close(); }
private void CalculatorPanel_Load(object sender, EventArgs e) { if (ParentForm == null || ParentForm.GetType() != typeof(Form1)) { return; } ControlUtil.SetContextMenuStrip(this, new[] { calculationTextBox, calcTextBox }); }
private void FilePanel_Load(object sender, EventArgs e) { if (ParentForm == null || ParentForm.GetType() != typeof(Form1)) { return; } ControlUtil.SetContextMenuStrip(this, pathTextBox); }
private void SearchPanel_Load(object sender, EventArgs e) { if (ParentForm == null || ParentForm.GetType() != typeof(Form1)) { return; } ControlUtil.SetContextMenuStrip(this, new[] { searchTextBox, replaceTextBox }); }
/// <summary> /// 初期子画面の配置 /// </summary> public static void InitShowChildForm() { foreach (var row in Static.ShiwakeDs.FormPosition) { if (row.FormName != ParentForm.GetType().FullName) { var t = Type.GetType(row.FormName); ShowChildForm(t, row.Height, row.Width, row.Top, row.Left); } } }
private void BtnImprimir_Click(object sender, EventArgs e) { try { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod("Imprimir"); mi.Invoke(ParentForm, null); } catch (Exception ex) { } }
private void BtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod("Editar"); mi.Invoke(ParentForm, null); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
private void FormClose() { if (ParentForm != null && ParentForm.GetType() == typeof(FrmPrincipal)) { FrmMatricula frmMatricula = new FrmMatricula(); if (_objAluno != null) { frmMatricula = new FrmMatricula(_objAluno); } if (_objTurma != null) { frmMatricula = new FrmMatricula(_objTurma); } ((FrmPrincipal)ParentForm).OpenForm(frmMatricula, "Cadastro do Matrículas"); } Close(); }
private void NewPolicySnapshotFrequencyPage_ParentChanged(object sender, EventArgs e) { if (Parent == null || ParentForm == null) { return; } var parentFormType = ParentForm.GetType(); if (parentFormType == typeof(XenWizardBase)) { sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.Window; } else if (parentFormType == typeof(PropertiesDialog)) { sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.ActiveBorder; } }
private void btnLogin_Click(object sender, EventArgs e) { var user = new Core.Model.Usuario().Login(txtUser.Text, txtPass.Text); if (user == null) { Error("Usuário ou senha inválido"); return; } if (!user.St_Ativo) { Error("Usuario inativo. Entre em contato com o Administrador de sistemas"); return; } if (ParentForm != null && ParentForm.GetType() == typeof(FrmUI)) { ((FrmUI)ParentForm).OpenForm(new FrmPrincipal(user)); } Close(); }
private void btnVoltar_Click(object sender, EventArgs e) { Form obj = new Form(); string TxHeader = "Página Inicial"; if (_objAluno != null) { obj = new FrmAluno(); TxHeader = "Cadastro de Alunos"; } if (_objTurma != null) { obj = new FrmTurma(); TxHeader = "Cadastro de Turmas"; } if (ParentForm != null && ParentForm.GetType() == typeof(FrmPrincipal)) { ((FrmPrincipal)ParentForm).OpenForm(obj, TxHeader); } Close(); }
private void BtnExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (String.IsNullOrEmpty(Mexcel)) { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod("Excel"); mi.Invoke(ParentForm, null); } else { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod(Mexcel); mi.Invoke(ParentForm, null); } } catch (Exception ex) { } }
private void BtnAceptar_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(Maceptar)) { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod("Accept"); mi.Invoke(ParentForm, null); } else { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod(Maceptar); mi.Invoke(ParentForm, null); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
private void RefreshTab(VMSS policy) { if (ParentForm != null) { var parentFormType = ParentForm.GetType(); if (parentFormType == typeof(XenWizardBase)) { sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.Window; } else if (parentFormType == typeof(PropertiesDialog)) { sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.ActiveBorder; } } switch (policy.frequency) { case vmss_frequency.hourly: radioButtonHourly.Checked = true; SetHourlyMinutes(Convert.ToDecimal(policy.backup_schedule_min)); break; case vmss_frequency.daily: radioButtonDaily.Checked = true; dateTimePickerDaily.Value = new DateTime(1970, 1, 1, Convert.ToInt32(policy.backup_schedule_hour), Convert.ToInt32(policy.backup_schedule_min), 0); break; case vmss_frequency.weekly: radioButtonWeekly.Checked = true; dateTimePickerWeekly.Value = new DateTime(1970, 1, 1, Convert.ToInt32(policy.backup_schedule_hour), Convert.ToInt32(policy.backup_schedule_min), 0); daysWeekCheckboxes.Days = policy.backup_schedule_days; break; } numericUpDownRetention.Value = policy.retained_snapshots; }
private void BtnAñadir_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (String.IsNullOrEmpty(Mañadir)) { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod("Añadir"); mi.Invoke(ParentForm, null); } else { Type cType = ParentForm.GetType(); MethodInfo mi = cType.GetMethod(Mañadir); mi.Invoke(ParentForm, null); } } catch (Exception ex) { //XtraMessageBox.Show(ex.ToString(),"Genral Ledger",Mes) } }
/// <summary> /// Consumer method that processes mouse events in <see cref="MouseEvents" /> that are recorded by <see cref="MouseHookCallback" /> /// </summary> protected void InterpretMouseEvents() { foreach (MouseEvent mouseEvent in MouseEvents.GetConsumingEnumerable()) { int nCode = mouseEvent.nCode; IntPtr wParam = mouseEvent.wParam; MSLLHOOKSTRUCT?hookStruct = mouseEvent.MouseData; if (nCode >= 0 && (int)WM.WM_MOUSEMOVE == (int)wParam) { Point cursorPosition = new Point(hookStruct.Value.pt.x, hookStruct.Value.pt.y); bool reRender = false; if (s_tornTab != null && DropAreas != null) { for (int i = 0; i < DropAreas.Length; i++) { if (DropAreas[i].Item2.Contains(cursorPosition)) // If the cursor is within the drop area, combine the tab for the window that belongs to that drop area { TitleBarTab tabToCombine = null; lock (s_tornTabLock) { if (s_tornTab != null) { tabToCombine = s_tornTab; s_tornTab = null; } } if (tabToCombine != null) { int i1 = i; Invoke(new Action(() => { DropAreas[i1].Item1.TabRenderer.CombineTab(tabToCombine, cursorPosition); tabToCombine = null; s_tornTabForm.Close(); s_tornTabForm = null; if (ParentForm.Tabs.Count == 0) { ParentForm.Close(); } })); } } } } else if (!ParentForm.TabRenderer.IsTabRepositioning) { // If we were over a close button previously, check to see if the cursor is still over that tab's close button; if not, re-render if (IsOverCLoseButtonForTab != -1 && (IsOverCLoseButtonForTab >= ParentForm.Tabs.Count || !ParentForm.TabRenderer.IsOverCloseButton(ParentForm.Tabs[IsOverCLoseButtonForTab], GetRelativeCursorPosition(cursorPosition)))) { reRender = true; IsOverCLoseButtonForTab = -1; } else // Otherwise, see if any tabs' close button is being hovered over { for (int i = 0; i < ParentForm.Tabs.Count; i++) { if (ParentForm.TabRenderer.IsOverCloseButton(ParentForm.Tabs[i], GetRelativeCursorPosition(cursorPosition))) { IsOverCLoseButtonForTab = i; reRender = true; break; } } } } else { Invoke(new Action(() => { s_wasDragging = true; Rectangle dragArea = TabDropArea; dragArea.Inflate(ParentForm.TabRenderer.TabTearDragDistance, ParentForm.TabRenderer.TabTearDragDistance); if (!dragArea.Contains(cursorPosition) && s_tornTab == null) { lock (s_tornTabLock) { if (s_tornTab == null) { ParentForm.TabRenderer.IsTabRepositioning = false; s_tornTab = ParentForm.SelectedTab; s_tornTab.ClearEventSubscriptions(); s_tornTabForm = new TornTabForm(s_tornTab, ParentForm.TabRenderer); } } if (s_tornTab != null) { ParentForm.SelectedTabIndex = ParentForm.SelectedTabIndex == ParentForm.Tabs.Count - 1 ? ParentForm.SelectedTabIndex - 1 : ParentForm.SelectedTabIndex + 1; ParentForm.Tabs.Remove(s_tornTab); if (ParentForm.Tabs.Count == 0) { ParentForm.Hide(); } s_tornTabForm.Show(); DropAreas = (from window in ParentForm.ApplicationContext.OpenWindows.Where(w => w.Tabs.Count > 0) select new Tuple <TitleBarTabs, Rectangle>(window, window.TabDropArea)).ToArray(); } } })); } Invoke(new Action(() => OnMouseMove(new MouseEventArgs(MouseButtons.None, 0, cursorPosition.X, cursorPosition.Y, 0)))); if (ParentForm.TabRenderer.IsTabRepositioning) { reRender = true; } if (reRender) { Invoke(new Action(() => Render(cursorPosition, true))); } } else if (nCode >= 0 && (int)WM.WM_LBUTTONDOWN == (int)wParam) { s_wasDragging = false; } else if (nCode >= 0 && (int)WM.WM_LBUTTONUP == (int)wParam) { if (s_tornTab != null) { TitleBarTab tabToRelease = null; lock (s_tornTabLock) { if (s_tornTab != null) { tabToRelease = s_tornTab; s_tornTab = null; } } if (tabToRelease != null) { Invoke(new Action(() => { TitleBarTabs newWindow = (TitleBarTabs)Activator.CreateInstance(ParentForm.GetType()); if (newWindow.WindowState == FormWindowState.Maximized) { Screen screen = Screen.AllScreens.First(s => s.WorkingArea.Contains(Cursor.Position)); newWindow.StartPosition = FormStartPosition.Manual; newWindow.WindowState = FormWindowState.Normal; newWindow.Left = screen.WorkingArea.Left; newWindow.Top = screen.WorkingArea.Top; newWindow.Width = screen.WorkingArea.Width; newWindow.Height = screen.WorkingArea.Height; } else { newWindow.Left = Cursor.Position.X; newWindow.Top = Cursor.Position.Y; } tabToRelease.Parent = newWindow; ParentForm.ApplicationContext.OpenWindow(newWindow); newWindow.Show(); newWindow.Tabs.Add(tabToRelease); newWindow.SelectedTabIndex = 0; newWindow.ResizeTabContents(); s_tornTabForm.Close(); s_tornTabForm = null; if (ParentForm.Tabs.Count == 0) { ParentForm.Close(); } })); } } Invoke(new Action(() => OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, Cursor.Position.X, Cursor.Position.Y, 0)))); } } }