Exemple #1
0
 private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Clipboard.SetText(e.ExceptionObject.ToString());
     if (MessageBox.Show("Do you want to edit the configuration?\n\nException copied to cliboard\n\n" + e.ExceptionObject.ToString(), "Unhandled exception", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
     {
         ConfigurationWindow configurationWindow = new ConfigurationWindow();
         configurationWindow.ShowDialog();
     }
 }
Exemple #2
0
        private void ConfigurationMenuItem_Click(object sender, RoutedEventArgs e)
        {
            ConfigurationWindow configurationWindow = new ConfigurationWindow();

            configurationWindow.ShowDialog();
            if (configurationWindow.ConfigurationSaved)
            {
                System.Windows.Forms.Application.Restart();
                Application.Current.Shutdown();
            }
        }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                this.Title = $"THIS - Trac Hummus Integration Software ${ApplicationDeployment.CurrentDeployment.CurrentVersion}";
            }
            else
            {
                this.Title = "THIS - Trac Hummus Integration Software (development version)";
            }

            if (Settings.Default.WindowSize.Height != 0)
            {
                this.Height = Settings.Default.WindowSize.Height;
            }

            if (Settings.Default.WindowSize.Width != 0)
            {
                this.Width = Settings.Default.WindowSize.Width;
            }

            if (string.IsNullOrEmpty(Settings.Default.TracPassword) ||
                string.IsNullOrEmpty(Settings.Default.TracUsername) ||
                string.IsNullOrEmpty(Settings.Default.MainFolder))
            {
                ConfigurationWindow configurationWindow = new ConfigurationWindow();
                configurationWindow.ShowDialog();
                if (!configurationWindow.ConfigurationSaved)
                {
                    Environment.Exit(0);
                }
            }

            this.currentDate = DateTime.Today;

            this.teaTimerGrid.Children.Add(new TeaTimer(new List <TimeSpan>()
            {
                new TimeSpan(0, 0, 15),
                new TimeSpan(0, 0, 30),
                new TimeSpan(0, 1, 0),
                new TimeSpan(0, 1, 30),
                new TimeSpan(0, 2, 0),
                new TimeSpan(0, 3, 0),
                new TimeSpan(0, 5, 0),
            }));

            TracComm tracComm = new TracComm(
                Settings.Default.TracUsername,
                Settings.Default.TracPassword);

            Directory.CreateDirectory(Settings.Default.MainFolder);
            TicketLoader ticketLoader = new TicketLoader(Path.Combine(Settings.Default.MainFolder, "tickets.txt"));

            TicketingControl ticketingControl = new TicketingControl(ticketLoader, tracComm);

            ticketingControl.Margin = new Thickness(10, 23, 0, 10);

            this.mainGrid.Children.Add(ticketingControl);

            ReloadUI();

            AppDomain.CurrentDomain.UnhandledException += this.CurrentDomain_UnhandledException;
        }