private void MainApp_Load(object sender, System.EventArgs e) { tclm.StringDel += new CTCLManager.InitStringDelegate(LoadLanguageStrings); LoadLanguageStrings(); formMain = new FormMain(); formMain.MdiParent = this; formMain.Show(); formMain.BringToFront(); // bind the visible control to the data menu = formMain.LocalMenu; menu.CommandLeaveApplication += new EventHandler(menu_CommandLeaveApplication); menu.CommandShutDown += new EventHandler(menu_CommandShutDown); //Form tmpForm = menu.FindForm(Type.GetType("TcApplication.FormMessages")); Form tmpForm = menu.GetForm("FormMessages"); if (tmpForm != null) { AppHeader.EventLogLine.DataAdapter = ((FormMessages)tmpForm).tcEventLoggerData1; } // bind the menu to the header AppHeader.Menu = menu; Program.SplashTopMost(true); Program.CloseSplashScreen(500); timerStartUp = new Timer(); timerStartUp.Tick += new EventHandler(timerStartUp_Tick); timerStartUp.Interval = 1; timerStartUp.Enabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="FormMain"/> class. /// </summary> public FormMain() { InitializeComponent(); MainApp mainApp = MainApp.GetDoc(); // get the TcLM and set to the base class tclm = mainApp.GetTCLanguageManager(); menu = new TcMenu(this, tclm, mainApp.tcFKey1); menu.UserAdmin = mainApp.tcUserAdmin1; menu.FormsList.Add("FormMain", this); // set the created menu to the base class LocalMenu = menu; bool autoLogOn = mainApp.tcUserAdmin1.CurrentUser.AutoLogOn; if (autoLogOn == false) { Program.CloseSplashScreen(500); } else { Program.CloseSplashScreen(3000); } mainApp.tcUserAdmin1.LogOnDialog(true, autoLogOn); // base settings menu.ShowForm("FormMain"); menu.SetFunctionKeys(mainApp.tcFKey1); // This is only needed at the main form, because the delegate from the menu cannot be called // because activation is not done. SetFKeyText(mainApp.tcFKey1); // adds the global objects to the object list menu.AddObject(mainApp.AdsPlcServer); menu.AddObject(mainApp.AdsNcServer); menu.AddObject(MainApp.log); // At the end of menu initialization // This function calls the forms initialisation which needs the added objects menu.InitializationDone(); }