initial
This commit is contained in:
76
UserControls/AnnouncementListItem.xaml
Normal file
76
UserControls/AnnouncementListItem.xaml
Normal file
@@ -0,0 +1,76 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.AnnouncementListItem"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="320"
|
||||
FontSize="12"
|
||||
FontFamily="Arial"
|
||||
Cursor="Hand"
|
||||
MouseLeftButtonDown="OnMouseLeftButtonDownClicked"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border BorderThickness="1.5" x:Name="HighlightAnnouncementBorder" CornerRadius="1" MouseEnter="OnAnnMouseEnter" MouseLeave="OnAnnMouseLeave">
|
||||
<Grid Background="White" Height="auto">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Background="{Binding Path=PrioColor}" Grid.RowSpan="3" x:Name="annColor"></Grid>
|
||||
<DockPanel Grid.Column="1" >
|
||||
<Image Source="pack://application:,,,/Resources/StateOverlays/OverlayNewContentButton.png" Panel.ZIndex="18" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding Path=IsUnread, Converter={StaticResource BoolToVis}}" x:Name="signal" Width="15px" Cursor="Hand" ToolTip="{x:Static resx:Resources.removeMarkup}" Margin="5,0,0,0" />
|
||||
<TextBlock x:Name="txtDate" Grid.Row="0" Margin="10,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontStyle="Italic" Text="{Binding Path=CreatedDate,StringFormat={}{0:dd.MM.yyyy},FallbackValue='01.01.2021'}"></TextBlock>
|
||||
</DockPanel>
|
||||
|
||||
<Image x:Name="imgOpen" Grid.Row="0" Grid.Column="2" Source="{DynamicResource appbar_new_window}" Width="30" ToolTip="{x:Static resx:Resources.CallAnnonceDetails}" Cursor="Hand"/>
|
||||
<TextBlock x:Name="txtSubject"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="15,5,5,0"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding Path=Subject,FallbackValue='test Announcement'}"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
ClipToBounds="True"/>
|
||||
<TextBlock x:Name="txtContent"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="15,10,10,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Path=Text,FallbackValue='test text'}"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
LineStackingStrategy="BlockLineHeight"
|
||||
LineHeight="18"
|
||||
Height="58"
|
||||
Visibility="Collapsed" />
|
||||
<TextBlock x:Name="txtNotice"
|
||||
Background="Transparent"
|
||||
IsHitTestVisible="True"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="15,5,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontStyle="Italic"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
LineStackingStrategy="BlockLineHeight"
|
||||
LineHeight="18"
|
||||
Height="40" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
282
UserControls/AnnouncementListItem.xaml.cs
Normal file
282
UserControls/AnnouncementListItem.xaml.cs
Normal file
@@ -0,0 +1,282 @@
|
||||
using C4IT.API.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnnouncementListItem.xaml
|
||||
/// </summary>
|
||||
public partial class AnnouncementListItem : UserControl, INotifyPropertyChanged
|
||||
{
|
||||
public Announcement _announcementItem;
|
||||
|
||||
public Announcement AnnouncementItem
|
||||
{
|
||||
get => _announcementItem;
|
||||
set
|
||||
{
|
||||
_announcementItem = value;
|
||||
// PropertyChanged für die Haupt-Property
|
||||
OnPropertyChanged(nameof(AnnouncementItem));
|
||||
// und für alle gebundenen Felder
|
||||
OnPropertyChanged(nameof(Subject));
|
||||
OnPropertyChanged(nameof(Text));
|
||||
OnPropertyChanged(nameof(Priority));
|
||||
OnPropertyChanged(nameof(PrioColor));
|
||||
OnPropertyChanged(nameof(IsUnread));
|
||||
OnPropertyChanged(nameof(CreatedDate));
|
||||
OnPropertyChanged(nameof(VisibleFrom));
|
||||
}
|
||||
}
|
||||
|
||||
public bool _PrepareForDelete;
|
||||
private Boolean _isUnread;
|
||||
public Boolean IsUnread
|
||||
{
|
||||
get { return _isUnread; }
|
||||
set
|
||||
{
|
||||
_isUnread = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush PrioColor
|
||||
{
|
||||
get { return _announcementItem.getPrioColorBrush(); }
|
||||
set
|
||||
{
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Int32 Priority
|
||||
{
|
||||
get { return _announcementItem._priority; }
|
||||
set
|
||||
{
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAdhoc
|
||||
{
|
||||
get { return _announcementItem._isAdhoc; }
|
||||
set
|
||||
{
|
||||
_announcementItem._isAdhoc = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool toRemove = false;
|
||||
public DateTime CreatedDate
|
||||
{
|
||||
get { return _announcementItem._createdDate.ToLocalTime(); }
|
||||
set
|
||||
{
|
||||
_announcementItem._createdDate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime? VisibleFrom
|
||||
{
|
||||
get { return _announcementItem._visibleFrom?.ToLocalTime(); }
|
||||
set
|
||||
{
|
||||
_announcementItem._visibleFrom = value;
|
||||
if (value.HasValue)
|
||||
{
|
||||
CreatedDate = value.Value;
|
||||
}
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Subject
|
||||
{
|
||||
get { return _announcementItem._subject; }
|
||||
set
|
||||
{
|
||||
_announcementItem._subject = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return _announcementItem._message; }
|
||||
set
|
||||
{
|
||||
_announcementItem._message = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Guid getEOID()
|
||||
{
|
||||
return _announcementItem._objectID;
|
||||
}
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises this object's PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">The property that has a new value.</param>
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
int count = _announcementItem._message.Length;
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
var e = new PropertyChangedEventArgs(propertyName);
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_announcementItem._message))
|
||||
{
|
||||
this.Height = 70;
|
||||
}
|
||||
|
||||
if (count <= 54 && !string.IsNullOrWhiteSpace(_announcementItem._message))
|
||||
{
|
||||
this.Height = 90;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
public AnnouncementListItem()
|
||||
{
|
||||
InitializeComponent();
|
||||
GetParameterForAnnouncmentView();
|
||||
this.DataContext = this;
|
||||
}
|
||||
|
||||
private void OnAnnMouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
HighlightAnnouncementBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2d45fb"));
|
||||
}
|
||||
|
||||
private void OnAnnMouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
HighlightAnnouncementBorder.BorderBrush = new SolidColorBrush(Colors.White);
|
||||
}
|
||||
|
||||
private void OnMouseLeftButtonDownClicked(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
MainWindow.MainInstance.AnnouncementCtrl.OpenAnnClicked(sender, e);
|
||||
}
|
||||
|
||||
public void GetParameterForAnnouncmentView()
|
||||
{
|
||||
// Header + Announcement-Content (Standard-Auslieferungszustand)
|
||||
if (MainWindow.MainInstance.ConfigSettings.AnnouncementView == 0)
|
||||
{
|
||||
txtContent.Visibility = Visibility.Visible;
|
||||
txtNotice.Visibility = Visibility.Collapsed;
|
||||
this.MinHeight = 0;
|
||||
this.MaxHeight = 120;
|
||||
}
|
||||
|
||||
// Only Header
|
||||
if (MainWindow.MainInstance.ConfigSettings.AnnouncementView == 1)
|
||||
{
|
||||
txtContent.Visibility = Visibility.Collapsed;
|
||||
txtNotice.Visibility = Visibility.Collapsed;
|
||||
Thickness margin = txtSubject.Margin;
|
||||
margin.Bottom = 20;
|
||||
txtSubject.Margin = margin;
|
||||
this.MinHeight = 70;
|
||||
this.MaxHeight = 70;
|
||||
}
|
||||
|
||||
// Header + Custom Text
|
||||
if (!string.IsNullOrEmpty(MainWindow.MainInstance.ConfigSettings.CustomAnnouncementText))
|
||||
{
|
||||
txtContent.Visibility = Visibility.Collapsed;
|
||||
txtNotice.Visibility = Visibility.Visible;
|
||||
this.MaxHeight = 98;
|
||||
this.MinHeight = 98;
|
||||
|
||||
txtNotice.Text = MainWindow.MainInstance.ConfigSettings.CustomAnnouncementText;
|
||||
|
||||
txtNotice.Loaded -= TxtNotice_Loaded;
|
||||
txtNotice.Loaded += TxtNotice_Loaded;
|
||||
|
||||
txtNotice.SizeChanged -= TxtNotice_SizeChanged;
|
||||
txtNotice.SizeChanged += TxtNotice_SizeChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void TxtNotice_Loaded(object sender, RoutedEventArgs e) => UpdateNoticeToolTip();
|
||||
private void TxtNotice_SizeChanged(object sender, SizeChangedEventArgs e) => UpdateNoticeToolTip();
|
||||
|
||||
private void UpdateNoticeToolTip()
|
||||
{
|
||||
txtNotice.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ToolTipService.SetInitialShowDelay(txtNotice, 400);
|
||||
|
||||
bool moreThanTwoLines = ExceedsLineCount(txtNotice, 2);
|
||||
|
||||
ToolTipService.SetToolTip(txtNotice, moreThanTwoLines ? Properties.Resources.ShowMoreDetailsToolTip : null);
|
||||
|
||||
}), DispatcherPriority.Render);
|
||||
}
|
||||
|
||||
private static bool ExceedsLineCount(TextBlock tb, int maxLines)
|
||||
{
|
||||
if (tb == null || string.IsNullOrEmpty(tb.Text))
|
||||
return false;
|
||||
|
||||
if (tb.ActualWidth <= 0)
|
||||
return false;
|
||||
|
||||
// Measure text as it is rendered (with actual width)
|
||||
var measureTb = new TextBlock
|
||||
{
|
||||
Text = tb.Text,
|
||||
FontFamily = tb.FontFamily,
|
||||
FontSize = tb.FontSize,
|
||||
FontStyle = tb.FontStyle,
|
||||
FontWeight = tb.FontWeight,
|
||||
FontStretch = tb.FontStretch,
|
||||
FlowDirection = tb.FlowDirection,
|
||||
|
||||
TextWrapping = tb.TextWrapping,
|
||||
LineHeight = tb.LineHeight,
|
||||
LineStackingStrategy = tb.LineStackingStrategy,
|
||||
|
||||
TextTrimming = TextTrimming.None
|
||||
};
|
||||
|
||||
// Calculate height for maxLines lines
|
||||
double lineHeight = tb.LineHeight;
|
||||
if (double.IsNaN(lineHeight) || lineHeight <= 0)
|
||||
lineHeight = tb.FontSize * 1.2; // Fallback, in case LineHeight is not set
|
||||
|
||||
double maxHeight = maxLines * lineHeight;
|
||||
|
||||
measureTb.Measure(new Size(tb.ActualWidth, double.PositiveInfinity));
|
||||
return measureTb.DesiredSize.Height > maxHeight + 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
71
UserControls/Announcements.xaml
Normal file
71
UserControls/Announcements.xaml
Normal file
@@ -0,0 +1,71 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.Announcements"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="500" d:DesignWidth="800">
|
||||
<Grid x:Name="GridMain" x:FieldModifier="private"
|
||||
Width="500"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="30*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="6*" />
|
||||
<RowDefinition Height="7*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Canvas x:Name="Canvas" x:FieldModifier="private"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0">
|
||||
|
||||
<Image Source="{DynamicResource appbar_newspaper}"
|
||||
Width="48"
|
||||
x:Name="icoNewspaper_Inline" x:FieldModifier="private" />
|
||||
|
||||
<Label Content="{x:Static resx:Resources.announcement}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40"
|
||||
Foreground="{DynamicResource mainForeground}" />
|
||||
|
||||
<ScrollViewer x:Name="CanvasAnnouncements" x:FieldModifier="private"
|
||||
Canvas.Top="50"
|
||||
Canvas.Left="10"
|
||||
Visibility="Visible"
|
||||
MinHeight="60"
|
||||
MaxHeight="480"
|
||||
Width="{Binding ActualWidth, ElementName=Canvas, Mode=OneWay}"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
<StackPanel Canvas.Top="50"
|
||||
Canvas.Left="10"
|
||||
x:Name="NoAnnouncement" x:FieldModifier="private"
|
||||
Background="White"
|
||||
Width="{Binding ActualWidth, ElementName=Canvas, Mode=OneWay}"
|
||||
Height="50">
|
||||
<TextBlock Text="{x:Static resx:Resources.noannouncement}"
|
||||
Margin="25,5,10,0"
|
||||
Foreground="Black" />
|
||||
</StackPanel>
|
||||
<Image Source="{DynamicResource appbar_list_check}"
|
||||
x:Name="buttonReadAllAnnouncements" x:FieldModifier="private"
|
||||
Tag="readAllAnnouncements"
|
||||
Cursor="Hand"
|
||||
PreviewMouseDown="ReadAll_PreviewMouseDown"
|
||||
Grid.Column="2"
|
||||
RenderTransformOrigin="1.536,1.429"
|
||||
Height="32"
|
||||
Width="32"
|
||||
Canvas.Left="338"
|
||||
Canvas.Top="10" />
|
||||
</Canvas>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
485
UserControls/Announcements.xaml.cs
Normal file
485
UserControls/Announcements.xaml.cs
Normal file
@@ -0,0 +1,485 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using C4IT.API.Contracts;
|
||||
using C4IT.Logging;
|
||||
|
||||
using C4IT_CustomerPanel.libs;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Announcements.xaml
|
||||
/// </summary>
|
||||
public partial class Announcements : UserControl
|
||||
{
|
||||
public readonly StackPanel _adHocannouncementHead = new StackPanel();
|
||||
public Dictionary<Guid, AnnouncementListItem> announcementCollection = new Dictionary<Guid, AnnouncementListItem>();
|
||||
public Dictionary<Guid, AnnouncementListItem> adhocAnnouncementCollection = new Dictionary<Guid, AnnouncementListItem>();
|
||||
public List<Guid> unreadAnnouncements = new List<Guid>();
|
||||
public List<Guid> announcementIDs = new List<Guid>();
|
||||
|
||||
private MainWindow mainWindow;
|
||||
|
||||
private const string ApiAnnouncementsBaseUrl = "m42Services/api/c4it/customerpanel/announcements";
|
||||
private const string ApiAnnouncementsQueryParam = "?type=";
|
||||
|
||||
public Announcements()
|
||||
{
|
||||
mainWindow = MainWindow.MainInstance;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void InitializeContracts()
|
||||
{
|
||||
try
|
||||
{
|
||||
announcementIDs = ConfigClass.LoadFromJson<List<Guid>>("LastAnnouncementIDs", "run");
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
unreadAnnouncements = ConfigClass.LoadFromJson<List<Guid>>("UnreadAnnouncements", "run");
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (announcementIDs == null)
|
||||
announcementIDs = new List<Guid>();
|
||||
|
||||
|
||||
if (unreadAnnouncements == null)
|
||||
unreadAnnouncements = new List<Guid>();
|
||||
}
|
||||
|
||||
internal void ReadAll_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
foreach (KeyValuePair<Guid, AnnouncementListItem> item in announcementCollection)
|
||||
{
|
||||
item.Value.IsUnread = false;
|
||||
}
|
||||
foreach (KeyValuePair<Guid, AnnouncementListItem> item in adhocAnnouncementCollection)
|
||||
{
|
||||
item.Value.IsUnread = false;
|
||||
}
|
||||
CheckAllAnnouncementsRead(null, null);
|
||||
}
|
||||
|
||||
public void ProcessNewAnnouncements(List<Announcement> _announcements, announcementType type)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type == announcementType.Adhoc)
|
||||
{
|
||||
foreach (var pair in adhocAnnouncementCollection)
|
||||
{
|
||||
adhocAnnouncementCollection[pair.Key]._PrepareForDelete = true;
|
||||
}
|
||||
}
|
||||
if (type == announcementType.Regular)
|
||||
{
|
||||
foreach (var pair in announcementCollection)
|
||||
{
|
||||
announcementCollection[pair.Key]._PrepareForDelete = true;
|
||||
}
|
||||
}
|
||||
if (_announcements != null && _announcements.Count > 0)
|
||||
{
|
||||
var newItemsCount = 0;
|
||||
|
||||
foreach (Announcement an in _announcements)
|
||||
{
|
||||
Guid currentEOID = an._objectID;
|
||||
|
||||
if (!currentEOID.Equals(Guid.Empty))
|
||||
{
|
||||
AnnouncementListItem tmpItem;
|
||||
if (type == announcementType.Adhoc)
|
||||
{
|
||||
|
||||
if (adhocAnnouncementCollection.TryGetValue(currentEOID, out tmpItem))
|
||||
{
|
||||
tmpItem.AnnouncementItem = an;
|
||||
tmpItem._PrepareForDelete = false;
|
||||
adhocAnnouncementCollection[currentEOID] = tmpItem;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (type == announcementType.Regular)
|
||||
{
|
||||
if (announcementCollection.TryGetValue(currentEOID, out tmpItem))
|
||||
{
|
||||
tmpItem._announcementItem = an;
|
||||
tmpItem._PrepareForDelete = false;
|
||||
announcementCollection[currentEOID] = tmpItem;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var newItem = new AnnouncementListItem()
|
||||
{
|
||||
Margin = new Thickness(2, 10, 2, 0),
|
||||
_PrepareForDelete = false,
|
||||
_announcementItem = an
|
||||
};
|
||||
|
||||
if (unreadAnnouncements.Contains(currentEOID) | announcementIDs.Count == 0)
|
||||
{
|
||||
newItem.IsUnread = true;
|
||||
}
|
||||
|
||||
if (!announcementIDs.Contains(currentEOID))
|
||||
{
|
||||
announcementIDs.Add(currentEOID);
|
||||
if (!unreadAnnouncements.Contains(currentEOID))
|
||||
{
|
||||
unreadAnnouncements.Add(currentEOID);
|
||||
}
|
||||
newItem.IsUnread = true;
|
||||
|
||||
var suj = an._subject;
|
||||
if (!string.IsNullOrEmpty(suj))
|
||||
mainWindow.NewContentSignalsInfo[enumMainFunctions.Announcement] = suj;
|
||||
|
||||
newItemsCount++;
|
||||
}
|
||||
|
||||
newItem.imgOpen.PreviewMouseDown += new MouseButtonEventHandler(OnOpenAnnClicked);
|
||||
newItem.signal.PreviewMouseDown += CheckAllAnnouncementsRead;
|
||||
switch (type)
|
||||
{
|
||||
case announcementType.Regular:
|
||||
announcementCollection.Add(currentEOID, newItem);
|
||||
break;
|
||||
case announcementType.Adhoc:
|
||||
adhocAnnouncementCollection.Add(currentEOID, newItem);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newItemsCount > 1 || (newItemsCount == 1 && !mainWindow.NewContentSignalsInfo.ContainsKey(enumMainFunctions.Announcement)))
|
||||
mainWindow.NewContentSignalsInfo[enumMainFunctions.Announcement] = Properties.Resources.NewAnnouncementsMessage;
|
||||
|
||||
ConfigClass.SaveAsJson("LastAnnouncementIDs", announcementIDs, "run");
|
||||
ConfigClass.SaveAsJson("UnreadAnnouncements", unreadAnnouncements, "run");
|
||||
|
||||
NoAnnouncement.Visibility = Visibility.Hidden;
|
||||
CanvasAnnouncements.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == announcementType.Adhoc) adhocAnnouncementCollection.Clear();
|
||||
if (type == announcementType.Regular) announcementCollection.Clear();
|
||||
}
|
||||
|
||||
ConfigClass.SaveAsJson("UnreadAnnouncements", unreadAnnouncements, "run");
|
||||
announcementCollection = announcementCollection.Where(i => i.Value._PrepareForDelete == false).ToDictionary(i => i.Key, i => i.Value);
|
||||
adhocAnnouncementCollection = adhocAnnouncementCollection.Where(i => i.Value._PrepareForDelete == false).ToDictionary(i => i.Key, i => i.Value);
|
||||
//var combinedCollection = announcementCollection
|
||||
// .Concat(adhocAnnouncementCollection)
|
||||
// .ToDictionary(i => i.Key, i => i.Value)
|
||||
// .ToList();
|
||||
|
||||
//announcementIDs = combinedCollection.Select(x => x.Key).Distinct().ToList();
|
||||
FillAnnouncementGrid();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public void FillAnnouncementGrid()
|
||||
{
|
||||
try
|
||||
{
|
||||
Boolean setNewContent = false;
|
||||
|
||||
// Zusammenführen der Ankündigungen AdHoc und Regular
|
||||
Dictionary<Guid, AnnouncementListItem> combinedAnnouncements = new Dictionary<Guid, AnnouncementListItem>();
|
||||
foreach (var item in announcementCollection)
|
||||
{
|
||||
combinedAnnouncements[item.Key] = item.Value;
|
||||
}
|
||||
foreach (var item in adhocAnnouncementCollection)
|
||||
{
|
||||
combinedAnnouncements[item.Key] = item.Value;
|
||||
}
|
||||
|
||||
foreach (var announcement in combinedAnnouncements.Values)
|
||||
{
|
||||
var effectiveDate = announcement.VisibleFrom.HasValue && announcement.VisibleFrom > announcement.CreatedDate
|
||||
? announcement.VisibleFrom.Value
|
||||
: announcement.CreatedDate;
|
||||
announcement.CreatedDate = effectiveDate;
|
||||
}
|
||||
var sortedAnnouncementsList = combinedAnnouncements.Values
|
||||
.OrderByDescending(a => a.Priority >= 3)
|
||||
.ThenByDescending(a => a.IsUnread)
|
||||
.ThenByDescending(a => a.CreatedDate)
|
||||
.ToList();
|
||||
|
||||
var sortedAnnouncements = sortedAnnouncementsList
|
||||
.ToDictionary(announcement => announcement.getEOID(), announcement => announcement);
|
||||
|
||||
_adHocannouncementHead.Children.Clear();
|
||||
List<Guid> toRemoveAdHoc = new List<Guid>();
|
||||
foreach (var item in sortedAnnouncements)
|
||||
{
|
||||
if (announcementIDs.Contains(item.Value.getEOID()))
|
||||
{
|
||||
if (item.Value.IsUnread)
|
||||
{
|
||||
setNewContent = true;
|
||||
}
|
||||
_adHocannouncementHead.Children.Add(item.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemoveAdHoc.Add(item.Key);
|
||||
}
|
||||
}
|
||||
foreach (var rem in toRemoveAdHoc)
|
||||
{
|
||||
adhocAnnouncementCollection.Remove(rem);
|
||||
}
|
||||
|
||||
if (_adHocannouncementHead.Children.Count > 0)
|
||||
{
|
||||
CanvasAnnouncements.Visibility = Visibility.Visible;
|
||||
CanvasAnnouncements.Content = _adHocannouncementHead;
|
||||
}
|
||||
else
|
||||
{
|
||||
CanvasAnnouncements.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if (setNewContent)
|
||||
{
|
||||
lock (mainWindow.NewContentSignals)
|
||||
mainWindow.NewContentSignals[enumMainFunctions.Announcement] = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
|
||||
cLogManager.LogException(exp);
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckAllAnnouncementsRead(object sender, MouseEventArgs e)
|
||||
{
|
||||
var methodInfo = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(methodInfo);
|
||||
|
||||
if (e != null)
|
||||
e.Handled = true;
|
||||
|
||||
try
|
||||
{
|
||||
if (sender == null)
|
||||
{
|
||||
unreadAnnouncements.Clear();
|
||||
lock (mainWindow.NewContentSignals)
|
||||
{
|
||||
mainWindow.NewContentSignals[enumMainFunctions.Announcement] = false;
|
||||
mainWindow._isRedDotActive = false;
|
||||
}
|
||||
mainWindow.UpdateNewContentSignals();
|
||||
}
|
||||
else
|
||||
{
|
||||
Boolean allRead = true;
|
||||
AnnouncementListItem annItem = null;
|
||||
|
||||
if (sender is Image)
|
||||
{
|
||||
Image item = (Image)sender;
|
||||
annItem = (AnnouncementListItem)item.DataContext;
|
||||
}
|
||||
else if (sender is AnnouncementListItem)
|
||||
{
|
||||
annItem = (AnnouncementListItem)sender;
|
||||
}
|
||||
if (annItem != null)
|
||||
{
|
||||
annItem.IsUnread = false;
|
||||
if (annItem.IsAdhoc)
|
||||
{
|
||||
AnnouncementListItem tempItem;
|
||||
if (announcementCollection.TryGetValue(annItem._announcementItem._objectID, out tempItem))
|
||||
{
|
||||
tempItem.IsUnread = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AnnouncementListItem tempItem;
|
||||
if (adhocAnnouncementCollection.TryGetValue(annItem._announcementItem._objectID, out tempItem))
|
||||
{
|
||||
tempItem.IsUnread = false;
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<Guid, AnnouncementListItem> ann in announcementCollection)
|
||||
{
|
||||
if (ann.Value.IsUnread)
|
||||
{
|
||||
allRead = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<Guid, AnnouncementListItem> ann in adhocAnnouncementCollection)
|
||||
{
|
||||
if (ann.Value.IsUnread)
|
||||
{
|
||||
allRead = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allRead)
|
||||
{
|
||||
unreadAnnouncements.Clear();
|
||||
lock (mainWindow.NewContentSignals)
|
||||
{
|
||||
mainWindow.NewContentSignals[enumMainFunctions.Announcement] = false;
|
||||
mainWindow._isRedDotActive = false;
|
||||
}
|
||||
mainWindow.UpdateNewContentSignals();
|
||||
}
|
||||
else
|
||||
{
|
||||
unreadAnnouncements.Remove(annItem.getEOID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogEntry($"Ausnahme in {methodInfo.Name}: {ex.Message}", LogLevels.Debug);
|
||||
LogException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMethodEnd(methodInfo);
|
||||
}
|
||||
|
||||
ConfigClass.SaveAsJson("UnreadAnnouncements", unreadAnnouncements, "run");
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> LoadAnnouncementsAsync(announcementType type)
|
||||
{
|
||||
string strRes = null;
|
||||
var RetVal = true;
|
||||
|
||||
try
|
||||
{
|
||||
string reqUrl = mainWindow.ConfigSettings.usingGeneralAPIToken
|
||||
? $"{ApiAnnouncementsBaseUrl}/{mainWindow.ConfigSettings.userInfo.Id}/{ApiAnnouncementsQueryParam}{type}"
|
||||
: $"{ApiAnnouncementsBaseUrl}/{ApiAnnouncementsQueryParam}{type}";
|
||||
|
||||
LogEntry($"Requesting Announcements url: {reqUrl}", LogLevels.Debug);
|
||||
|
||||
using (var _http = mainWindow.ConfigSettings.m42WebClient.GetHttp())
|
||||
{
|
||||
strRes = await _http.GetApiJsonAsync(reqUrl, "Getting Announcementsinfo");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(strRes))
|
||||
{
|
||||
strRes = "[]";
|
||||
RetVal = false;
|
||||
return RetVal;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
RetVal = false;
|
||||
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
List<Announcement> _Data = null;
|
||||
try
|
||||
{
|
||||
_Data = JsonConvert.DeserializeObject<List<Announcement>>(strRes);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
ProcessNewAnnouncements(_Data, type);
|
||||
});
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
RetVal = false;
|
||||
_Data = null;
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
public void OnOpenAnnClicked(object sender, EventArgs e)
|
||||
{
|
||||
Image img = (Image)sender;
|
||||
AnnouncementListItem Item = (AnnouncementListItem)img.DataContext;
|
||||
if (!Item.getEOID().Equals(Guid.Empty))
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(mainWindow.ConfigSettings.GetMatrixServer(true) +
|
||||
"/wm/app-SelfServicePortal/notSet/preview-object/SVMAnnouncementType/" +
|
||||
Item.getEOID().ToString() +
|
||||
"/0/?view-options={'embedded':true}");
|
||||
CheckAllAnnouncementsRead(Item, null);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//not yet implemented
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenAnnClicked(object sender, EventArgs e)
|
||||
{
|
||||
AnnouncementListItem announcementListItem = (AnnouncementListItem)sender;
|
||||
AnnouncementListItem item = (AnnouncementListItem)announcementListItem.DataContext;
|
||||
if (!item.getEOID().Equals(Guid.Empty))
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(mainWindow.ConfigSettings.GetMatrixServer(true) +
|
||||
"/wm/app-SelfServicePortal/notSet/preview-object/SVMAnnouncementType/" +
|
||||
item.getEOID().ToString() +
|
||||
"/0/?view-options={'embedded':true}");
|
||||
CheckAllAnnouncementsRead(item, null);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//not yet implemented
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Image ReadAllButton => buttonReadAllAnnouncements;
|
||||
}
|
||||
}
|
||||
361
UserControls/ComputerInformation.xaml
Normal file
361
UserControls/ComputerInformation.xaml
Normal file
@@ -0,0 +1,361 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.ComputerInformation"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:uctrl="clr-namespace:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:C4IT_CustomerPanel.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="Button"
|
||||
x:Key="ButtonStyle">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource navForeground}" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource inactiveButtonColor}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource activeButtonColor}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!--ComputerInformation-->
|
||||
<Grid x:Name="GridInfo" x:FieldModifier="private"
|
||||
Width="500"
|
||||
Canvas.Left="512"
|
||||
Canvas.Top="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="134*" />
|
||||
<ColumnDefinition Width="51*" />
|
||||
<ColumnDefinition Width="30*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="7*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="1"
|
||||
Height="70">
|
||||
<Image Source="{DynamicResource appbar_monitor}"
|
||||
Height="48"
|
||||
x:Name="icoComputer_Inline" x:FieldModifier="private" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
x:Name="LblComputername" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.computername}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<TextBox Canvas.Left="15"
|
||||
Width="300"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="TxtComputername" x:FieldModifier="private"
|
||||
IsReadOnly="true"
|
||||
Canvas.Top="45"
|
||||
Height="25"
|
||||
PreviewMouseDoubleClick="Info_TXT_OnMouseDoubleClick"
|
||||
Background="White" />
|
||||
<Image Cursor="Hand"
|
||||
Source="{DynamicResource appbar_page_copy}"
|
||||
Height="25"
|
||||
x:Name="icoCopyComputer" x:FieldModifier="private"
|
||||
Tag="MAINICO"
|
||||
HorizontalAlignment="Right"
|
||||
Canvas.Left="315"
|
||||
Canvas.Top="45"
|
||||
Width="28"
|
||||
PreviewMouseDown="ClickCopyIcon" />
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="2"
|
||||
Height="70">
|
||||
<Image Source="{DynamicResource appbar_network}"
|
||||
Height="48"
|
||||
x:Name="icoNetwork_Inline" x:FieldModifier="private" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
FontSize="16"
|
||||
x:Name="LblIpaddress" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.ipaddress}"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<TextBox Canvas.Left="15"
|
||||
Width="300"
|
||||
Height="25"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
x:Name="TxtIpaddress" x:FieldModifier="private"
|
||||
IsReadOnly="true"
|
||||
Canvas.Top="45"
|
||||
PreviewMouseDoubleClick="Info_TXT_OnMouseDoubleClick"
|
||||
Background="White" />
|
||||
<Image Cursor="Hand"
|
||||
Source="{DynamicResource appbar_page_copy}"
|
||||
Height="25"
|
||||
x:Name="icoCopyNetwork" x:FieldModifier="private"
|
||||
Tag="MAINICO"
|
||||
HorizontalAlignment="Right"
|
||||
Canvas.Left="312"
|
||||
Canvas.Top="45"
|
||||
Width="28"
|
||||
PreviewMouseDown="ClickCopyIcon" />
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="3"
|
||||
Height="70"
|
||||
x:Name="CanvasHostname" x:FieldModifier="private">
|
||||
<Image Source="{DynamicResource appbar_remotehost}"
|
||||
Height="48"
|
||||
x:Name="icoHost_Inline" x:FieldModifier="private"/>
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
x:Name="LblHostname" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.Hostname}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<TextBox Canvas.Left="15"
|
||||
Width="300"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="TxtHostname" x:FieldModifier="private"
|
||||
IsReadOnly="true"
|
||||
Canvas.Top="45"
|
||||
Height="25"
|
||||
PreviewMouseDoubleClick="Info_TXT_OnMouseDoubleClick"
|
||||
Background="White" />
|
||||
<Image Cursor="Hand"
|
||||
Source="{DynamicResource appbar_page_copy}"
|
||||
Height="25"
|
||||
x:Name="icoCopyHost" x:FieldModifier="private"
|
||||
Tag="MAINICO"
|
||||
HorizontalAlignment="Right"
|
||||
Canvas.Left="315"
|
||||
Canvas.Top="45"
|
||||
Width="28"
|
||||
PreviewMouseDown="ClickCopyIcon" />
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="4"
|
||||
Height="70">
|
||||
<Image Source="{DynamicResource appbar_people}"
|
||||
Height="48"
|
||||
x:Name="icoUser_Inline" x:FieldModifier="private" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
FontSize="16"
|
||||
x:Name="LblUsername" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.username}"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<TextBox Canvas.Left="15"
|
||||
Width="300"
|
||||
Height="25"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
x:Name="TxtUsername" x:FieldModifier="private"
|
||||
IsEnabled="true"
|
||||
IsReadOnly="true"
|
||||
Canvas.Top="45"
|
||||
PreviewMouseDoubleClick="Info_TXT_OnMouseDoubleClick"
|
||||
Background="White" />
|
||||
<Image Cursor="Hand"
|
||||
Source="{DynamicResource appbar_page_copy}"
|
||||
Height="25"
|
||||
x:Name="icoCopyUser" x:FieldModifier="private"
|
||||
Tag="MAINICO"
|
||||
HorizontalAlignment="Right"
|
||||
Canvas.Left="312"
|
||||
Canvas.Top="45"
|
||||
Width="28"
|
||||
PreviewMouseDown="ClickCopyIcon" />
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="5"
|
||||
Height="70">
|
||||
<Image Source="{DynamicResource appbar_reset}"
|
||||
Height="48"
|
||||
x:Name="icoRestart_Inline" x:FieldModifier="private"
|
||||
Tag="MAINICO" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
FontSize="16"
|
||||
x:Name="LblLastreboot" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.lastreboot}"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<TextBox Canvas.Left="15"
|
||||
Width="300"
|
||||
Height="25"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
x:Name="TxtLastreboot" x:FieldModifier="private"
|
||||
IsReadOnly="true"
|
||||
Canvas.Top="45"
|
||||
MouseDoubleClick="Info_TXT_OnMouseDoubleClick"
|
||||
Background="White" />
|
||||
<Image Cursor="Hand"
|
||||
Source="{DynamicResource appbar_page_copy}"
|
||||
Height="25"
|
||||
x:Name="icoCopyRestart" x:FieldModifier="private"
|
||||
Tag="MAINICO"
|
||||
HorizontalAlignment="Right"
|
||||
Canvas.Left="312"
|
||||
Canvas.Top="45"
|
||||
Width="28"
|
||||
PreviewMouseDown="ClickCopyIcon" />
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="6"
|
||||
Height="70">
|
||||
<Image Source="{DynamicResource appbar_folder_ellipsis}"
|
||||
Height="48"
|
||||
x:Name="icoDrive_Inline" x:FieldModifier="private"
|
||||
Tag="MAINICO" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
x:Name="LblDrives" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.drives}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<StackPanel Canvas.Left="15"
|
||||
Canvas.Top="40"
|
||||
Orientation="Vertical"
|
||||
Width="300">
|
||||
<StackPanel x:Name="StPaDrives" x:FieldModifier="private"
|
||||
CanHorizontallyScroll="True"
|
||||
CanVerticallyScroll="True"
|
||||
MinHeight="30"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Stretch"
|
||||
MaxHeight="30"
|
||||
Orientation="Horizontal" />
|
||||
<StackPanel x:Name="StPaDrives2" x:FieldModifier="private"
|
||||
CanHorizontallyScroll="True"
|
||||
CanVerticallyScroll="True"
|
||||
MinHeight="30"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Stretch"
|
||||
MaxHeight="30"
|
||||
Orientation="Horizontal" />
|
||||
</StackPanel>
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="7"
|
||||
Height="70">
|
||||
<Label Content="{x:Static resx:Resources.genReportHeader}"
|
||||
Foreground="{DynamicResource mainForeground}"
|
||||
Canvas.Left="53"
|
||||
Canvas.Top="15"
|
||||
FontSize="16"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top" />
|
||||
<Grid Width="300"
|
||||
Canvas.Left="15"
|
||||
Canvas.Top="50">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="43*" />
|
||||
<ColumnDefinition Width="57*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Foreground="{DynamicResource navForeground}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource ButtonStyle}"
|
||||
Width="250"
|
||||
Height="40"
|
||||
x:Name="BtnClientReport" x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.genReport}"
|
||||
FontSize="18"
|
||||
Click="OnReportClicked"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="25,0,0,0" />
|
||||
</Grid>
|
||||
<Grid Width="300"
|
||||
Canvas.Left="15"
|
||||
Canvas.Top="110">
|
||||
<Button Foreground="{DynamicResource navForeground}"
|
||||
HorizontalAlignment="Center"
|
||||
Style="{StaticResource ButtonStyle}"
|
||||
Width="250"
|
||||
Height="40"
|
||||
x:Name="BtnRemoteSupport" x:FieldModifier="private"
|
||||
Tag="LABEL"
|
||||
Content="Remote Support"
|
||||
FontSize="18"
|
||||
Click="OnRemoteSupportClicked"
|
||||
Visibility="Visible" />
|
||||
</Grid>
|
||||
<Grid Panel.ZIndex="100"
|
||||
x:Name="PRGSGrid" x:FieldModifier="private"
|
||||
Visibility="Hidden"
|
||||
Canvas.Left="90"
|
||||
Canvas.Top="57">
|
||||
<uctrl:CustomProgressBar x:Name="PRGS" x:FieldModifier="private"
|
||||
Visibility="Visible"
|
||||
Canvas.Left="300"
|
||||
Width="150"
|
||||
Height="25"
|
||||
VerticalAlignment="Bottom" />
|
||||
<TextBlock x:Name="PRGSText" x:FieldModifier="private"
|
||||
Text=""
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<Label x:Name="LblCustomerPanelVersion" x:FieldModifier="private"
|
||||
FontSize="12"
|
||||
Margin="115 205 0 0" />
|
||||
</Canvas>
|
||||
|
||||
<Canvas Margin="150 0 0 0"
|
||||
Canvas.Top="10"
|
||||
x:Name="copied" x:FieldModifier="private"
|
||||
Opacity="0"
|
||||
Visibility="Collapsed">
|
||||
<Border BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
CornerRadius="3"
|
||||
Background="{DynamicResource inactiveButtonColor}"
|
||||
Width="250"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Panel.ZIndex="100">
|
||||
<TextBlock Text="{x:Static resx:Resources.copied}"
|
||||
Foreground="White"
|
||||
FontSize="16"
|
||||
Height="25"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" />
|
||||
</Border>
|
||||
</Canvas>
|
||||
|
||||
</Grid>
|
||||
<!--ComputerInformation-->
|
||||
</UserControl>
|
||||
219
UserControls/ComputerInformation.xaml.cs
Normal file
219
UserControls/ComputerInformation.xaml.cs
Normal file
@@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
using C4IT.HardwareInfo;
|
||||
using C4IT.Logging;
|
||||
|
||||
using C4IT_CustomerPanel.libs;
|
||||
|
||||
using static C4IT_CustomerPanel.MainWindow;
|
||||
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ComputerInformation.xaml
|
||||
/// </summary>
|
||||
public partial class ComputerInformation : UserControl
|
||||
{
|
||||
public ComputerInformation()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Info_TXT_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TextBox txtBox = (TextBox)sender;
|
||||
|
||||
txtBox.Select(0, txtBox.Text.Length);
|
||||
|
||||
if (!string.IsNullOrEmpty(txtBox.Text))
|
||||
{
|
||||
System.Windows.Forms.Clipboard.SetText(txtBox.Text);
|
||||
DoubleAnimation animation = new DoubleAnimation(1, TimeSpan.FromSeconds(1));
|
||||
animation.Completed += CopiedAnimBeginCompleted;
|
||||
copied.Visibility = Visibility.Visible;
|
||||
copied.BeginAnimation(Canvas.OpacityProperty, animation);
|
||||
}
|
||||
}
|
||||
|
||||
private void CopiedAnimBeginCompleted(object sender, EventArgs e)
|
||||
{
|
||||
DoubleAnimation animation1 = new DoubleAnimation(0, TimeSpan.FromSeconds(5));
|
||||
animation1.Completed += CopiedAnimEndCompleted;
|
||||
copied.BeginAnimation(OpacityProperty, animation1);
|
||||
}
|
||||
|
||||
private void CopiedAnimEndCompleted(object sender, EventArgs e)
|
||||
{
|
||||
copied.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void ClickCopyIcon(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Image img = (Image)sender;
|
||||
switch (img.Name)
|
||||
{
|
||||
case "icoCopyRestart":
|
||||
Info_TXT_OnMouseDoubleClick(TxtLastreboot, null);
|
||||
break;
|
||||
case "icoCopyUser":
|
||||
Info_TXT_OnMouseDoubleClick(TxtUsername, null);
|
||||
break;
|
||||
case "icoCopyNetwork":
|
||||
Info_TXT_OnMouseDoubleClick(TxtIpaddress, null);
|
||||
break;
|
||||
case "icoCopyComputer":
|
||||
Info_TXT_OnMouseDoubleClick(TxtComputername, null);
|
||||
break;
|
||||
case "icoCopyHost":
|
||||
Info_TXT_OnMouseDoubleClick(TxtHostname, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnReportClicked(object sender, EventArgs e)
|
||||
{
|
||||
PRGSText.Text = Properties.Resources.genReport;
|
||||
PRGSGrid.Visibility = Visibility.Visible;
|
||||
Task.Factory.StartNew(() => // kann auch mit await in einer async Methode verwendet werden
|
||||
{
|
||||
try
|
||||
{
|
||||
var CI = new ComputerInformationReport(MainWindow.MainInstance?.ConfigSettings.GetCultureName()) // Configsettings noch in UC mitreinnehmen
|
||||
{
|
||||
SetProgress = SetProgress
|
||||
};
|
||||
CI.CreateReport();
|
||||
CI.Save();
|
||||
|
||||
CI.Show();
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
PRGSGrid.Visibility = Visibility.Hidden));
|
||||
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
MessageBox.Show(exp.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SetProgress(double Progress)
|
||||
{
|
||||
|
||||
// Achtung: bei UI Zugriffen muss der UI Dispatcher verwendet werden!
|
||||
int p = (int)Progress;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
((MainWindow)Application.Current.MainWindow).ComputerInfoCtrl.PRGS.ProgressValue = (int)Progress));
|
||||
}
|
||||
|
||||
public void OnRemoteSupportClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(MainWindow.MainInstance?.ConfigSettings.GetRemoteAppPath());
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
cLogManager.DefaultLogger.LogException(E, LogLevels.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
public void FillMainInfoGrid()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add Customer Panel-Version to Information-Category
|
||||
var cpVersion = Assembly.GetExecutingAssembly()
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
|
||||
.InformationalVersion;
|
||||
LblCustomerPanelVersion.Content = cpVersion;
|
||||
|
||||
TxtComputername.Text = Environment.MachineName;
|
||||
var RemoteHost = Environment.GetEnvironmentVariable("ClientName");
|
||||
#if DEBUG
|
||||
if (string.IsNullOrEmpty(RemoteHost))
|
||||
RemoteHost = Environment.GetEnvironmentVariable("ClientName2");
|
||||
#endif
|
||||
TxtHostname.Text = RemoteHost;
|
||||
if (string.IsNullOrEmpty(RemoteHost))
|
||||
CanvasHostname.Visibility = Visibility.Collapsed;
|
||||
TxtUsername.Text = Environment.UserDomainName + "\\" + Environment.UserName;
|
||||
TxtIpaddress.Text = InformationHelper.GetIp4Address(MainWindow.MainInstance.ConfigSettings.ShowIpInfoOnlyInCorporateNetwork);
|
||||
DriveInfo[] dInfo = InformationHelper.GetDrives();
|
||||
TxtLastreboot.Text = InformationHelper.GetLastReboot().ToString(CultureInfo.CurrentUICulture);
|
||||
|
||||
int k = 0;
|
||||
foreach (DriveInfo drive in dInfo)
|
||||
{
|
||||
if ((drive.DriveType == DriveType.Fixed))
|
||||
{
|
||||
Grid gri = new Grid { HorizontalAlignment = HorizontalAlignment.Center };
|
||||
Label lb = new Label { HorizontalAlignment = HorizontalAlignment.Center };
|
||||
StackPanel sp = new StackPanel
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
Margin = new Thickness(10, 0, 0, 0)
|
||||
};
|
||||
var pbg = new CustomProgressBar
|
||||
{
|
||||
Effect = FormHelper.GetDropShadow()
|
||||
};
|
||||
lb.Content = drive.Name + " - " + InformationHelper.FormatBytes(drive.TotalSize - drive.TotalFreeSpace, false) + " / " + InformationHelper.FormatBytes(drive.TotalSize, true);
|
||||
lb.ToolTip = lb.Content;
|
||||
lb.ClipToBounds = true;
|
||||
sp.Width = StPaDrives.Width / dInfo.Length;
|
||||
pbg.Width = sp.Width;
|
||||
pbg.Height = 20;
|
||||
sp.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
sp.Orientation = Orientation.Vertical;
|
||||
gri.Children.Add(pbg);
|
||||
pbg.ProgressValue = (int)((drive.TotalSize - drive.TotalFreeSpace) * 100 / drive.TotalSize);
|
||||
gri.Children.Add(lb);
|
||||
sp.Children.Add(gri);
|
||||
if (k > 1 & k <= 3)
|
||||
{
|
||||
StPaDrives2.Children.Add(sp);
|
||||
}
|
||||
else
|
||||
{
|
||||
StPaDrives.Children.Add(sp);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
if (k <= 1)
|
||||
{
|
||||
// StPaDrives2.Height = 0;
|
||||
// BtnRemoteSupport.Margin = new Thickness(0, -35, 0, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAppearence()
|
||||
{
|
||||
BtnRemoteSupport.Visibility = (string.IsNullOrEmpty(MainWindow.MainInstance.ConfigSettings.GetRemoteAppPath()) || MainWindow.MainInstance.OnlineState != enumOnlineState.Online) ? Visibility.Hidden : Visibility.Visible;
|
||||
}
|
||||
|
||||
public void SetIpAddress(string IpAddress)
|
||||
{
|
||||
TxtIpaddress.Text = IpAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
43
UserControls/CustomLinks.xaml
Normal file
43
UserControls/CustomLinks.xaml
Normal file
@@ -0,0 +1,43 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.CustomLinks"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
|
||||
<Grid Width="500">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100*" />
|
||||
<ColumnDefinition Width="370*" />
|
||||
<ColumnDefinition Width="30*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="6*" />
|
||||
<RowDefinition Height="7*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0">
|
||||
<Image Source="{DynamicResource appbar_star}"
|
||||
Width="48"
|
||||
Tag="MAINICO" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40"
|
||||
Content="{x:Static resx:Resources.CustomLink}" />
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="1">
|
||||
<StackPanel x:Name="CustomLinkPanel"
|
||||
x:FieldModifier="private"
|
||||
Orientation="Vertical"
|
||||
Canvas.Top="50" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
27
UserControls/CustomLinks.xaml.cs
Normal file
27
UserControls/CustomLinks.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CustomLinks.xaml
|
||||
/// </summary>
|
||||
public partial class CustomLinks : UserControl
|
||||
{
|
||||
public CustomLinks()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void AddLink(UIElement element)
|
||||
{
|
||||
CustomLinkPanel.Children.Add(element);
|
||||
}
|
||||
|
||||
public void ClearLinks()
|
||||
{
|
||||
CustomLinkPanel.Children.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
UserControls/CustomProgressBar.xaml
Normal file
12
UserControls/CustomProgressBar.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.CustomProgressBar"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="50" d:DesignWidth="400" Loaded="UserControl_Loaded" SizeChanged="UserControl_SizeChanged">
|
||||
<Grid Background="White">
|
||||
<Border x:Name="ProgressRect" Background="#FFBEE6FD" Width="100" HorizontalAlignment="Left"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
56
UserControls/CustomProgressBar.xaml.cs
Normal file
56
UserControls/CustomProgressBar.xaml.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CustomProgressBar.xaml
|
||||
/// </summary>
|
||||
public partial class CustomProgressBar : UserControl
|
||||
{
|
||||
public CustomProgressBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
ProgressValue = 0;
|
||||
}
|
||||
|
||||
private int privProgressValue = 0;
|
||||
public int ProgressValue {
|
||||
get { return privProgressValue; }
|
||||
set {
|
||||
privProgressValue = value;
|
||||
if (privProgressValue < 0)
|
||||
privProgressValue = 0;
|
||||
if (privProgressValue > 100)
|
||||
privProgressValue = 100;
|
||||
|
||||
double W = this.ActualWidth * ((double)privProgressValue / 100);
|
||||
|
||||
ProgressRect.Width = W;
|
||||
}
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProgressValue = privProgressValue;
|
||||
}
|
||||
|
||||
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
ProgressValue = privProgressValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
56
UserControls/IncidentListItem.xaml
Normal file
56
UserControls/IncidentListItem.xaml
Normal file
@@ -0,0 +1,56 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.IncidentListItem"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
xmlns:my="clr-namespace:C4IT_CustomerPanel"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="320"
|
||||
FontSize="12"
|
||||
FontFamily="Arial"
|
||||
Cursor="Hand"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
</UserControl.Resources>
|
||||
<Border BorderThickness="1.5" x:Name="HighlightIncidentBorder" CornerRadius="1" MouseEnter="OnIncidentMouseEnter" MouseLeave="OnIncidentMouseLeave">
|
||||
<Grid Background="White" Height="auto">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid VerticalAlignment="Center" Margin="10,6,5,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel Margin="-10,0,0,0">
|
||||
<Image Margin="5,0,5,0" Source="pack://application:,,,/Resources/StateOverlays/OverlayNewContentButton.png" Panel.ZIndex="18" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding Path=IsUnread, Converter={StaticResource BoolToVis}}" x:Name="signal" Width="15px" Cursor="Hand" ToolTip="{x:Static resx:Resources.removeMarkup}"/>
|
||||
<TextBlock x:Name="txtTicketType" Margin="5,0,0,0" Grid.Column="0" HorizontalAlignment="Left" Text="{Binding Path=TicketType,FallbackValue='Störung'}" FontStyle="Italic" Width="95"></TextBlock>
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Column="1" Margin="10,0,0,0">
|
||||
<TextBlock x:Name="txtState" HorizontalAlignment="Center" Text="{Binding Path=State, FallbackValue='State'}" FontStyle="Italic"></TextBlock>
|
||||
<Grid Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,6,0" Width="26" x:Name="sortByState" Visibility="Collapsed">
|
||||
<TextBlock Text="⯆" Margin="12,0,0,0" x:Name="descState" FontSize="14" Tag="5" PreviewMouseDown="orderBy_PreviewMouseDown" Cursor="Hand" />
|
||||
<TextBlock Text="⯅" x:Name="ascState" FontSize="14" Tag="4" Margin="0,0,10,0" PreviewMouseDown="orderBy_PreviewMouseDown" Cursor="Hand" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
<TextBlock x:Name="txtID" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand" TextDecorations="Underline" Foreground="#1E72C7" ToolTip="{x:Static resx:Resources.CallTicketDetails}" Text="{Binding Path=TicketNumber, FallbackValue='TCK0004'}" Margin="0,0,22,0"></TextBlock>
|
||||
<Grid Grid.Column="2" HorizontalAlignment="Right" Width="25" x:Name="sortByTicketNumber" Visibility="Collapsed" Margin="0,0,-3,0">
|
||||
<TextBlock Text="⯆" Margin="12,0,0,0" x:Name="descTicketnumber" FontSize="14" Tag="1" PreviewMouseDown="orderBy_PreviewMouseDown" Cursor="Hand" />
|
||||
<TextBlock Text="⯅" x:Name="ascTicketnumber" FontSize="14" Margin="0,0,13,0" Tag="0" PreviewMouseDown="orderBy_PreviewMouseDown" Cursor="Hand" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<TextBlock x:Name="txtContent" Grid.Row="1" VerticalAlignment="Top" Margin="8,12,5,24" FontWeight="Bold" TextWrapping="Wrap" Text="{Binding Path=Subject,FallbackValue='test Ticket'}"></TextBlock>
|
||||
<TextBlock x:Name="txtCreatedDate" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Text="{Binding Path=CreatedDate, StringFormat={}{0:dd.MM.yyyy HH:mm}, FallbackValue='Datum'}" FontStyle="Italic" Width="100" Margin="0,32,27,6"></TextBlock>
|
||||
<TextBlock Visibility="{Binding Path=IsUnread, Converter={StaticResource BoolToVis}}" x:Name="txtLastAction" Grid.Row="1" HorizontalAlignment="Right" FontStyle="Italic" Width="165" Margin="0,32,145,4" Text="{Binding Path=LastJournalEntryActionText,FallbackValue='test Ticket'}"></TextBlock>
|
||||
<Grid HorizontalAlignment="Right" Width="25" Grid.Row="1" x:Name="sortByCreatedDate" Visibility="Collapsed" VerticalAlignment="Bottom" Height="16" Margin="0,0,0,4">
|
||||
<TextBlock Text="⯆" Margin="12,0,0,0" x:Name="descCreatedDate" FontSize="14" PreviewMouseDown="orderBy_PreviewMouseDown" Cursor="Hand" Tag="3"/>
|
||||
<TextBlock Text="⯅" x:Name="ascCreatedDate" Tag="2" FontSize="14" Margin="0,0,13,0" PreviewMouseDown="orderBy_PreviewMouseDown" Cursor="Hand" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
179
UserControls/IncidentListItem.xaml.cs
Normal file
179
UserControls/IncidentListItem.xaml.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using C4IT.API.Contracts;
|
||||
using C4IT_CustomerPanel.libs;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für IncidentListItem.xaml
|
||||
/// </summary>
|
||||
public partial class IncidentListItem : UserControl, INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private Ticket _ticketItem;
|
||||
public Ticket TicketItem
|
||||
{
|
||||
get => _ticketItem;
|
||||
set
|
||||
{
|
||||
_ticketItem = value;
|
||||
OnPropertyChanged(nameof(TicketItem));
|
||||
OnPropertyChanged(nameof(Subject));
|
||||
OnPropertyChanged(nameof(TicketNumber));
|
||||
OnPropertyChanged(nameof(LastJournalEntryActionText));
|
||||
OnPropertyChanged(nameof(CreatedDate));
|
||||
OnPropertyChanged(nameof(IsUnread));
|
||||
OnPropertyChanged(nameof(State));
|
||||
OnPropertyChanged(nameof(StateValue));
|
||||
OnPropertyChanged(nameof(TicketType));
|
||||
}
|
||||
}
|
||||
|
||||
public string LastJournalEntryActionText
|
||||
{
|
||||
get { return _ticketItem._lastJournalEntryActionText; }
|
||||
set
|
||||
{
|
||||
_ticketItem._lastJournalEntryActionText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Boolean _isUnread;
|
||||
public Boolean IsUnread
|
||||
{
|
||||
get { return _isUnread; }
|
||||
set
|
||||
{
|
||||
_isUnread = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public DateTime CreatedDate
|
||||
{
|
||||
get { return _ticketItem._createdDate.ToLocalTime(); }
|
||||
set
|
||||
{
|
||||
_ticketItem._createdDate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string TicketNumber
|
||||
{
|
||||
get { return _ticketItem._ticketNumber; }
|
||||
set
|
||||
{
|
||||
_ticketItem._ticketNumber = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Subject
|
||||
{
|
||||
get { return _ticketItem._subject; }
|
||||
set
|
||||
{
|
||||
_ticketItem._subject = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public int StateValue
|
||||
{
|
||||
get { return _ticketItem._stateValue; }
|
||||
set
|
||||
{
|
||||
_ticketItem._stateValue = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public string State
|
||||
{
|
||||
get { return _ticketItem._state; }
|
||||
set
|
||||
{
|
||||
_ticketItem._state = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string TicketType
|
||||
{
|
||||
get { return _ticketItem._ticketType; }
|
||||
set
|
||||
{
|
||||
_ticketItem._ticketType = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Guid getEOID()
|
||||
{
|
||||
return _ticketItem._objectID;
|
||||
}
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises this object's PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">The property that has a new value.</param>
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
var e = new PropertyChangedEventArgs(propertyName);
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public IncidentListItem(Ticket ticket)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
TicketItem = ticket;
|
||||
}
|
||||
|
||||
private void orderBy_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TextBlock tb = (TextBlock)sender;
|
||||
|
||||
var k = Window.GetWindow(this) as MainWindow;
|
||||
|
||||
k.ReorderTicketCollection((MainWindow.enumOrderBy)Enum.ToObject(typeof(MainWindow.enumOrderBy), Int32.Parse(tb.Tag.ToString())));
|
||||
|
||||
}
|
||||
|
||||
private void OnIncidentMouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
HighlightIncidentBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2d45fb"));
|
||||
}
|
||||
|
||||
private void OnIncidentMouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
HighlightIncidentBorder.BorderBrush = new SolidColorBrush(Colors.White);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
110
UserControls/Incidents.xaml
Normal file
110
UserControls/Incidents.xaml
Normal file
@@ -0,0 +1,110 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.Incidents"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="Button"
|
||||
x:Key="ButtonStyle">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource navForeground}" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource inactiveButtonColor}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource activeButtonColor}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
|
||||
<Grid x:Name="GridEtc"
|
||||
Width="500"
|
||||
Canvas.Left="1000"
|
||||
HorizontalAlignment="Center"
|
||||
Canvas.Top="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="250*" />
|
||||
<RowDefinition Height="450" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="30*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Canvas x:Name="Canvas2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0">
|
||||
<Image Source="{DynamicResource appbar_clipboard_variant_text}"
|
||||
Width="48"
|
||||
Tag="MAINICO" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
Content="{x:Static resx:Resources.incidents}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<ScrollViewer x:Name="CanvasIncident"
|
||||
Canvas.Top="50"
|
||||
Canvas.Left="10"
|
||||
MaxHeight="460"
|
||||
MinHeight="60"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Width="{Binding ActualWidth, ElementName=Canvas2, Mode=OneWay}"
|
||||
Visibility="Visible" />
|
||||
<StackPanel x:Name="NoIncident"
|
||||
Background="White"
|
||||
Width="{Binding ActualWidth, ElementName=Canvas2, Mode=OneWay}"
|
||||
Height="50"
|
||||
Canvas.Top="50"
|
||||
Canvas.Left="10">
|
||||
<TextBlock Text="{x:Static resx:Resources.noincidents}"
|
||||
Margin="25,5,10,0"
|
||||
Foreground="Black" />
|
||||
</StackPanel>
|
||||
<Button Foreground="{DynamicResource navForeground}"
|
||||
Style="{StaticResource ButtonStyle}"
|
||||
Canvas.Top="450"
|
||||
Canvas.Left="62"
|
||||
Width="250"
|
||||
Height="40"
|
||||
Content="{x:Static resx:Resources.createNewTicket}"
|
||||
FontSize="18"
|
||||
x:Name="BtnCreateNewTicket"
|
||||
Click="OnCreateNewTicketClicked"
|
||||
Margin="0 70 0 0" />
|
||||
</Canvas>
|
||||
<Image Source="{DynamicResource appbar_list_check}"
|
||||
x:Name="buttonReadAllTickets"
|
||||
Tag="readAllTickets"
|
||||
Grid.Column="2"
|
||||
Cursor="Hand"
|
||||
Margin="153,10,0,8"
|
||||
PreviewMouseDown="ReadAll_PreviewMouseDown"
|
||||
RenderTransformOrigin="1.536,1.429"
|
||||
Height="32"
|
||||
Width="32"
|
||||
ToolTip="{x:Static resx:Resources.removeMarkups}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
296
UserControls/Incidents.xaml.cs
Normal file
296
UserControls/Incidents.xaml.cs
Normal file
@@ -0,0 +1,296 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using C4IT.API.Contracts;
|
||||
using C4IT.Logging;
|
||||
|
||||
using C4IT_CustomerPanel.libs;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Incidents.xaml
|
||||
/// </summary>
|
||||
public partial class Incidents : UserControl
|
||||
{
|
||||
public readonly StackPanel _incidentHead = new StackPanel();
|
||||
public Dictionary<Guid, IncidentListItem> ticketCollection = new Dictionary<Guid, IncidentListItem>();
|
||||
public List<Guid> unreadTickets = new List<Guid>();
|
||||
|
||||
private MainWindow mainWindow;
|
||||
|
||||
public Incidents()
|
||||
{
|
||||
mainWindow = MainWindow.MainInstance;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void InitializeContracts()
|
||||
{
|
||||
try
|
||||
{
|
||||
unreadTickets = ConfigClass.LoadFromJson<List<Guid>>("UnreadTickets", "run");
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (unreadTickets == null)
|
||||
unreadTickets = new List<Guid>();
|
||||
}
|
||||
|
||||
private void OnCreateNewTicketClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (mainWindow.ConfigSettings.GetConfig()._createNewTicketDirectLink != String.Empty)
|
||||
{
|
||||
Process.Start(mainWindow.ConfigSettings.GetConfig()._createNewTicketDirectLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(mainWindow.ConfigSettings.GetMatrixServer(true) + "/wm");
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadAll_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
foreach (KeyValuePair<Guid, IncidentListItem> item in ticketCollection)
|
||||
{
|
||||
item.Value.IsUnread = false;
|
||||
}
|
||||
CheckAllTicketsRead(null, null);
|
||||
}
|
||||
|
||||
public void CheckAllTicketsRead(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e != null)
|
||||
e.Handled = true;
|
||||
if (sender == null)
|
||||
{
|
||||
unreadTickets.Clear();
|
||||
lock (mainWindow.NewContentSignals)
|
||||
{
|
||||
mainWindow.NewContentSignals[enumMainFunctions.Incident] = false;
|
||||
mainWindow._isRedDotActive = false;
|
||||
}
|
||||
mainWindow.UpdateNewContentSignals();
|
||||
}
|
||||
else
|
||||
{
|
||||
Boolean allRead = true;
|
||||
IncidentListItem incItem = null;
|
||||
if (sender is Image)
|
||||
{
|
||||
Image item = (Image)sender;
|
||||
incItem = (IncidentListItem)item.DataContext;
|
||||
|
||||
}
|
||||
else if (sender is IncidentListItem)
|
||||
{
|
||||
incItem = (IncidentListItem)sender;
|
||||
|
||||
}
|
||||
|
||||
if (incItem != null)
|
||||
{
|
||||
incItem.IsUnread = false;
|
||||
unreadTickets.Remove(incItem.getEOID());
|
||||
|
||||
foreach (KeyValuePair<Guid, IncidentListItem> inc in ticketCollection)
|
||||
{
|
||||
if (inc.Value.IsUnread)
|
||||
{
|
||||
allRead = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allRead)
|
||||
{
|
||||
unreadTickets.Clear();
|
||||
lock (mainWindow.NewContentSignals)
|
||||
{
|
||||
mainWindow.NewContentSignals[enumMainFunctions.Incident] = false;
|
||||
mainWindow._isRedDotActive = false;
|
||||
|
||||
}
|
||||
mainWindow.UpdateNewContentSignals();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConfigClass.SaveAsJson("UnreadTickets", unreadTickets, "run");
|
||||
}
|
||||
|
||||
public void ProcessNewTickets(List<Ticket> _tickets)
|
||||
{
|
||||
var newLastUpdate = mainWindow.lastUpdate;
|
||||
|
||||
try
|
||||
{
|
||||
if (_tickets != null && _tickets.Count > 0)
|
||||
{
|
||||
NoIncident.Visibility = Visibility.Hidden;
|
||||
|
||||
foreach (Ticket ti in _tickets)
|
||||
{
|
||||
if (ti._objectID == Guid.Empty)
|
||||
continue;
|
||||
|
||||
if (!ticketCollection.TryGetValue(ti._objectID, out var item))
|
||||
{
|
||||
item = new IncidentListItem(ti)
|
||||
{
|
||||
Margin = new Thickness(2, 10, 2, 0),
|
||||
};
|
||||
item.MouseLeftButtonDown += OnTicketClicked;
|
||||
item.signal.PreviewMouseDown += CheckAllTicketsRead;
|
||||
ticketCollection.Add(ti._objectID, item);
|
||||
}
|
||||
|
||||
item.TicketItem = ti;
|
||||
|
||||
if (ti._lastJournalEntryAction is int jText
|
||||
&& staticLibs.JournalActivityAction.TryGetValue(jText, out var actionInfo)
|
||||
&& actionInfo.visible)
|
||||
{
|
||||
item.LastJournalEntryActionText = actionInfo.JournalText;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.LastJournalEntryActionText = string.Empty;
|
||||
}
|
||||
|
||||
if (ti._lastJournalEntryDate > mainWindow.lastUpdate)
|
||||
{
|
||||
unreadTickets.Add(ti._objectID);
|
||||
item.IsUnread = true;
|
||||
|
||||
mainWindow.NewContentSignalsInfo[enumMainFunctions.Incident] =
|
||||
Properties.Resources.NewTicketInfoMessage;
|
||||
|
||||
if (ti._lastJournalEntryDate > newLastUpdate)
|
||||
newLastUpdate = ti._lastJournalEntryDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.IsUnread = unreadTickets.Contains(ti._objectID);
|
||||
}
|
||||
|
||||
item.TicketType = ti._ticketType;
|
||||
}
|
||||
var incomingIds = new HashSet<Guid>(_tickets.Select(t => t._objectID));
|
||||
var keysToRemove = ticketCollection.Keys
|
||||
.Where(id => !incomingIds.Contains(id))
|
||||
.ToList();
|
||||
foreach (var id in keysToRemove)
|
||||
{
|
||||
ticketCollection.Remove(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ticketCollection.Clear();
|
||||
NoIncident.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
cLogManager.LogException(e);
|
||||
}
|
||||
|
||||
if (newLastUpdate > mainWindow.lastUpdate)
|
||||
{
|
||||
mainWindow.lastUpdate = newLastUpdate;
|
||||
ConfigClass.SaveAsJson("LastTicketUpdate", mainWindow.lastUpdate, "run");
|
||||
}
|
||||
|
||||
ConfigClass.SaveAsJson("UnreadTickets", unreadTickets, "run");
|
||||
|
||||
ticketCollection = ticketCollection
|
||||
.OrderByDescending(x => x.Value.TicketItem._lastJournalEntryDate)
|
||||
.ThenByDescending(x => x.Value.TicketItem._createdDate)
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
FillIncidentGrid();
|
||||
}
|
||||
|
||||
public void FillIncidentGrid()
|
||||
{
|
||||
try
|
||||
{
|
||||
var setNewContent = false;
|
||||
|
||||
_incidentHead.Children.Clear();
|
||||
foreach (var item in ticketCollection)
|
||||
{
|
||||
if (item.Value.IsUnread)
|
||||
setNewContent = true;
|
||||
var control = item.Value;
|
||||
control.TicketItem = control.TicketItem; // löst im Setter alle OnPropertyChanged aus
|
||||
_incidentHead.Children.Add(control);
|
||||
}
|
||||
|
||||
CanvasIncident.Content = null;
|
||||
|
||||
CanvasIncident.Content = _incidentHead;
|
||||
|
||||
if (setNewContent)
|
||||
{
|
||||
lock (mainWindow.NewContentSignals)
|
||||
mainWindow.NewContentSignals[enumMainFunctions.Incident] = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTicketClicked(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is FrameworkElement fe && fe.DataContext is IncidentListItem item)
|
||||
{
|
||||
if (!item.TicketItem._objectID.Equals(Guid.Empty))
|
||||
{
|
||||
try
|
||||
{
|
||||
string startParam;
|
||||
|
||||
if (mainWindow.ConfigSettings.GetConfig()._isUUX)
|
||||
{
|
||||
startParam = string.Format("{0}/wm/app-SelfServicePortal/notSet/preview-object/{1}/{2}/0/",
|
||||
mainWindow.ConfigSettings.GetMatrixServer(true),
|
||||
item.TicketItem._sysEntity,
|
||||
item.TicketItem._objectID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
startParam = string.Format("{0}/SPS/Portal/Pages/Support/IncidentDetails.aspx?IncidentID={1}&ConsiderArchivedData=0",
|
||||
mainWindow.ConfigSettings.GetMatrixServer(true),
|
||||
item.TicketItem._objectID.ToString());
|
||||
}
|
||||
|
||||
Process.Start(startParam);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Not yet implemented
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
328
UserControls/Navigation.xaml
Normal file
328
UserControls/Navigation.xaml
Normal file
@@ -0,0 +1,328 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.Navigation"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
|
||||
|
||||
<Canvas ClipToBounds="false"
|
||||
Panel.ZIndex="1000"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"
|
||||
Height="620"
|
||||
Width="75">
|
||||
<Button Visibility="Hidden"
|
||||
x:Name="BtnBack"
|
||||
Tag="100"
|
||||
Canvas.Top="0"
|
||||
Canvas.Left="-1"
|
||||
Width="70"
|
||||
Height="50"
|
||||
BorderThickness="0"
|
||||
Style="{StaticResource FlatButtonStyle2}"
|
||||
Panel.ZIndex="1000">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Canvas ClipToBounds="False"
|
||||
Background="{Binding Background, ElementName=BtnBack}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Background="Transparent"
|
||||
ClipToBounds="false"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Width="70">
|
||||
<Image Source="Resources/icons/dark/appbar.home.gps.png"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Tag="ICO"
|
||||
Stretch="Fill"
|
||||
Width="60"
|
||||
Height="50"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="top"
|
||||
Margin="5,0,0,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Tag="0"
|
||||
x:Uid="1"
|
||||
x:Name="BtnAnnouncements"
|
||||
Visibility="Visible"
|
||||
Style="{StaticResource FlatButtonStyle2}"
|
||||
ToolTip="{x:Static resx:Resources.mo_announcement}"
|
||||
BorderThickness="0"
|
||||
Panel.ZIndex="1000"
|
||||
Width="70"
|
||||
Height="70"
|
||||
Canvas.Left="0"
|
||||
Canvas.Top="0">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Canvas ClipToBounds="False"
|
||||
Background="{Binding Background, ElementName=BtnAnnouncements}">
|
||||
<Canvas Panel.ZIndex="1000"
|
||||
Height="70"
|
||||
Width="80"
|
||||
Margin="70,0,0,0">
|
||||
<Polygon Visibility="Hidden"
|
||||
x:Name="poly_main1"
|
||||
Panel.ZIndex="900"
|
||||
Points="0,0 10,0 10,70 0,70"
|
||||
Fill="{Binding Background, ElementName=BtnAnnouncements}" />
|
||||
</Canvas>
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Background="Transparent"
|
||||
ClipToBounds="False"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Image Source="{DynamicResource nav_appbar_newspaper}"
|
||||
Panel.ZIndex="18"
|
||||
Tag="ICO"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
x:Name="icoAnn"
|
||||
Stretch="Fill"
|
||||
Width="60"
|
||||
Height="60"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5" />
|
||||
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Tag="Signal"
|
||||
Stretch="None"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="-29,-29,0,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Uid="2"
|
||||
Panel.ZIndex="1000"
|
||||
x:Name="BtnIncident"
|
||||
Visibility="Hidden"
|
||||
Style="{StaticResource FlatButtonStyle2}"
|
||||
ToolTip="{x:Static resx:Resources.mo_incidents }"
|
||||
BorderThickness="0"
|
||||
Canvas.Top="0"
|
||||
Width="70"
|
||||
Height="70"
|
||||
Canvas.Left="0">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Canvas ClipToBounds="False"
|
||||
Background="{Binding Background, ElementName=BtnIncident}">
|
||||
<Canvas Panel.ZIndex="1000"
|
||||
Height="70"
|
||||
Width="80"
|
||||
Margin="70,0,0,0">
|
||||
<Polygon Visibility="Hidden"
|
||||
x:Name="poly_main2"
|
||||
Panel.ZIndex="1000"
|
||||
Points="0,0 10,0 10,70 0,70"
|
||||
Fill="{Binding Background, ElementName=BtnIncident}" />
|
||||
</Canvas>
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel x:Name="StackPanel"
|
||||
Orientation="Horizontal"
|
||||
Background="Transparent">
|
||||
<Image Source="{DynamicResource nav_appbar_clipboard_variant_text}"
|
||||
x:Name="icoInc"
|
||||
Tag="ICO"
|
||||
Stretch="fill"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Width="60"
|
||||
Height="60"
|
||||
Margin="5" />
|
||||
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Tag="Signal"
|
||||
Stretch="None"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="-29,-29,0,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Panel.ZIndex="1000"
|
||||
x:Uid="3"
|
||||
x:Name="BtnSsp"
|
||||
Visibility="Hidden"
|
||||
Style="{StaticResource FlatButtonStyle2}"
|
||||
ToolTip="{x:Static resx:Resources.mo_ssp}"
|
||||
BorderThickness="0"
|
||||
Canvas.Top="0"
|
||||
Width="70"
|
||||
Height="70"
|
||||
Canvas.Left="0">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Canvas ClipToBounds="false"
|
||||
Background="{Binding Background, ElementName=BtnSsp}">
|
||||
<Canvas Panel.ZIndex="1000"
|
||||
Height="70"
|
||||
Width="80"
|
||||
Margin="70,0,0,0">
|
||||
<Polygon Visibility="Hidden"
|
||||
x:Name="poly_main3"
|
||||
Panel.ZIndex="1000"
|
||||
Points="0,0 10,0 10,70 0,70"
|
||||
Fill="{Binding Background, ElementName=BtnSsp}" />
|
||||
</Canvas>
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Background="Transparent">
|
||||
<Image Source="{DynamicResource nav_appbar_cart}"
|
||||
x:Name="icoSSP"
|
||||
Stretch="fill"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Width="60"
|
||||
Height="60"
|
||||
Margin="5"
|
||||
Tag="ICO" />
|
||||
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Tag="Signal"
|
||||
Stretch="None"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="-29,-29,0,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Name="BtnCustomLink"
|
||||
x:Uid="4"
|
||||
Margin="0,0,0,0"
|
||||
Visibility="Hidden"
|
||||
Style="{StaticResource FlatButtonStyle2}"
|
||||
ToolTip="{x:Static resx:Resources.CustomLink}"
|
||||
BorderThickness="0"
|
||||
Canvas.Top="0"
|
||||
Width="70"
|
||||
Height="70"
|
||||
Canvas.Left="0"
|
||||
Panel.ZIndex="1000">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Canvas ClipToBounds="False"
|
||||
Background="{Binding Background, ElementName=BtnCustomLink}">
|
||||
<Canvas Panel.ZIndex="1000"
|
||||
Height="70"
|
||||
Width="80"
|
||||
Margin="70,0,0,0">
|
||||
<Polygon Visibility="Hidden"
|
||||
x:Name="poly_main4"
|
||||
Panel.ZIndex="90"
|
||||
Points="0,0 10,0 10,70 0,70"
|
||||
Fill="{Binding Background, ElementName=BtnCustomLink}" />
|
||||
</Canvas>
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Background="Transparent">
|
||||
<Image Source="{DynamicResource nav_appbar_star}"
|
||||
x:Name="icoCustomLinks"
|
||||
Tag="ICO"
|
||||
Stretch="fill"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Width="60"
|
||||
Height="60"
|
||||
Margin="5" />
|
||||
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Tag="Signal"
|
||||
Stretch="None"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="-29,-29,0,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Name="BtnInfo"
|
||||
x:Uid="5"
|
||||
Margin="0,0,0,0"
|
||||
Visibility="Hidden"
|
||||
Style="{StaticResource FlatButtonStyle2}"
|
||||
ToolTip="{x:Static resx:Resources.mo_information}"
|
||||
BorderThickness="0"
|
||||
Canvas.Top="0"
|
||||
Width="70"
|
||||
Height="70"
|
||||
Canvas.Left="0"
|
||||
Panel.ZIndex="1000">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Canvas ClipToBounds="False"
|
||||
Background="{Binding Background, ElementName=BtnInfo}">
|
||||
<Canvas Panel.ZIndex="1000"
|
||||
Height="70"
|
||||
Width="80"
|
||||
Margin="70,0,0,0">
|
||||
<Polygon Visibility="Hidden"
|
||||
x:Name="poly_main4"
|
||||
Panel.ZIndex="90"
|
||||
Points="0,0 10,0 10,70 0,70"
|
||||
Fill="{Binding Background, ElementName=BtnInfo}" />
|
||||
</Canvas>
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Background="Transparent">
|
||||
<Image Source="{DynamicResource nav_appbar_information}"
|
||||
x:Name="icoInfo"
|
||||
Tag="ICO"
|
||||
Stretch="fill"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Width="60"
|
||||
Height="60"
|
||||
Margin="5" />
|
||||
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="18"
|
||||
Style="{StaticResource ImageStyle}"
|
||||
Tag="Signal"
|
||||
Stretch="None"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="-29,-29,0,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Canvas>
|
||||
|
||||
</UserControl>
|
||||
28
UserControls/Navigation.xaml.cs
Normal file
28
UserControls/Navigation.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Navigation.xaml
|
||||
/// </summary>
|
||||
public partial class Navigation : UserControl
|
||||
{
|
||||
public Navigation()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
66
UserControls/PasswordInputBox.xaml
Normal file
66
UserControls/PasswordInputBox.xaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<UserControl x:Name="_this"
|
||||
x:Class="C4IT_CustomerPanel.UserControls.PasswordInputBox"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:ico="clr-namespace:C4IT.AdaptableIcons;assembly=C4IT-AdaptableIcons"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="400"
|
||||
>
|
||||
<Border
|
||||
Margin="8 5"
|
||||
CornerRadius="2"
|
||||
BorderThickness="0.5"
|
||||
BorderBrush="Gray"
|
||||
VerticalAlignment="Center"
|
||||
Padding="3 2"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<PasswordBox Grid.Column="0"
|
||||
x:Name="pwBoxPassword" x:FieldModifier="private"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0 0 3 0"
|
||||
Password="123"
|
||||
Visibility="Visible"
|
||||
PasswordChanged="pwBoxPassword_PasswordChanged"
|
||||
/>
|
||||
<TextBox Grid.Column="0"
|
||||
x:Name="txtBoxPassword" x:FieldModifier="private"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
Margin="0 0 3 0"
|
||||
Text="123"
|
||||
TextChanged="txtBoxPassword_TextChanged"
|
||||
/>
|
||||
<ico:AdaptableIcon
|
||||
x:Name="iconShow" x:FieldModifier="private"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_visibility"
|
||||
BorderPadding="0"
|
||||
IconWidth="17" IconHeight="17"
|
||||
Visibility="Visible"
|
||||
MouseLeftButtonDown="iconPasswordShow_MouseLeftButtonDown"
|
||||
/>
|
||||
<ico:AdaptableIcon
|
||||
x:Name="iconHide" x:FieldModifier="private"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_visibility_off"
|
||||
BorderPadding="0"
|
||||
IconWidth="17" IconHeight="17"
|
||||
Visibility="Collapsed"
|
||||
MouseLeftButtonDown="iconPasswordShow_MouseLeftButtonDown"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
102
UserControls/PasswordInputBox.xaml.cs
Normal file
102
UserControls/PasswordInputBox.xaml.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
public partial class PasswordInputBox : UserControl
|
||||
{
|
||||
|
||||
#region Password property
|
||||
public static readonly DependencyProperty PasswordProperty =
|
||||
DependencyProperty.Register(
|
||||
"Password", typeof(string),
|
||||
typeof(PasswordInputBox),
|
||||
new PropertyMetadata("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1", PasswordChangedCallback)
|
||||
);
|
||||
|
||||
public string Password
|
||||
{
|
||||
get { return (string)GetValue(PasswordProperty); }
|
||||
set {
|
||||
SetValue(PasswordProperty, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public PasswordInputBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static void PasswordChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is PasswordInputBox _me)
|
||||
{
|
||||
var pw = e.NewValue as string;
|
||||
|
||||
if (_me.txtBoxPassword?.Visibility == Visibility.Visible)
|
||||
{
|
||||
if (_me.txtBoxPassword?.Text != pw)
|
||||
_me.txtBoxPassword?.Text = pw;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_me.pwBoxPassword?.Password != pw)
|
||||
_me.pwBoxPassword?.Password = pw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void iconPasswordShow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (txtBoxPassword.Visibility == Visibility.Visible)
|
||||
{
|
||||
pwBoxPassword.Password = txtBoxPassword.Text;
|
||||
pwBoxPassword.Visibility = Visibility.Visible;
|
||||
iconShow.Visibility = Visibility.Visible;
|
||||
txtBoxPassword.Visibility = Visibility.Collapsed;
|
||||
iconHide.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtBoxPassword.Text = pwBoxPassword.Password;
|
||||
txtBoxPassword.Visibility = Visibility.Visible;
|
||||
iconHide.Visibility = Visibility.Visible;
|
||||
pwBoxPassword.Visibility = Visibility.Collapsed;
|
||||
iconShow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private void txtBoxPassword_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (sender is TextBox)
|
||||
{
|
||||
pwBoxPassword.Password = txtBoxPassword.Text;
|
||||
Password = txtBoxPassword.Text;
|
||||
}
|
||||
}
|
||||
|
||||
private void pwBoxPassword_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is PasswordBox)
|
||||
{
|
||||
Password = pwBoxPassword.Password;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UserControls/PortalSearch.xaml
Normal file
120
UserControls/PortalSearch.xaml
Normal file
@@ -0,0 +1,120 @@
|
||||
<UserControl x:Class="C4IT_CustomerPanel.UserControls.PortalSearch"
|
||||
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:C4IT_CustomerPanel.UserControls"
|
||||
xmlns:resx="clr-namespace:C4IT_CustomerPanel.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="Button"
|
||||
x:Key="ButtonStyle">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource navForeground}" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource inactiveButtonColor}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource activeButtonColor}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="GridSsp"
|
||||
x:FieldModifier="private"
|
||||
Canvas.Left="1500"
|
||||
Width="500"
|
||||
Canvas.Top="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="185*" />
|
||||
<ColumnDefinition Width="30*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="6*" />
|
||||
<RowDefinition Height="7*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Canvas x:Name="CanvasSearch"
|
||||
x:FieldModifier="private"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0"
|
||||
Height="70">
|
||||
<Image Source="{DynamicResource appbar_magnify}"
|
||||
Width="48"
|
||||
Tag="MAINICO" />
|
||||
<Label Foreground="{DynamicResource mainForeground}"
|
||||
x:Name="LblSearch"
|
||||
x:FieldModifier="private"
|
||||
Content="{x:Static resx:Resources.search}"
|
||||
FontSize="16"
|
||||
Canvas.Top="10"
|
||||
Canvas.Left="40" />
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Width="350"
|
||||
Canvas.Top="45"
|
||||
Canvas.Left="10">
|
||||
<TextBox x:Name="TxtSearchTerm"
|
||||
x:FieldModifier="private"
|
||||
Width="320"
|
||||
Background="White"
|
||||
Height="25"
|
||||
FontSize="16"
|
||||
Panel.ZIndex="1110"
|
||||
KeyDown="OnSearchBoxEnter"
|
||||
Margin="5,0,0,0" />
|
||||
<Image Source="../Resources/icons/light/appbar.magnify.png"
|
||||
Width="48"
|
||||
PreviewMouseDown="OnSearchClicked"
|
||||
Cursor="Hand"
|
||||
Visibility="Collapsed" />
|
||||
</StackPanel>
|
||||
</Canvas>
|
||||
<Canvas Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="1"
|
||||
Height="400">
|
||||
<Button Style="{StaticResource ButtonStyle}"
|
||||
x:Name="BtnSspLink"
|
||||
x:FieldModifier="private"
|
||||
Width="320"
|
||||
Canvas.Left="15"
|
||||
Height="40"
|
||||
Content="Self Service Portal"
|
||||
FontSize="18"
|
||||
Canvas.Top="40"
|
||||
Click="OnSSPLinkClicked" />
|
||||
<Button Foreground="{DynamicResource navForeground}"
|
||||
x:Name="BtnMyserviceLink"
|
||||
x:FieldModifier="private"
|
||||
Style="{StaticResource ButtonStyle}"
|
||||
Width="320"
|
||||
Canvas.Left="15"
|
||||
Height="40"
|
||||
Content="{x:Static resx:Resources.myservices}"
|
||||
Tag="LABEL"
|
||||
FontSize="18"
|
||||
Canvas.Top="90"
|
||||
Click="OnMyServiceLinkClicked" />
|
||||
<!--<Separator Canvas.Left="15" Width="320" Canvas.Top="140" Height="2" />-->
|
||||
<!--<StackPanel x:Name="CustomLinkPanel" Orientation="Vertical" Canvas.Top="150"/>-->
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
70
UserControls/PortalSearch.xaml.cs
Normal file
70
UserControls/PortalSearch.xaml.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace C4IT_CustomerPanel.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PortalSearch.xaml
|
||||
/// </summary>
|
||||
public partial class PortalSearch : UserControl
|
||||
{
|
||||
public const string SearchDirectLink = "{0}/wm/app-SelfServicePortal/?cpsearch={1}";
|
||||
public const string SPSSearchDirectLink = "{0}/SPS/Portal/Pages/PortalSearch.aspx?SearchTerms={1}";
|
||||
|
||||
|
||||
public PortalSearch()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnMyServiceLinkClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.MainInstance.ConfigSettings.GetConfig()._isUUX)
|
||||
{
|
||||
Process.Start(MainWindow.MainInstance.ConfigSettings.GetMatrixServer(true) + "/wm/app-SelfServicePortal/search-page/386f24ac-463a-e711-309c-8c89a56499ca/nofilter/");
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(MainWindow.MainInstance.ConfigSettings.GetMatrixServer(true) + "/SPS/Portal/Pages/Workplace/Services.aspx?TabulatorID=50d1415a-659d-4272-a539-1f6d6aaa1518");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSearchBoxEnter(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
OnSearchClicked(sender, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSearchClicked(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(TxtSearchTerm.Text.Trim()))
|
||||
return;
|
||||
string searchTerm = WebUtility.UrlEncode(TxtSearchTerm.Text.Trim());
|
||||
if (MainWindow.MainInstance.ConfigSettings.GetConfig()._isUUX)
|
||||
{
|
||||
Process.Start(string.Format(SearchDirectLink, MainWindow.MainInstance.ConfigSettings.GetMatrixServer(true), searchTerm));
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(string.Format(SPSSearchDirectLink, MainWindow.MainInstance.ConfigSettings.GetMatrixServer(true), searchTerm));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSSPLinkClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.MainInstance.ConfigSettings.GetConfig()._isUUX)
|
||||
{
|
||||
Process.Start(MainWindow.MainInstance.ConfigSettings.GetMatrixServer(true) + "/wm/app-SelfServicePortal");
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(MainWindow.MainInstance.ConfigSettings.GetMatrixServer(true) + "/SPS/Portal");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user