-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from sysadminanywhere/develop
Develop
- Loading branch information
Showing
33 changed files
with
512 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<UserControl xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" x:Class="Sysadmin.Controls.PersonPictureControl" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Sysadmin.Controls" | ||
mc:Ignorable="d" | ||
d:DesignHeight="100" d:DesignWidth="100"> | ||
<Grid> | ||
<Ellipse Fill="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" /> | ||
<Viewbox> | ||
<TextBlock Margin="4" Text="PP" x:Name="initials" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/> | ||
</Viewbox> | ||
<Viewbox> | ||
<Image x:Name="pictureImage" RenderOptions.BitmapScalingMode="HighQuality" Width="100" Height="100"> | ||
<Image.Clip> | ||
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" /> | ||
</Image.Clip> | ||
</Image> | ||
</Viewbox> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using System; | ||
using System.IO; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
|
||
namespace Sysadmin.Controls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for PersonPictureControl.xaml | ||
/// </summary> | ||
public partial class PersonPictureControl : UserControl | ||
{ | ||
|
||
public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register( | ||
"DisplayName", typeof(string), | ||
typeof(PersonPictureControl) | ||
); | ||
|
||
public string DisplayName | ||
{ | ||
get => (string)GetValue(DisplayNameProperty); | ||
set | ||
{ | ||
SetValue(DisplayNameProperty, value); | ||
initials.Text = GetInitials(value); | ||
} | ||
} | ||
|
||
public static readonly DependencyProperty ProfilePictureProperty = DependencyProperty.Register( | ||
"ProfilePicture", typeof(ImageSource), | ||
typeof(PersonPictureControl) | ||
); | ||
|
||
public ImageSource ProfilePicture | ||
{ | ||
get => (ImageSource)GetValue(ProfilePictureProperty); | ||
set | ||
{ | ||
SetValue(ProfilePictureProperty, value); | ||
pictureImage.Source = value; | ||
} | ||
} | ||
|
||
private byte[] jpegPhoto; | ||
|
||
public byte[] JpegPhoto | ||
{ | ||
get { return jpegPhoto; } | ||
set | ||
{ | ||
jpegPhoto = value; | ||
ShowPhoto(); | ||
} | ||
} | ||
|
||
public PersonPictureControl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private string GetInitials(string name) | ||
{ | ||
|
||
if (string.IsNullOrEmpty(name)) | ||
return string.Empty; | ||
|
||
string[] nameSplit = name.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries); | ||
|
||
string initials = ""; | ||
|
||
foreach (string item in nameSplit) | ||
{ | ||
initials += item.Substring(0, 1).ToUpper(); | ||
} | ||
|
||
return initials; | ||
} | ||
|
||
private void ShowPhoto() | ||
{ | ||
if (JpegPhoto != null && JpegPhoto.Length > 0) | ||
{ | ||
var image = new BitmapImage(); | ||
using (var mem = new MemoryStream(JpegPhoto)) | ||
{ | ||
mem.Position = 0; | ||
image.BeginInit(); | ||
image.CreateOptions = BitmapCreateOptions.PreservePixelFormat; | ||
image.CacheOption = BitmapCacheOption.OnLoad; | ||
image.UriSource = null; | ||
image.StreamSource = mem; | ||
image.EndInit(); | ||
} | ||
image.Freeze(); | ||
pictureImage.Source = image; | ||
} | ||
else | ||
{ | ||
pictureImage.Source = null; | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,9 @@ | |
10. Autoupdater.NET | ||
+ Version | ||
+ XML | ||
11. Remote desktop | ||
+ VNC | ||
+ RDP | ||
12. Member of | ||
+ User | ||
+ Computer |
Oops, something went wrong.