private void MenuItem_Click(object sender, RoutedEventArgs e)
 {
     if (sender is MenuItem menuItem && menuItem.DataContext is Profile profile)
     {
         _teamsLauncher.Start(profile);
     }
 }
        private void AutoStartCheck()
        {
            chkAutoStart.IsChecked = _registryManager.IsApplicationInStartup(StaticResources.AppName);

            if (chkAutoStart.IsChecked.HasValue && chkAutoStart.IsChecked.Value)
            {
                Show();
                WindowState = WindowState.Minimized;
                MetroWindow_StateChanged(null, null);

                var thread = new Thread(() =>
                {
                    foreach (var item in lstProfiles.Items)
                    {
                        _teamsLauncher.Start(item.ToString());
                    }
                });
                thread.Start();
            }
        }
Ejemplo n.º 3
0
        private void Silent()
        {
            string[] parameters = Environment.GetCommandLineArgs();
            if (parameters.Length > 1 && parameters[1].Contains("silent"))
            {
                Show();
                WindowState      = WindowState.Minimized;
                _tray.Visibility = Visibility.Visible;
                Visibility       = Visibility.Collapsed;

                try
                {
                    var thread = new Thread(() =>
                    {
                        foreach (var item in lstProfiles.Items)
                        {
                            if (!item.ToString().StartsWith("[Deaktiviert]"))
                            {
                                _teamsLauncher.Start(item.ToString());
                            }
                        }
                    });
                    thread.Start();
                }
                catch (Exception ex)
                {
                    MessageHelper.Info(ex.Message);
                    txtProfileName.Focus();
                }

                this.Close();
            }
            else
            {
                Show();
                WindowState      = WindowState.Normal;
                _tray.Visibility = Visibility.Collapsed;
                Visibility       = Visibility.Visible;
            }
        }