diff --git a/README.md b/README.md
index ad5142c..a8b23be 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,16 @@ Launcher to manage profiles and open multiple instances of Microsoft Teams deskt
* .NET Core
* WPF
* [MahApps](https://mahapps.com/)
+* [WPF NotifyIcon](https://github.com/hardcodet/wpf-notifyicon)
## Prerequisites
* Microsoft Teams
* .NET Core
+## Releases
+You can download the latest version in [Releases](https://github.com/TonCunha/multi-microsoft-teams/releases)
+
## Deployment
1. Open project in Visual Studio
@@ -31,12 +35,9 @@ Launcher to manage profiles and open multiple instances of Microsoft Teams deskt
### Configure Multi Teams
1. Open Multi Microsoft Teams
2. Create all the profiles you need by clicking the New profile button
-3. Select a profile or check All profiles and Launch Teams
+3. Select a profile and Launch Teams
4. Uncheck the options auto-start application in all Microsoft Teams
-
-## After initial configurations
-1. Open Multi Microsoft Teams
-2. Select a profile or check All profiles and Launch Teams
+5. You can check Auto Start option to launch all profiles when Windows starts
## Authors
diff --git a/src/MMT.Core/MMT.Core.csproj b/src/MMT.Core/MMT.Core.csproj
index cb63190..52ceb1d 100644
--- a/src/MMT.Core/MMT.Core.csproj
+++ b/src/MMT.Core/MMT.Core.csproj
@@ -4,4 +4,8 @@
netcoreapp3.1
+
+
+
+
diff --git a/src/MMT.Core/ProfileManager.cs b/src/MMT.Core/ProfileManager.cs
index 26691b2..5a8e515 100644
--- a/src/MMT.Core/ProfileManager.cs
+++ b/src/MMT.Core/ProfileManager.cs
@@ -40,7 +40,7 @@ public void Delete(string profileName)
string path = Path.Combine(_customProfilesPath, profileName);
if (Directory.Exists(path))
- Directory.Delete(path);
+ Directory.Delete(path, true);
}
}
}
diff --git a/src/MMT.Core/RegistryMananger.cs b/src/MMT.Core/RegistryMananger.cs
new file mode 100644
index 0000000..5cdfd12
--- /dev/null
+++ b/src/MMT.Core/RegistryMananger.cs
@@ -0,0 +1,30 @@
+using Microsoft.Win32;
+using System.Diagnostics;
+
+namespace MMT.Core
+{
+ public class RegistryManager
+ {
+ private readonly RegistryKey _registryKey;
+
+ public RegistryManager()
+ {
+ _registryKey = Registry.CurrentUser.OpenSubKey(StaticResources.StartupApplications, true);
+ }
+
+ public bool IsApplicationInStartup(string name)
+ {
+ return _registryKey.GetValue(name) != null;
+ }
+
+ public void AddApplicationInStartup(string name)
+ {
+ _registryKey.SetValue(name, Process.GetCurrentProcess().MainModule.FileName); //AppDomain.CurrentDomain.BaseDirectory);
+ }
+
+ public void RemoveApplicationFromStartup(string appName)
+ {
+ _registryKey.DeleteValue(appName, false);
+ }
+ }
+}
diff --git a/src/MMT.Core/StaticResources.cs b/src/MMT.Core/StaticResources.cs
index 674cdab..aea3da9 100644
--- a/src/MMT.Core/StaticResources.cs
+++ b/src/MMT.Core/StaticResources.cs
@@ -43,5 +43,21 @@ public static string UpdateExe
return @"AppData\Local\Microsoft\Teams\Update.exe";
}
}
+
+ public static string StartupApplications
+ {
+ get
+ {
+ return @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
+ }
+ }
+
+ public static string AppName
+ {
+ get
+ {
+ return "Multi MS Teams";
+ }
+ }
}
}
diff --git a/src/MMT.UI/MMT.UI.csproj b/src/MMT.UI/MMT.UI.csproj
index 335a519..b6e9cec 100644
--- a/src/MMT.UI/MMT.UI.csproj
+++ b/src/MMT.UI/MMT.UI.csproj
@@ -12,10 +12,15 @@
https://github.com/TonCunha/multi-microsoft-teams
Cleriton Cunha
Launcher to manage profiles and open multiple instances of Microsoft Teams
- LICENSE
+ LICENSE
+ 1.0.0.1
+ 1.0.0.1
+ 1.0.0.1
+
+
@@ -30,4 +35,19 @@
+
+
+ True
+ True
+ Resource.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resource.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/src/MMT.UI/MainWindow.xaml b/src/MMT.UI/MainWindow.xaml
index 880c3cb..9ed4be6 100644
--- a/src/MMT.UI/MainWindow.xaml
+++ b/src/MMT.UI/MainWindow.xaml
@@ -3,23 +3,22 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
+ xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:MMT.UI"
mc:Ignorable="d"
- Title="Multi Microsoft Teams" Height="250" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
+ Title="Multi Microsoft Teams" Height="250" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" StateChanged="MetroWindow_StateChanged">
-
-
+
Github
-
+
@@ -32,7 +31,7 @@
-
+
diff --git a/src/MMT.UI/MainWindow.xaml.cs b/src/MMT.UI/MainWindow.xaml.cs
index 0b1c8a0..cb545a5 100644
--- a/src/MMT.UI/MainWindow.xaml.cs
+++ b/src/MMT.UI/MainWindow.xaml.cs
@@ -1,9 +1,11 @@
-using MahApps.Metro.Controls;
+using Hardcodet.Wpf.TaskbarNotification;
+using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using MMT.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Threading;
using System.Windows;
using System.Windows.Input;
using System.Windows.Navigation;
@@ -13,14 +15,19 @@ namespace MMT.UI
public partial class MainWindow : MetroWindow
{
private readonly ProfileManager _profileManager;
- private TeamsLauncher _teamsLauncher;
+ private readonly TeamsLauncher _teamsLauncher;
+ private readonly RegistryManager _registryManager;
+ private TaskbarIcon _tray;
public MainWindow()
{
InitializeComponent();
_profileManager = new ProfileManager();
_teamsLauncher = new TeamsLauncher();
+ _registryManager = new RegistryManager();
ChangeTabVisibility();
+ CreateTray();
+ AutoStartCheck();
}
private void ChangeTabVisibility()
@@ -47,6 +54,64 @@ private void LoadProfiles()
profiles.ForEach(p => lstProfiles.Items.Add(p));
}
+ private void CreateTray()
+ {
+ _tray = new TaskbarIcon();
+ _tray.Icon = Resource.Taskbar;
+ _tray.TrayMouseDoubleClick += TrayMouseDoubleClick;
+ _tray.ToolTipText = StaticResources.AppName;
+ _tray.Visibility = Visibility.Collapsed;
+ }
+
+ private void TrayMouseDoubleClick(object sender, RoutedEventArgs e)
+ {
+ Show();
+ WindowState = WindowState.Normal;
+ MetroWindow_StateChanged(sender, e);
+ }
+
+ 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();
+ }
+ }
+
+ private void MetroWindow_StateChanged(object sender, EventArgs e)
+ {
+ if (WindowState == WindowState.Minimized)
+ {
+ Visibility = Visibility.Collapsed;
+ _tray.Visibility = Visibility.Visible;
+ _tray.ShowBalloonTip(StaticResources.AppName, "This app is running", BalloonIcon.Info);
+ }
+ else
+ {
+ _tray.Visibility = Visibility.Collapsed;
+ Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ChkAutoStart_Click(object sender, RoutedEventArgs e)
+ {
+ if (chkAutoStart.IsChecked.HasValue && chkAutoStart.IsChecked.Value)
+ _registryManager.AddApplicationInStartup(StaticResources.AppName);
+ else if (_registryManager.IsApplicationInStartup(StaticResources.AppName))
+ _registryManager.RemoveApplicationFromStartup(StaticResources.AppName);
+ }
+
private void BtnNewProfile_Click(object sender, RoutedEventArgs e)
{
txtProfileName.Clear();
@@ -76,10 +141,7 @@ private void BtnLaunchTeams_Click(object sender, RoutedEventArgs e)
{
try
{
- if (chkAllProfiles.IsChecked.HasValue && chkAllProfiles.IsChecked.Value)
- foreach (var item in lstProfiles.Items)
- _teamsLauncher.Start(item.ToString());
- else if (lstProfiles.SelectedItem != null)
+ if (lstProfiles.SelectedItem != null)
_teamsLauncher.Start(lstProfiles.SelectedItem.ToString());
}
catch (Exception ex)
@@ -89,7 +151,7 @@ private void BtnLaunchTeams_Click(object sender, RoutedEventArgs e)
}
}
- private async void LstProfiles_KeyUp(object sender, KeyEventArgs e)
+ private async void LstProfiles_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Delete)
{
@@ -104,7 +166,7 @@ private async void LstProfiles_KeyUp(object sender, KeyEventArgs e)
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
- Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
+ Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
}
}
}
diff --git a/src/MMT.UI/Resource.Designer.cs b/src/MMT.UI/Resource.Designer.cs
new file mode 100644
index 0000000..c841862
--- /dev/null
+++ b/src/MMT.UI/Resource.Designer.cs
@@ -0,0 +1,73 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace MMT.UI {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resource {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resource() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MMT.UI.Resource", typeof(Resource).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon Taskbar {
+ get {
+ object obj = ResourceManager.GetObject("Taskbar", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+ }
+}
diff --git a/src/MMT.UI/Resource.resx b/src/MMT.UI/Resource.resx
new file mode 100644
index 0000000..cc32d7c
--- /dev/null
+++ b/src/MMT.UI/Resource.resx
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Taskbar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file