| ofs | hex dump | ascii |
|---|
| 0000 | ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48 00 48 00 00 ff e1 00 18 45 78 69 66 00 00 49 49 | ......JFIF.....H.H......Exif..II |
| 0020 | 2a 00 08 00 00 00 00 00 00 00 00 00 00 00 ff db 00 43 00 03 02 02 02 02 02 03 02 02 02 03 03 03 | *................C.............. |
| 0040 | 03 04 06 04 04 04 04 04 08 06 06 05 06 09 08 0a 0a 09 08 09 09 0a 0c 0f 0c 0a 0b 0e 0b 09 09 0d | ................................ |
| 0060 | 11 0d 0e 0f 10 10 11 10 0a 0c 12 13 12 10 13 0f 10 10 10 ff db 00 43 01 03 03 03 04 03 04 08 04 | ......................C......... |
| 0080 | 04 08 10 0b 09 0b 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 | ................................ |
| 00a0 | 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ff c0 00 11 08 04 38 07 | ..............................8. |
| 00c0 | 80 03 01 11 00 02 11 01 03 11 01 ff c4 00 1d 00 00 01 04 03 01 01 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00e0 | 00 04 05 07 08 01 03 06 02 09 ff c4 00 6d 10 00 01 02 04 03 04 05 05 09 08 0b 09 0c 09 03 05 01 | .............m.................. |
| 0100 | 02 03 00 04 05 11 06 07 21 12 31 41 51 08 13 14 61 71 22 32 52 81 91 15 18 42 56 62 94 a1 d1 d2 | ........!.1AQ...aq"2R....BVb.... |
| 0120 | 16 17 23 92 93 95 b1 c1 33 43 46 53 55 72 b2 b3 d3 e1 f0 36 37 54 57 73 74 75 82 84 24 34 35 44 | ..#.....3CFSUr.....67TWstu..$45D |
| 0140 | 45 63 65 85 96 a2 b4 e2 25 26 27 38 47 64 83 a3 c2 28 86 a4 a5 f1 66 e3 c3 ff c4 00 1b 01 01 00 | Ece.....%&'8Gd...(....f......... |
| 0160 | 03 01 01 01 01 00 00 00 00 00 00 00 00 00 00 01 03 04 02 05 06 07 ff c4 00 37 11 00 02 02 01 03 | .........................7...... |
| 0180 | 03 03 02 04 06 02 01 05 01 01 00 00 01 02 03 11 04 12 31 13 21 51 14 22 41 32 61 05 33 52 a1 23 | ..................1.!Q."A2a.3R.# |
| 01a0 | 42 71 81 b1 f0 15 91 e1 24 34 43 62 f1 c1 d1 ff da 00 0c 03 01 00 02 11 03 11 00 3f 00 a5 f1 e8 | Bq......$4Cb...............?.... |
| 01c0 | 1f 9a 19 4a 4a cd 80 80 7d 87 6a 76 1d 9c a8 28 06 da 51 b9 b0 d3 8c 0a 2c be 30 e4 ec e5 b2 47 | ...JJ...}.jv...(..Q.....,.0....G |
| 01e0 | 1b 4d 4b 26 69 9c 31 55 71 a5 0b 85 a6 4d c2 0f d1 1d 6d 6f e0 c8 ff 00 11 ad 3c 64 e6 ab 18 26 | .MK&i.1Uq....M....mo......<d...& |
| 0200 | ad 48 71 6c cd c9 ba cb 88 f3 90 e2 0a 54 3c 41 8e 78 2f af 57 0b 0e 79 d6 5c 65 45 2b 49 04 40 | .Hql.........T<A.x/.W..y.\eE+I.@ |
| 0220 | d4 9a 7c 1a e0 48 40 19 04 a4 dc 18 03 7b 73 d3 2d 8b 25 c2 3d 70 39 70 8b 30 e4 e4 c3 be 73 87 | ..|..H@......{s.-.%.=p9p.0....s. |
| 0240 | db 00 a0 91 a4 92 4d cc 0e 8c 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 | ......M...@..@..@..@..@..@..@..@ |
| 0260 | 04 00 40 04 00 40 04 00 40 04 00 40 0a 69 c9 0b 9b 42 4f 13 03 8b 3b 44 fa 1d d1 01 91 2d 95 73 | ..@..@..@..@.i...BO...;D.....-.s |
| 0280 | 09 41 23 6e ac ea 8d 8f fc d3 5f 54 6c d3 fd 07 c9 eb 24 e5 6f 72 6f da 57 a4 7d b1 79 98 36 95 | .A#n......_Tl.....$.oro.W.}.y.6. |
| 02a0 | e9 1f 6c 00 6d 2b d2 3e d8 01 1d 68 a8 d1 aa 09 da 36 32 8f 0d ff 00 20 c4 4b 86 3e 51 f2 9b 17 | ..l.m+.>...h.....62......K.>Q... |
| 02c0 | 4b a6 5e 74 a5 22 c0 58 47 9a 7d 6e 92 5b a0 73 d0 35 84 00 40 04 00 40 04 00 40 04 00 40 04 00 | K.^t.".XG.}n.[.s.5..@..@..@..@.. |
| 02e0 | 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 00 40 04 | @..@..@..@..@..@..@..@..@..@..@. |
| 0300 | 00 40 04 00 40 04 00 40 04 00 40 04 01 94 9b 28 1e 50 04 ff 00 d1 8b 36 65 72 ef 16 b6 f5 51 4a | .@..@..@..@....(.P.....6er....QJ |
| 0320 | f7 36 79 b3 2b 39 b2 2e 50 82 41 4b 80 71 d9 50 07 c0 98 b2 a9 ec 96 4f 13 f1 1d 33 9a dc 8b fd | .6y.+9..P.AK.q.P.......O...3.... |
| 0340 | 21 3f 25 55 93 6a a3 4c 9b 66 6e 55 f4 85 36 f3 2b 0b 42 c7 30 44 6e 4f 2b 28 f0 9f 6e 44 f5 ea | !?%U.j.L.fnU..6.+.B.0DnO+(..nD.. |
| 0360 | fd 1b 0b d2 de ad 57 ea 2c c8 c9 30 9b ad d7 4d bd 49 1b d4 a3 c0 0d 4c 1b 51 ee c2 4e 4f 08 f9 | ......W.,..0...M.I.....L.Q..NO.. |
| 0380 | cf 9f d9 92 73 13 1a 54 2b 88 4a 9b 61 d5 06 e5 9b 51 d5 b6 50 2c 80 7b ec 2e 7b c9 8c 13 96 f9 | ....s..T+.J.a....Q..P,.{..{..... |
| 03a0 | 64 fa 3f c3 f4 ee b8 f7 22 18 e0 f5 42 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 | d.?....."...B................... |
| 03c0 | 20 02 00 20 02 00 20 0f 5c 3d 50 07 a4 ee 80 66 e4 6f 81 c8 a5 bd f1 cb 2b 62 e6 78 44 15 c8 5e | ........\=P....f.o......+b.xD..^ |
| 03e0 | ce f8 e7 05 4c 5c d6 ff 00 18 15 b1 4a 37 c0 e4 c9 d0 40 09 dd e3 03 a4 20 7f ce 31 28 b1 72 21 | ....L\......J7....@........1(.r! |
| 0400 | 7f 74 49 6a 10 3b c7 c2 25 1d a1 32 e3 a2 d4 69 57 eb 81 28 f1 ce 04 9e 60 02 00 20 02 00 20 02 | .tIj.;..%..2...iW..(....`....... |
| 0420 | 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 02 00 20 | ..........using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Tango.BL;
using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.MachineDesigner.Views;
using Tango.SharedUI;
namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
public class MachineUpdatesViewVM : ViewModel
{
private INotificationProvider _notification;
private ObservablesContext _context;
private const int MAX_UPDATE_ITEMS = 200;
#region Properties
private Machine _machine;
public Machine Machine
{
get { return _machine; }
set { _machine = value; RaisePropertyChangedAuto(); }
}
private List<TangoUpdate> _updates;
public List<TangoUpdate> Updates
{
get { return _updates; }
set { _updates = value; RaisePropertyChangedAuto(); }
}
private ICollectionView _updatesView;
public ICollectionView UpdatesView
{
get { return _updatesView; }
set { _updatesView = value; RaisePropertyChangedAuto(); }
}
private TangoUpdate _selectedUpdate;
public TangoUpdate SelectedUpdate
{
get { return _selectedUpdate; }
set { _selectedUpdate = value; RaisePropertyChangedAuto(); OnSelectedUpdateChanged(); }
}
private bool _displayMachineSetups;
public bool DisplayMachineSetups
{
get { return _displayMachineSetups; }
set { _displayMachineSetups = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
private bool _displayApplicationUpdates;
public bool DisplayApplicationUpdates
{
get { return _displayApplicationUpdates; }
set { _displayApplicationUpdates = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
private bool _displayDatabaseUpdates;
public bool DisplayDatabaseUpdates
{
get { return _displayDatabaseUpdates; }
set { _displayDatabaseUpdates = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
private bool _displaySynchronizations;
public bool DisplaySynchronizations
{
get { return _displaySynchronizations; }
set { _displaySynchronizations = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
private bool _displayOfflineUpdates;
public bool DisplayOfflineUpdates
{
get { return _displayOfflineUpdates; }
set { _displayOfflineUpdates = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
private bool _displayFirmwareUpgrades;
public bool DisplayFirmwareUpgrades
{
get { return _displayFirmwareUpgrades; }
set { _displayFirmwareUpgrades = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
#endregion
#region Commands
public RelayCommand RefreshCommand { get; set; }
#endregion
#region Constructors
public MachineUpdatesViewVM()
{
DisplayApplicationUpdates = true;
DisplayMachineSetups = true;
DisplayDatabaseUpdates = true;
DisplaySynchronizations = true;
DisplayOfflineUpdates = true;
DisplayFirmwareUpgrades = true;
RefreshCommand = new RelayCommand(Refresh, () => IsFree);
}
public MachineUpdatesViewVM(INotificationProvider notificationProvider) : this()
{
_notification = notificationProvider;
}
#endregion
#region Public Methods
public async Task Init(Machine machine, ObservablesContext context)
{
try
{
_context = context;
Machine = machine;
Updates = (await new TangoUpdatesCollectionBuilder(context).Set(x => x.MachineGuid == machine.Guid).Query(x => x.OrderByDescending(y => y.StartDate).Take(MAX_UPDATE_ITEMS)).BuildAsync()).ToList();
UpdatesView = CollectionViewSource.GetDefaultView(Updates);
UpdatesView.Filter = UpdatesFilter;
OnFilterChanged();
}
catch (Exception ex)
{
LogManager.Log(ex, "Error loading machine updates.");
_notification.ShowError($"An error occurred while loading the history of machine updates.\n{ex.FlattenMessage()}");
}
}
#endregion
#region Private Methods
private async void Refresh()
{
IsFree = false;
using (_notification.PushTaskItem("Refreshing machine updates..."))
{
await Init(Machine, _context);
}
IsFree = true;
}
private void OnFilterChanged()
{
if (UpdatesView != null)
{
UpdatesView.Refresh();
}
}
private bool UpdatesFilter(object obj)
{
TangoUpdate update = obj as TangoUpdate;
if (update != null)
{
if (!DisplayMachineSetups && update.IsSetup) return false;
if (!DisplayApplicationUpdates && update.IsUpdate) return false;
if (!DisplayDatabaseUpdates && update.IsDataBase) return false;
if (!DisplaySynchronizations && update.IsSynchronization) return false;
if (!DisplayOfflineUpdates && update.IsOfflineUpdate) return false;
if (!DisplayFirmwareUpgrades && update.IsOfflineFirmwareUpgrade) return false;
return true;
}
else
{
return false;
}
}
private void OnSelectedUpdateChanged()
{
if (SelectedUpdate != null && SelectedUpdate.ApplicationVersion != "Fake")
{
_notification.ShowModalDialog<MachineUpdateDetailsDialogVM, MachineUpdateDetailsDialog>(new MachineUpdateDetailsDialogVM() { Update = SelectedUpdate }, (vm) => { }, () => { });
SelectedUpdate = new TangoUpdate() { ApplicationVersion = "Fake"};
}
}
#endregion
}
}
|