Example #1
0
        /// <summary>
        /// This method will start the application
        /// </summary>
        static void StartApplication(string[] args)
        {
            // Load the settings etc
            StartupSettings startup = new StartupSettings();
            startup.Settings.IsAutoStart = AutoStart(args);

			ProcessTestParams(startup, args);

            Form main = null;

            try
            {
				main = new MainForm(startup);

                if (main != null && main.IsDisposed == false)
                {
                    Application.Run(main);
                }
            }
            finally
            {
                if (main != null && main.IsDisposed == false)
                    main.Dispose();
            }
        }
Example #2
0
		private static void ProcessTestParams(StartupSettings startup, string[] args)
		{
			for (int i = 0; i < args.Length; ++i)
			{
				string arg = args[i];
                if (arg.IndexOf("runtests", 0, StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    startup.Settings.ScanEmail = true;
                    startup.Settings.IsRunningTest = true;
                }

				if (arg.IndexOf("o:", 0, StringComparison.InvariantCultureIgnoreCase) > -1)
				{
					//look for the file param in the next arg
					if ((i + 1) < args.Length)
					{
						string outputFileArg = args[i + 1];

						outputFileArg.Replace("\"", String.Empty);
						outputFileArg.Trim();

						startup.Settings.OutputFile = outputFileArg;
					}
				}

				if (arg.IndexOf("mailfolder:", 0, StringComparison.InvariantCultureIgnoreCase) > -1)
				{
					//look for the folder name param in the next arg
					if ((i + 1) < args.Length)
					{
						string folderArg = args[i + 1];
						folderArg.Replace("\"", String.Empty);
						folderArg.Trim();

						startup.Settings.TestFolder = folderArg;
					}
				}
			}
		}
Example #3
0
        public MainForm(StartupSettings startup)
        {
            if (startup != null)
                m_startup = startup;

            BaseView.Settings = m_startup.Settings;

            InitializeComponent();
            tbMain.TabPages.Remove(tpSummary);
            tbMain.TabPages.Remove(tpAudit);

            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
                ControlStyles.OptimizedDoubleBuffer, true);

            BaseView.View = lvView;
            BaseView.CurrentScan.Messages.OnAdded += OnMessageAdded;
            try
            {
                SetupLogTracing();
                // Retrieves the BufferedGraphicsContext for the 
                // current application domain.
                m_context = BufferedGraphicsManager.Current;

                // Sets the maximum size for the primary graphics buffer
                // of the buffered graphics context for the application
                // domain.  Any allocation requests for a buffer larger 
                // than this will create a temporary buffered graphics 
                // context to host the graphics buffer.
                m_context.MaximumBuffer = new Size(lstAudit.Width + 1, lstAudit.Height + 1);

                // Allocates a graphics buffer the size of this form
                // using the pixel format of the Graphics created by 
                // the Form.CreateGraphics() method, which returns a 
                // Graphics object that matches the pixel format of the form.
                m_grafx = m_context.Allocate(CreateGraphics(),
                    new Rectangle(0, 0, lstAudit.Width, lstAudit.Height));

                // Check if the OS will support these features.
                if (OSFeature.Feature.IsPresent(OSFeature.Themes))
                    m_isGroupingEnabled = true;
                m_startup.Settings.Minimise = false;
                m_startup.Settings.HideMinimise = false;
                BuildNotifyMenu();
                niSys.Visible = false;
                m_startup.Settings.FoldersToScan.FoldersToScanUpdated += OnFoldersToScanUpdated;
                m_startup.Settings.FcsFolderToScanUpdated += OnFcsFolderToScanUpdated;
                SetupAuditTracing();
            }
            catch (COMException e)
            {
                System.Diagnostics.Trace.WriteLine("Cannot access Email - " + e.Message);
                const MessageBoxOptions options = 0;
                MessageBox.Show(this, Properties.Resources.EMAIL_NOACCESS,
                                        Properties.Resources.EMAIL_NOACCESS_CAPTION,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error,
                                        MessageBoxDefaultButton.Button1,
                                        options);
                Close();
            }
        }