Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Source/NETworkManager/Models/Settings/IPScannerProfileManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Xml.Serialization;
Expand Down Expand Up @@ -105,5 +106,21 @@ public static void RemoveProfile(IPScannerProfileInfo profile)
{
Profiles.Remove(profile);
}

public static void RenameGroup(string oldGroup, string group)
{
// Go through all groups
for(int i=0; i < Profiles.Count; i++ )
{
// Find specific group
if (Profiles[i].Group == oldGroup)
{
// Rename the group
Profiles[i].Group = group;

ProfilesChanged = true;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,21 @@ public static void RemoveProfile(NetworkInterfaceProfileInfo profile)
{
Profiles.Remove(profile);
}

public static void RenameGroup(string oldGroup, string group)
{
// Go through all groups
for (int i = 0; i < Profiles.Count; i++)
{
// Find specific group
if (Profiles[i].Group == oldGroup)
{
// Rename the group
Profiles[i].Group = group;

ProfilesChanged = true;
}
}
}
}
}
16 changes: 16 additions & 0 deletions Source/NETworkManager/Models/Settings/PortScannerProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,21 @@ public static void RemoveProfile(PortScannerProfileInfo profile)
{
Profiles.Remove(profile);
}

public static void RenameGroup(string oldGroup, string group)
{
// Go through all groups
for (int i = 0; i < Profiles.Count; i++)
{
// Find specific group
if (Profiles[i].Group == oldGroup)
{
// Rename the group
Profiles[i].Group = group;

ProfilesChanged = true;
}
}
}
}
}
16 changes: 16 additions & 0 deletions Source/NETworkManager/Models/Settings/PuTTYSessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,21 @@ public static void RemoveSession(PuTTYSessionInfo session)
{
Sessions.Remove(session);
}

public static void RenameGroup(string oldGroup, string group)
{
// Go through all groups
for (int i = 0; i < Sessions.Count; i++)
{
// Find specific group
if (Sessions[i].Group == oldGroup)
{
// Rename the group
Sessions[i].Group = group;

SessionsChanged = true;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,21 @@ public static void RemoveSession(RemoteDesktopSessionInfo session)
{
Sessions.Remove(session);
}

public static void RenameGroup(string oldGroup, string group)
{
// Go through all groups
for (int i = 0; i < Sessions.Count; i++)
{
// Find specific group
if (Sessions[i].Group == oldGroup)
{
// Rename the group
Sessions[i].Group = group;

SessionsChanged = true;
}
}
}
}
}
16 changes: 16 additions & 0 deletions Source/NETworkManager/Models/Settings/WakeOnLANClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,21 @@ public static void RemoveClient(WakeOnLANClientInfo client)
{
Clients.Remove(client);
}

public static void RenameGroup(string oldGroup, string group)
{
// Go through all groups
for (int i = 0; i < Clients.Count; i++)
{
// Find specific group
if (Clients[i].Group == oldGroup)
{
// Rename the group
Clients[i].Group = group;

ClientsChanged = true;
}
}
}
}
}
8 changes: 8 additions & 0 deletions Source/NETworkManager/NETworkManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
<Compile Include="ViewModels\Applications\SNMPViewModel.cs" />
<Compile Include="ViewModels\Applications\HTTPHeadersViewModel.cs" />
<Compile Include="ViewModels\Applications\ARPTableViewModel.cs" />
<Compile Include="ViewModels\Dialogs\EditGroupViewModel.cs" />
<Compile Include="ViewModels\Dialogs\CredentialsMasterPasswordViewModel.cs" />
<Compile Include="ViewModels\Dialogs\CredentialViewModel.cs" />
<Compile Include="ViewModels\Dialogs\CredentialsSetMasterPasswordViewModel.cs" />
Expand Down Expand Up @@ -352,6 +353,9 @@
<Compile Include="Views\Dialogs\CredentialDialog.xaml.cs">
<DependentUpon>CredentialDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Dialogs\EditGroupDialog.xaml.cs">
<DependentUpon>EditGroupDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Dialogs\CredentialsMasterPasswordDialog.xaml.cs">
<DependentUpon>CredentialsMasterPasswordDialog.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -612,6 +616,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\Dialogs\EditGroupDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\Dialogs\CredentialsMasterPasswordDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
<system:String x:Key="String_Header_Data">Daten</system:String>
<system:String x:Key="String_Header_IPScanner">IP-Scanner</system:String>
<system:String x:Key="String_Header_PuTTY">PuTTY</system:String>

<system:String x:Key="String_Header_EditGroup">Gruppe bearbeiten</system:String>

<!-- Normal strings -->
<system:String x:Key="String_ProductName">NETworkManager</system:String>
<system:String x:Key="String_Slogan">Ein leistungsstarkes Tool zum Verwalten von Netzwerken und zur Behebung von Netzwerkproblemen!</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<system:String x:Key="String_Header_Data">Data</system:String>
<system:String x:Key="String_Header_IPScanner">IP Scanner</system:String>
<system:String x:Key="String_Header_PuTTY">PuTTY</system:String>
<system:String x:Key="String_Header_EditGroup">Edit group</system:String>

<!-- Normal strings -->
<system:String x:Key="String_ProductName">NETworkManager</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using NETworkManager.ViewModels.Dialogs;
using NETworkManager.Views.Dialogs;
using System.Linq;
using System.Windows.Controls;

namespace NETworkManager.ViewModels.Applications
{
Expand Down Expand Up @@ -614,7 +615,6 @@ public ICommand DeleteProfileCommand

private async void DeleteProfileAction()
{

CustomDialog customDialog = new CustomDialog()
{
Title = Application.Current.Resources["String_Header_DeleteProfile"] as string
Expand All @@ -637,6 +637,38 @@ private async void DeleteProfileAction()

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}

public ICommand EditGroupCommand
{
get { return new RelayCommand(p => EditGroupAction(p)); }
}

private async void EditGroupAction(object group)
{
CustomDialog customDialog = new CustomDialog()
{
Title = Application.Current.Resources["String_Header_EditGroup"] as string
};

EditGroupViewModel editGroupViewModel = new EditGroupViewModel(instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);

IPScannerProfileManager.RenameGroup(instance.OldGroup, instance.Group);

_ipScannerProfiles.Refresh();
}, instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);
}, group.ToString());

customDialog.Content = new EditGroupDialog
{
DataContext = editGroupViewModel
};

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}
#endregion

#region Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,38 @@ private async void DeleteProfileAction()

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}

public ICommand EditGroupCommand
{
get { return new RelayCommand(p => EditGroupAction(p)); }
}

private async void EditGroupAction(object group)
{
CustomDialog customDialog = new CustomDialog()
{
Title = Application.Current.Resources["String_Header_EditGroup"] as string
};

EditGroupViewModel editGroupViewModel = new EditGroupViewModel(instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);

NetworkInterfaceProfileManager.RenameGroup(instance.OldGroup, instance.Group);

_networkInterfaceProfiles.Refresh();
}, instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);
}, group.ToString());

customDialog.Content = new EditGroupDialog
{
DataContext = editGroupViewModel
};

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}
#endregion

#region Events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,38 @@ private async void DeleteProfileAction()

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}

public ICommand EditGroupCommand
{
get { return new RelayCommand(p => EditGroupAction(p)); }
}

private async void EditGroupAction(object group)
{
CustomDialog customDialog = new CustomDialog()
{
Title = Application.Current.Resources["String_Header_EditGroup"] as string
};

EditGroupViewModel editGroupViewModel = new EditGroupViewModel(instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);

PortScannerProfileManager.RenameGroup(instance.OldGroup, instance.Group);

_portScannerProfiles.Refresh();
}, instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);
}, group.ToString());

customDialog.Content = new EditGroupDialog
{
DataContext = editGroupViewModel
};

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}
#endregion

#region Methods
Expand Down
33 changes: 32 additions & 1 deletion Source/NETworkManager/ViewModels/Applications/PuTTYViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System.Windows.Data;
using System;
using System.IO;
using System.Diagnostics;

namespace NETworkManager.ViewModels.Applications
{
Expand Down Expand Up @@ -410,6 +409,38 @@ private async void DeleteSessionAction()
ConfigurationManager.Current.FixAirspace = true;
await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}

public ICommand EditGroupCommand
{
get { return new RelayCommand(p => EditGroupAction(p)); }
}

private async void EditGroupAction(object group)
{
CustomDialog customDialog = new CustomDialog()
{
Title = Application.Current.Resources["String_Header_EditGroup"] as string
};

EditGroupViewModel editGroupViewModel = new EditGroupViewModel(instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);

PuTTYSessionManager.RenameGroup(instance.OldGroup, instance.Group);

_puTTYSessions.Refresh();
}, instance =>
{
dialogCoordinator.HideMetroDialogAsync(this, customDialog);
}, group.ToString());

customDialog.Content = new EditGroupDialog
{
DataContext = editGroupViewModel
};

await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
}
#endregion

#region Methods
Expand Down
Loading