<commit_before>using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProjectTracker.Library;
using Csla.Security;

namespace PTWin
{
  public partial class MainForm : Form
  {
    public MainForm()
    {
      InitializeComponent();
      _main = this;
    }

    private static MainForm _main;

    internal static MainForm Instance
    {
      get { return _main; }
    }

    private void MainForm_Load(object sender, EventArgs e)
    {
      if (Csla.ApplicationContext.AuthenticationType == "Windows")
        AppDomain.CurrentDomain.SetPrincipalPolicy(
          System.Security.Principal.PrincipalPolicy.WindowsPrincipal);
      else
        DoLogin();
      if (DocumentCount == 0)
        this.DocumentsToolStripDropDownButton.Enabled = false;
      ApplyAuthorizationRules();
    }

    #region Projects

    private void NewProjectToolStripMenuItem_Click(
      object sender, EventArgs e)
    {
      using (StatusBusy busy = 
        new StatusBusy("Creating project..."))
      {
        AddWinPart(new ProjectEdit(Project.NewProject()));
      }
    }

    private void EditProjectToolStripMenuItem_Click(
      object sender, EventArgs e)
    {
      using (ProjectSelect dlg = new ProjectSelect())
      {<commit_msg>Fix issue where ApplyAuthorizationRules was called twice.<commit_after>using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProjectTracker.Library;
using Csla.Security;

namespace PTWin
{
  public partial class MainForm : Form
  {
    public MainForm()
    {
      InitializeComponent();
      _main = this;
    }

    private static MainForm _main;

    internal static MainForm Instance
    {
      get { return _main; }
    }

    private void MainForm_Load(object sender, EventArgs e)
    {
      if (Csla.ApplicationContext.AuthenticationType == "Windows")
      {
        AppDomain.CurrentDomain.SetPrincipalPolicy(
          System.Security.Principal.PrincipalPolicy.WindowsPrincipal);
        ApplyAuthorizationRules();
      }
      else
      {
        DoLogin();
      }
      if (DocumentCount == 0)
        this.DocumentsToolStripDropDownButton.Enabled = false;
    }

    #region Projects

    private void NewProjectToolStripMenuItem_Click(
      object sender, EventArgs e)
    {
      using (StatusBusy busy = 
        new StatusBusy("Creating project..."))
      {
        AddWinPart(new ProjectEdit(Project.NewProject()));
      }
    }

    private void EditProjectToolStripMenuItem_Click(
      object sender, EventArgs e)
    {
      using (ProjectSelect dlg = new ProjectSelect())
      {
{'fraction_non_alphanumeric': 0.08268275372604685, 'fraction_numerical': 0.0007097232079489, 'mean_word_length': 2.8405994550408717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3291039', 'n_tokens_mistral': 775, 'n_tokens_neox': 761, 'n_words': 188}