Esempio n. 1
0
 private void AddDatabaseFileButton_Click(object sender, EventArgs e)
 {
     if (DatabaseFileDialog.ShowDialog() == DialogResult.OK)
     {
         string pathToDB = DatabaseFileDialog.FileName;
         OdbcConnectionStringBuilder connectionString = Database.ConnectionString(pathToDB);
         if (Database.Initialize(connectionString))
         {
             AddDatabaseFileButton.Enabled = false;
             SetDBFile(pathToDB);
             SessionStatusLabel.Text         = "Session Running";
             SessionStatusLabel.ForeColor    = Color.Green;
             OptionsButton.Visible           = true;
             AddHandRecordFileButton.Visible = true;
             HandsList handsList = new HandsList(connectionString);
             if (handsList.Count > 0)
             {
                 AddHandRecordFileButton.Enabled = false;
                 PathToHandRecordFileLabel.Text  = "Included in Scoring Database";
                 AnalysingLabel.Text             = "Analysing...";
                 AnalysingLabel.Visible          = true;
                 AnalysingProgressBar.Visible    = true;
                 AnalysisCalculationBackgroundWorker.RunWorkerAsync();
             }
         }
     }
 }
Esempio n. 2
0
        private void TabScoreForm_Load(object sender, EventArgs e)
        {
            Text = $"TabScoreStarter - Version {Assembly.GetExecutingAssembly().GetName().Version}";

            string argsString = "", pathToDB = "";

            string[] arguments = Environment.GetCommandLineArgs();

            // Parse command line args correctly to get DB path
            foreach (string s in arguments)
            {
                argsString = argsString + s + " ";
            }
            arguments = argsString.Split(new Char[] { '/' });
            foreach (string s in arguments)
            {
                if (s.StartsWith("f:["))
                {
                    pathToDB = s.Split(new char[] { '[', ']' })[1];
                    break;
                }
            }

            if (pathToDB != "" && !File.Exists(pathToDB))
            {
                MessageBox.Show("Database passed in parameter string either does not exist or is not accessible", "TabScoreStarter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                pathToDB = "";
            }
            OdbcConnectionStringBuilder connectionString = null;

            if (pathToDB != "")
            {
                connectionString = Database.ConnectionString(pathToDB);
            }
            if (!Database.Initialize(connectionString))
            {
                AddDatabaseFileButton.Visible = true;   // No valid database in arguments
            }
            else
            {
                SetDBFile(pathToDB);
                SessionStatusLabel.Text         = "Session Running";
                SessionStatusLabel.ForeColor    = Color.Green;
                OptionsButton.Visible           = true;
                AddHandRecordFileButton.Visible = true;
                HandsList handsList = new HandsList(connectionString);
                if (handsList.Count > 0)
                {
                    AddHandRecordFileButton.Enabled = false;
                    PathToHandRecordFileLabel.Text  = "Included in Scoring Database";
                    AnalysingLabel.Text             = "Analysing...";
                    AnalysingLabel.Visible          = true;
                    AnalysingProgressBar.Visible    = true;
                    AnalysisCalculationBackgroundWorker.RunWorkerAsync();
                }
            }
        }
Esempio n. 3
0
        private void StartSession()
        {
            PathToDBLabel.Text = pathToDB;
            string pathToTabPlayDB = Environment.ExpandEnvironmentVariables(@"%Public%\TabPlay\TabPlayDB.txt");

            System.IO.File.WriteAllText(pathToTabPlayDB, Database.ConnectionString(pathToDB).ToString());
            SessionStatusLabel.Text      = "Session Running";
            SessionStatusLabel.ForeColor = Color.Green;
            OptionsButton.Visible        = true;
            AnalysingLabel.Text          = "Analysing...";
            AnalysingLabel.Visible       = true;
            AnalysingProgressBar.Visible = true;
            AnalysisCalculationBackgroundWorker.RunWorkerAsync();
        }
Esempio n. 4
0
 private void AddHandRecordFileButton_Click(object sender, EventArgs e)
 {
     if (HandRecordFileDialog.ShowDialog() == DialogResult.OK)
     {
         PathToHandRecordFileLabel.Text = HandRecordFileDialog.FileName;
         HandsList handsList = new HandsList(HandRecordFileDialog.FileName);
         if (handsList.Count == 0)
         {
             MessageBox.Show("File contains no hand records", "TabScoreStarter", MessageBoxButtons.OK);
         }
         else
         {
             handsList.WriteToDB(Database.ConnectionString(PathToDBLabel.Text));
             AddHandRecordFileButton.Enabled = false;
             AnalysingLabel.Text             = "Analysing...";
             AnalysingLabel.Visible          = true;
             AnalysingProgressBar.Visible    = true;
             AnalysisCalculationBackgroundWorker.RunWorkerAsync();
         }
     }
 }