aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-12-08 15:28:31 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-12-08 15:28:31 +0200
commitd1859415972bb991cba6639482c1cd2a9e19e8d8 (patch)
tree93f688cdcf876c23072cf3de016c3811982fbd7e /Software/Visual_Studio
parent3cd59dd3b04168ad91cb1fe51231e9b3ddd74705 (diff)
downloadTango-d1859415972bb991cba6639482c1cd2a9e19e8d8.tar.gz
Tango-d1859415972bb991cba6639482c1cd2a9e19e8d8.zip
Implemented possible improvement for WebClient download speed.
Implemented PPC notifications priority.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs11
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs3
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs4
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs20
-rw-r--r--Software/Visual_Studio/Tango.Transport/Web/StandardFileDownloader.cs1
12 files changed, 67 insertions, 12 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs
index 7ff64c505..c3c3baa70 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs
@@ -129,12 +129,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
private void OnSelectedUpdateChanged()
{
- if (SelectedUpdate == null) return;
-
- var selectedUpdate = SelectedUpdate;
- SelectedUpdate = null;
-
- _notification.ShowModalDialog<MachineUpdateDetailsDialogVM, MachineUpdateDetailsDialog>(new MachineUpdateDetailsDialogVM() { Update = selectedUpdate }, (vm) => { }, () => { });
+ if (SelectedUpdate != null && SelectedUpdate.ApplicationVersion != "Fake")
+ {
+ _notification.ShowModalDialog<MachineUpdateDetailsDialogVM, MachineUpdateDetailsDialog>(new MachineUpdateDetailsDialogVM() { Update = SelectedUpdate }, (vm) => { }, () => { });
+ SelectedUpdate = new TangoUpdate() { ApplicationVersion = "Fake"};
+ }
}
#endregion
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
index 94f98feb2..345503ed3 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
@@ -24,6 +24,7 @@ using Tango.MachineStudio.Common;
using Tango.Core;
using Tango.BL;
using Tango.Integration.Operation;
+using System.Net;
namespace Tango.MachineStudio.UI
{
@@ -98,6 +99,8 @@ namespace Tango.MachineStudio.UI
exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed;
ApplyEFCacheSettings();
+
+ WebRequest.DefaultWebProxy = null;
}
private void ApplyEFCacheSettings()
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
index d2a730cd7..3f549598a 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
@@ -144,15 +144,19 @@ namespace Tango.PPC.Events.ViewModels
{
case EventTypeCategories.Info:
notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Info;
+ notificationItem.Priority = NotificationItem.NotificationPriority.Normal;
break;
case EventTypeCategories.Warning:
notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Warning;
+ notificationItem.Priority = NotificationItem.NotificationPriority.High;
break;
case EventTypeCategories.Error:
notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error;
+ notificationItem.Priority = NotificationItem.NotificationPriority.VeryHigh;
break;
case EventTypeCategories.Critical:
notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Critical;
+ notificationItem.Priority = NotificationItem.NotificationPriority.Critical;
break;
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
index ed1e28f55..624b192a5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
@@ -85,7 +85,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
NavigationManager.NavigateWithObject<JobsModule, JobView, Job>(e.Job);
NavigationManager.ClearHistoryExcept<JobsView>();
- }));
+ }, NotificationItem.NotificationPriority.Critical));
}
/// <summary>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
index c4e82b7d2..4a0627d70 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -23,6 +24,11 @@ namespace Tango.PPC.Common.Notifications
ObservableCollection<NotificationItem> NotificationItems { get; }
/// <summary>
+ /// Gets the notification items view.
+ /// </summary>
+ ICollectionView NotificationItemsView { get; }
+
+ /// <summary>
/// Gets the collection of taskbar items.
/// </summary>
ObservableCollection<TaskBarItem> TaskBarItems { get; }
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
index c96fe9dee..cf81237ca 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
@@ -14,12 +14,22 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
public abstract class NotificationItem : ItemBase
{
+ public enum NotificationPriority
+ {
+ Low,
+ Normal,
+ High,
+ VeryHigh,
+ Critical,
+ }
+
/// <summary>
/// Initializes a new instance of the <see cref="NotificationItem"/> class.
/// </summary>
public NotificationItem() : base()
{
CanClose = true;
+ Priority = NotificationPriority.Normal;
}
private bool _isExpanded;
@@ -43,6 +53,11 @@ namespace Tango.PPC.Common.Notifications
}
/// <summary>
+ /// Gets or sets the notification priority.
+ /// </summary>
+ public NotificationPriority Priority { get; set; }
+
+ /// <summary>
/// Called when the item has been pressed.
/// </summary>
protected override void OnPreesed()
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs
index a9de336a1..571eb199d 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs
@@ -77,7 +77,7 @@ namespace Tango.PPC.Common.Notifications.NotificationItems
/// <param name="expandedMessage">The expanded message.</param>
/// <param name="type">The type.</param>
/// <param name="pressedAction">The pressed action.</param>
- public MessageNotificationItem(String message, String expandedMessage, MessageNotificationItemTypes type, Action pressedAction) : this()
+ public MessageNotificationItem(String message, String expandedMessage, MessageNotificationItemTypes type, Action pressedAction, NotificationPriority priority = NotificationPriority.Normal) : this()
{
Message = message;
ExpandedMessage = expandedMessage;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs
index bd3f04958..f9261e754 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs
@@ -5,6 +5,7 @@ using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Net;
using System.Threading.Tasks;
using System.Windows;
using Tango.BL;
@@ -89,6 +90,8 @@ namespace Tango.PPC.UI
settings.Save();
LogManager.Categories.AddRange(settings.LoggingCategories);
+
+ WebRequest.DefaultWebProxy = null;
}
#region Global Exception Trapping
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
index 65337a892..a8ac2b24b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
@@ -17,6 +17,8 @@ using Tango.Touch.Controls;
using Tango.SharedUI;
using System.Reflection;
using Tango.Core.DI;
+using System.ComponentModel;
+using System.Windows.Data;
namespace Tango.PPC.UI.Notifications
{
@@ -47,6 +49,11 @@ namespace Tango.PPC.UI.Notifications
public ObservableCollection<NotificationItem> NotificationItems { get; private set; }
/// <summary>
+ /// Gets the notification items view.
+ /// </summary>
+ public ICollectionView NotificationItemsView { get; private set; }
+
+ /// <summary>
/// Gets the collection of taskbar items.
/// </summary>
public ObservableCollection<TaskBarItem> TaskBarItems { get; private set; }
@@ -66,6 +73,9 @@ namespace Tango.PPC.UI.Notifications
PopNotificationCommand = new RelayCommand<NotificationItem>((x) => PopNotification(x));
NotificationItems.EnableCrossThreadOperations();
+
+ NotificationItemsView = CollectionViewSource.GetDefaultView(NotificationItems);
+ NotificationItemsView.SortDescriptions.Add(new SortDescription(nameof(NotificationItem.Priority), ListSortDirection.Descending));
}
private MessageBoxVM _currentMessageBox;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml
index fc9b05b9b..1d4dd6fc7 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml
@@ -8,7 +8,7 @@
xmlns:common="clr-namespace:Tango.PPC.Common.Converters"
mc:Ignorable="d"
x:Name="MessageNotificationItemControl"
- d:DesignHeight="60" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:UpdateAvailableNotificationItem, IsDesignTimeCreatable=False}" MinHeight="90" Height="90" MaxHeight="150" Background="White">
+ d:DesignHeight="60" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:UpdateAvailableNotificationItem, IsDesignTimeCreatable=False}" MinHeight="90" Height="90" MaxHeight="150" Background="{StaticResource TangoPrimaryBackgroundBrush}">
<Grid>
<Border BorderThickness="0 0 0 2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" Padding="15">
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs
index ef7e24ff4..ccd27333a 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs
@@ -165,8 +165,7 @@ namespace Tango.Touch.Controls
{
element.RegisterForLoadedOrNow((x, y) =>
{
- CurrentMinHeight = element.ActualHeight;
- ResizeNotification(element);
+ CurrentMinHeight = element.FindChild<UserControl>().MinHeight;
});
}
}
@@ -250,10 +249,25 @@ namespace Tango.Touch.Controls
if (Notifications is INotifyCollectionChanged)
{
- (Notifications as INotifyCollectionChanged).CollectionChanged += (_, __) =>
+ (Notifications as INotifyCollectionChanged).CollectionChanged += (_, e) =>
{
this.BeginInvoke(() =>
{
+ if (e.NewItems != null && e.NewItems.Count > 0)
+ {
+ foreach (var item in e.NewItems.Cast<Object>().ToList())
+ {
+ var element = _items_control.ItemContainerGenerator.ContainerFromItem(item) as FrameworkElement;
+ if (element != null)
+ {
+ element.RegisterForLoadedOrNow((___, ____) =>
+ {
+ ResizeNotification(element);
+ });
+ }
+ }
+ }
+
UpdateExpanded(IsExpanded);
});
};
diff --git a/Software/Visual_Studio/Tango.Transport/Web/StandardFileDownloader.cs b/Software/Visual_Studio/Tango.Transport/Web/StandardFileDownloader.cs
index d254abd96..1b62fc023 100644
--- a/Software/Visual_Studio/Tango.Transport/Web/StandardFileDownloader.cs
+++ b/Software/Visual_Studio/Tango.Transport/Web/StandardFileDownloader.cs
@@ -23,6 +23,7 @@ namespace Tango.Transport.Web
Address = address;
FileName = fileName;
_client = new WebClient();
+ _client.Proxy = null;
_client.DownloadProgressChanged += _client_DownloadProgressChanged;
_client.DownloadFileCompleted += _client_DownloadFileCompleted;