Ejemplo n.º 1
0
 public async Task <bool> LoadTickets(IProgress <double> progress)
 {
     return(await TicketLoader.LoadData(progress));
 }
Ejemplo n.º 2
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;
        }