Пример #1
0
        public MainForm()
        {
            InitializeComponent();

            //set a new menu strip
            peopleContext = new ContextMenuStrip();

            TNG_Database.SearchTapeForm child = new TNG_Database.SearchTapeForm(this);
            backgroundWorker1.WorkerReportsProgress = true;
            backgroundWorker1.WorkerSupportsCancellation = true;
            //show the child form
            child.Show();
            child.WindowState = FormWindowState.Maximized;
            searchTapeForm = child;
            currentForm = searchTapeForm;

            //check to see if this is the first time the program has ran
            if (Properties.TNG_Settings.Default.FirstRun)
            {
                //create database
                CreateSQLDatabase();

                SaveExportDate();
            }else if((DateTime.Now - Properties.TNG_Settings.Default.LastDBExport).TotalDays >= Properties.TNG_Settings.Default.DBBackupSetting)
            {
                //check if last time export occurred and backup database
                BackupDatabase();

                SaveExportDate();
            }

            //event for context menu
            peopleContext.Opening += new System.ComponentModel.CancelEventHandler(cms_Opening);

            //set dropdown to context menu
            personStatusDropdown.DropDown = peopleContext;

            //Set the context menu to people context
            //this.ContextMenuStrip = peopleContext;

            //Set all users to list
            people = DataBaseControls.GetAllUsers();

            //set the username at the bottom to current user
            computerInfo.UpdateUserName(this);

            //paste option not enabled until something is in clipboard
            pasteToolStripMenuItem.Enabled = false;

            //set static status label
            updateStatusLabel = applicationStatusLabel;

            //set static progress bar
            progressBar = mainFormProgressBar;
        }
Пример #2
0
        /// <summary>
        /// Opens the search page.
        /// </summary>
        private void OpenSearchPage()
        {
            //create new instance of form
            searchTapeForm = new SearchTapeForm(this);

            //close child of mdi if there is one active
            if (ActiveMdiChild != null)
            {
                if(ActiveMdiChild is SearchTapeForm)
                {
                    Debug.WriteLine("Page Already open...do nothing");
                }else
                {
                    ActiveMdiChild.Close();
                }
            }

            //Show people form and maximize it instantly
            searchTapeForm.Show();
            searchTapeForm.WindowState = FormWindowState.Maximized;

            ResetProgressBar();
        }