示例#1
0
		internal FPatrol(ref Common.Interface newCommon, FPatrols newParentWindow)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			CommonCode = newCommon;
			parentWindow = newParentWindow;
			BindPatrolNumberAndClass += 
				new MethodInvoker(bindPatrolNumberAndClass);
			BindDatagrid += 
				new MethodInvoker(bindDatagrid);
			SetVisibillity += new SetVisibillityHandler(FPatrol_SetVisibillity);

			this.Resize += new EventHandler(FPatrol_Resize);
		}
示例#2
0
        internal FPatrol(ref Common.Interface newCommon, FPatrols newParentWindow)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            CommonCode                = newCommon;
            parentWindow              = newParentWindow;
            BindPatrolNumberAndClass +=
                new MethodInvoker(bindPatrolNumberAndClass);
            BindDatagrid +=
                new MethodInvoker(bindDatagrid);
            SetVisibillity += new SetVisibillityHandler(FPatrol_SetVisibillity);

            this.Resize += new EventHandler(FPatrol_Resize);
        }
示例#3
0
		private void FMainStartup()
		{
			Trace.WriteLine("FMain: FMainStartup started from thread \"" + 
				Thread.CurrentThread.Name + "\" " +
				" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " ) " +
				DateTime.Now.ToLongTimeString());
			Trace.WriteLine("FMainStartup started.");

			try
			{
				getAssemblyVersion();

				// Let's rock'n roll!
				setHeader();

				// Common code
				CommonCode = new Common.Interface();

				// About window
				Trace.WriteLine("Creating about window");
				myAboutWindow = new FAbout();
				myAboutWindow.EnableMain += 
					new MethodInvoker(enableMain);

				// Competition window field
				Trace.WriteLine("Creating Competition field window");
				myCompetitionFieldWindow = new FCompetitionField(ref CommonCode);
				myCompetitionFieldWindow.EnableMain += 
					new FCompetitionField.EnableMainHandler(enableMain);

				// Competition window precision
				Trace.WriteLine("Creating Competition precision window");
				myCompetitionPrecisionWindow = new FCompetitionPrecision(ref CommonCode);
				myCompetitionPrecisionWindow.EnableMain += 
					new FCompetitionPrecision.EnableMainHandler(enableMain);

				// Stations Field window
				Trace.WriteLine("Creating StationField window");
				myStationsFieldWindow = new FStationsField(ref CommonCode);
				myStationsFieldWindow.EnableMain += 
					new FStationsField.EnableMainHandler(enableMain);

				// Stations Ban window
				Trace.WriteLine("Creating StationPrecision window");
				myStationsPrecisionWindow = new FStationsPrecision(ref CommonCode);
				myStationsPrecisionWindow.EnableMain += 
					new FStationsPrecision.EnableMainHandler(enableMain);

				// Clubs window
				Trace.WriteLine("Creating Clubs window");
				myClubsWindow = new FClubs(ref CommonCode);
				myClubsWindow.EnableMain += 
					new FClubs.EnableMainHandler(enableMain);

				// Competitors Window
				Trace.WriteLine("Creating Competitors window");
				myCompetitorsWindow = new FCompetitors(ref CommonCode);
				myCompetitorsWindow.EnableMain+=
					new FCompetitors.EnableMainHandler(enableMain);

				// Weapons Window
				Trace.WriteLine("Creating Weapons window");
				myWeaponsWindow = new FWeapons(ref CommonCode);
				myWeaponsWindow.EnableMain +=
					new FWeapons.EnableMainHandler(enableMain);

				// Patrols Window
				Trace.WriteLine("Creating Patrols window");
				myPatrolsWindow = new FPatrols(ref CommonCode);
				myPatrolsWindow.EnableMain +=
					new FPatrols.EnableMainHandler(enableMain);

				// Results Window
				Trace.WriteLine("Creating Results window");
				myResultsWindow = new FResults(ref CommonCode);
				myResultsWindow.EnableMain +=
					new FResults.EnableMainHandler(enableMain);
				myResultsWindow.PrintPatrolResult +=
					new FResults.PrintPatrolResultHandler(menuPrintPrelResultPatrol_Print);

				// ResultsView Window
				Trace.WriteLine("Creating ResultsView window");
				myResultsViewWindow = new FResultsView(ref CommonCode);
				myResultsViewWindow.EnableMain +=
					new FResultsView.EnableMainHandler(enableMain);

				// Import Window
				Trace.WriteLine("Creating Import window");
				myImportWindow = new FImport(ref CommonCode);
				myImportWindow.EnableMain +=
					new FImport.EnableMainHandler(enableMain);

				// ServerConnect Window
				Trace.WriteLine("Creating ServerConnect window");
				myServerConnectWindow = new FServerConnect();
				myServerConnectWindow.EnableMain +=
					new FServerConnect.EnableMainHandler(enableMain);
				myServerConnectWindow.ConnectToServer +=
					new FServerConnect.ConnectToServerHandler(ConnectToServer);

				// Teams Window
				Trace.WriteLine("Create Teams Window");
				myTeamsWindow = new FTeams(ref CommonCode);
				myTeamsWindow.EnableMain +=
					new FTeams.EnableMainHandler(enableMain);

				// Settings window
				Trace.WriteLine("Create settings window");
				mySettingsWindow = new FSettings(ref CommonCode);
				mySettingsWindow.EnableMain +=
					new FSettings.EnableMainHandler(enableMain);

				// Updating handlers
				Trace.WriteLine("Updating Handlers.");
				CommonCode.UpdatedCompetition += 
					new MethodInvoker(
					CommonCode_UpdatedCompetition);
				CommonCode.UpdatedStation +=
					new MethodInvoker(
					CommonCode_UpdatedStation);
				CommonCode.UpdatedClub +=
					new MethodInvoker(
					CommonCode_UpdatedClub);
				CommonCode.UpdatedWeapon +=
					new MethodInvoker(
					CommonCode_UpdatedWeapon);
				CommonCode.UpdatedShooter+=
					new MethodInvoker(
					CommonCode_UpdatedShooter);
				CommonCode.UpdatedCompetitor +=
					new MethodInvoker(
					CommonCode_UpdatedCompetitor);
				CommonCode.UpdatedCompetitorResult +=
					new MethodInvoker(
					CommonCode_UpdatedCompetitorResult);
				CommonCode.UpdatedPatrol +=
					new MethodInvoker(
					CommonCode_UpdatedPatrol);
				CommonCode.UpdatedTeam +=
					new MethodInvoker(
					CommonCode_UpdatedTeam);

				//assemblyDir =
				//	System.IO.Directory.GetCurrentDirectory();

				// Activate main window
				Trace.WriteLine("Activating main window");
				menuFile.Enabled = true;
				Activate();
#if VisualStudio	
				// If mono, no splash
				FSplash.RemoveSplash();
#endif

				// Autoopen
				if (FilenameToOpen != null)
				{
					FileOpen(FilenameToOpen);
				}

#if !VisualStudio
				// If this is mono, ADOX is not supported
				menuFileNew.Visible = false;
				menuFileOpen.Visible = false;
				menuFileLine1.Visible = false;
				
				// If this is mono, printing is not supported
				menuPrint.Visible = false;
				
				// If this is linux, IE is not supported. This is possible with mono
				menuHelpInternet.Visible = false;
				menuHelpInternetSupport.Visible = false;
				menuHelpInternetAllberg.Visible = false;
#endif

#if DEBUG
				menuFileUpdateBeta.Visible = true;
#endif

#if DEBUG
				checkForNewerVersion(false);
#else
				// Check if there is a newer version
				Thread updateVersionThread = 
					new Thread(
					new ThreadStart(checkForNewerVersion));
				updateVersionThread.Name = "updateVersionThread";
				updateVersionThread.IsBackground = true;
				updateVersionThread.Start();
#endif

#if DEBUG
				menuTestErrorHandling.Visible=true;
#endif

				if (DateTime.Now.Month == 4 &&
					DateTime.Now.Day == 1)
				{
					timerEasterEgg.Enabled = true;
					timerEasterEgg.Start();
				}
				Trace.WriteLine("FMain: Successfully created from thread.");
			}
			catch(Exception exc)
			{
#if VisualStudio
				// If mono, no splash
				FSplash.RemoveSplash();
#endif
				Trace.WriteLine("Exception during init of FMain:" + exc.ToString());
				MessageBox.Show("Ett fel uppstod vid start av WinShooter:\r\n" + exc.ToString());
			}
			finally
			{
				Trace.WriteLine("FMain: (Finally) created from thread \"" + 
					Thread.CurrentThread.Name + "\" " +
					" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " ) " +
					DateTime.Now.ToLongTimeString());
			}
		}