Skip to content

Commit 1259c2c

Browse files
yaira2tsvietOK
andauthored
Migrated to Toolkit.MVVM (#1752)
Co-authored-by: Vladyslav <[email protected]>
1 parent 2817842 commit 1259c2c

40 files changed

+235
-325
lines changed

Files.Launcher/Win32API.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
using System.Collections.Generic;
33
using System.ComponentModel;
44
using System.Diagnostics;
5+
using System.IO;
56
using System.Linq;
67
using System.Runtime.InteropServices;
78
using System.Text;
89
using System.Threading;
910
using System.Threading.Tasks;
10-
using Vanara.Windows.Shell;
1111
using Vanara.PInvoke;
12+
using Vanara.Windows.Shell;
1213
using Windows.System;
13-
using System.IO;
1414

1515
namespace FilesFullTrust
1616
{

Files/App.xaml.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
using Files.CommandLine;
2+
using Files.Common;
23
using Files.Controllers;
34
using Files.Controls;
45
using Files.Filesystem;
5-
using Files.Interacts;
6+
using Files.Helpers;
67
using Files.View_Models;
78
using Files.Views;
8-
using Files.Helpers;
99
using Microsoft.AppCenter;
1010
using Microsoft.AppCenter.Analytics;
1111
using Microsoft.AppCenter.Crashes;
1212
using Microsoft.Toolkit.Uwp.Helpers;
13+
using Newtonsoft.Json;
1314
using NLog;
1415
using System;
1516
using System.Collections.Generic;
16-
using System.Collections.ObjectModel;
1717
using System.Diagnostics;
18+
using System.Threading.Tasks;
1819
using Windows.ApplicationModel;
1920
using Windows.ApplicationModel.Activation;
2021
using Windows.ApplicationModel.AppService;
21-
using Windows.ApplicationModel.DataTransfer;
2222
using Windows.Storage;
2323
using Windows.UI.Core;
2424
using Windows.UI.ViewManagement;
2525
using Windows.UI.Xaml;
2626
using Windows.UI.Xaml.Controls;
2727
using Windows.UI.Xaml.Media.Animation;
2828
using Windows.UI.Xaml.Navigation;
29-
using System.Threading.Tasks;
30-
using System.Linq;
31-
using Newtonsoft.Json;
32-
using Files.Common;
3329

3430
namespace Files
3531
{
@@ -132,9 +128,11 @@ await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatch
132128
case "Created":
133129
CurrentInstance.FilesystemViewModel.AddFileOrFolderFromShellFile(newItem);
134130
break;
131+
135132
case "Deleted":
136133
CurrentInstance.FilesystemViewModel.RemoveFileOrFolder(itemPath);
137134
break;
135+
138136
default:
139137
CurrentInstance.FilesystemViewModel.RefreshItems();
140138
break;

Files/Controllers/SidebarPinnedController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Files.DataModels;
22
using Newtonsoft.Json;
33
using System;
4-
using System.Diagnostics;
54
using System.IO;
65
using System.Threading.Tasks;
76
using Windows.Storage;

Files/Dialogs/AddItemDialog.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using Windows.Foundation.Collections;
43
using Windows.Storage;
54
using Windows.UI.Xaml.Controls;
65

Files/Dialogs/ExceptionDialog.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Files.UserControls;
2-
using Windows.UI.Xaml;
1+
using Windows.UI.Xaml;
32
using Windows.UI.Xaml.Controls;
43

54
// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

Files/Files.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
<Compile Include="Helpers\RegistryReader.cs" />
191191
<Compile Include="ResourceController.cs" />
192192
<Compile Include="INavigationToolbar.cs" />
193-
<Compile Include="UserControls\HorizontalMultitaskingControl.xaml.cs">
193+
<Compile Include="UserControls\MultitaskingControl\HorizontalMultitaskingControl.xaml.cs">
194194
<DependentUpon>HorizontalMultitaskingControl.xaml</DependentUpon>
195195
</Compile>
196196
<Compile Include="UserControls\ModernNavigationToolbar.xaml.cs">
@@ -230,7 +230,7 @@
230230
<Compile Include="UserControls\SidebarControl.xaml.cs">
231231
<DependentUpon>SidebarControl.xaml</DependentUpon>
232232
</Compile>
233-
<Compile Include="UserControls\SpecificPageOnStartup.xaml.cs">
233+
<Compile Include="UserControls\SettingsControls\SpecificPageOnStartup.xaml.cs">
234234
<DependentUpon>SpecificPageOnStartup.xaml</DependentUpon>
235235
</Compile>
236236
<Compile Include="UserControls\StatusBarControl.xaml.cs">
@@ -239,8 +239,8 @@
239239
<Compile Include="UserControls\StatusCenter.xaml.cs">
240240
<DependentUpon>StatusCenter.xaml</DependentUpon>
241241
</Compile>
242-
<Compile Include="UserControls\TabItem.cs" />
243-
<Compile Include="UserControls\VerticalTabView.xaml.cs">
242+
<Compile Include="UserControls\MultitaskingControl\TabItem.cs" />
243+
<Compile Include="UserControls\MultitaskingControl\VerticalTabView.xaml.cs">
244244
<DependentUpon>VerticalTabView.xaml</DependentUpon>
245245
</Compile>
246246
<Compile Include="UserControls\Widgets\LibraryCards.xaml.cs">
@@ -442,7 +442,7 @@
442442
<Generator>MSBuild:Compile</Generator>
443443
<SubType>Designer</SubType>
444444
</Page>
445-
<Page Include="UserControls\HorizontalMultitaskingControl.xaml">
445+
<Page Include="UserControls\MultitaskingControl\HorizontalMultitaskingControl.xaml">
446446
<SubType>Designer</SubType>
447447
<Generator>MSBuild:Compile</Generator>
448448
</Page>
@@ -482,11 +482,11 @@
482482
<SubType>Designer</SubType>
483483
<Generator>MSBuild:Compile</Generator>
484484
</Page>
485-
<Page Include="UserControls\SpecificPageOnStartup.xaml">
485+
<Page Include="UserControls\SettingsControls\SpecificPageOnStartup.xaml">
486486
<SubType>Designer</SubType>
487487
<Generator>MSBuild:Compile</Generator>
488488
</Page>
489-
<Page Include="UserControls\VerticalTabView.xaml">
489+
<Page Include="UserControls\MultitaskingControl\VerticalTabView.xaml">
490490
<SubType>Designer</SubType>
491491
<Generator>MSBuild:Compile</Generator>
492492
</Page>
@@ -591,6 +591,9 @@
591591
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
592592
<Version>6.2.10</Version>
593593
</PackageReference>
594+
<PackageReference Include="Microsoft.Toolkit.Mvvm">
595+
<Version>7.0.0-preview2</Version>
596+
</PackageReference>
594597
<PackageReference Include="Microsoft.Toolkit.Uwp">
595598
<Version>6.1.1</Version>
596599
</PackageReference>
@@ -615,9 +618,6 @@
615618
<PackageReference Include="Microsoft.Win32.Registry">
616619
<Version>5.0.0-preview.1.20120.5</Version>
617620
</PackageReference>
618-
<PackageReference Include="MvvmLight">
619-
<Version>5.4.1.1</Version>
620-
</PackageReference>
621621
<PackageReference Include="Newtonsoft.Json">
622622
<Version>12.0.3</Version>
623623
</PackageReference>

Files/Filesystem/CloudDriveSyncStatus.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using GalaSoft.MvvmLight;
1+
using Microsoft.Toolkit.Mvvm.ComponentModel;
22
using Windows.UI.Xaml.Media;
33

44
namespace Files.Filesystem
@@ -22,11 +22,28 @@ public enum CloudDriveSyncStatus
2222
public class CloudDriveSyncStatusUI : ObservableObject
2323
{
2424
private bool _LoadSyncStatus;
25-
public bool LoadSyncStatus { get => _LoadSyncStatus; set => Set(ref _LoadSyncStatus, value); }
25+
26+
public bool LoadSyncStatus
27+
{
28+
get => _LoadSyncStatus;
29+
set => SetProperty(ref _LoadSyncStatus, value);
30+
}
31+
2632
private string _Glyph;
27-
public string Glyph { get => _Glyph; set => Set(ref _Glyph, value); }
33+
34+
public string Glyph
35+
{
36+
get => _Glyph;
37+
set => SetProperty(ref _Glyph, value);
38+
}
39+
2840
private SolidColorBrush _Foreground;
29-
public SolidColorBrush Foreground { get => _Foreground; set => Set(ref _Foreground, value); }
41+
42+
public SolidColorBrush Foreground
43+
{
44+
get => _Foreground;
45+
set => SetProperty(ref _Foreground, value);
46+
}
3047

3148
public static CloudDriveSyncStatusUI FromCloudDriveSyncStatus(CloudDriveSyncStatus syncStatus)
3249
{

Files/Filesystem/Drives.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using Files.View_Models;
22
using Files.Views;
3-
using GalaSoft.MvvmLight;
3+
using Microsoft.Toolkit.Mvvm.ComponentModel;
44
using NLog;
55
using System;
66
using System.Collections.Generic;
77
using System.Diagnostics;
88
using System.IO;
99
using System.Linq;
10-
using System.Linq.Expressions;
1110
using System.Threading.Tasks;
1211
using Windows.ApplicationModel.Core;
1312
using Windows.Devices.Enumeration;
@@ -23,11 +22,13 @@ public class DrivesManager : ObservableObject
2322
public SettingsViewModel AppSettings => App.AppSettings;
2423
public IList<DriveItem> Drives { get; } = new List<DriveItem>();
2524
private bool _ShowUserConsentOnInit = false;
25+
2626
public bool ShowUserConsentOnInit
2727
{
2828
get => _ShowUserConsentOnInit;
29-
set => Set(ref _ShowUserConsentOnInit, value);
29+
set => SetProperty(ref _ShowUserConsentOnInit, value);
3030
}
31+
3132
private DeviceWatcher _deviceWatcher;
3233

3334
public DrivesManager()

Files/Filesystem/ListedItem.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using Files.Enums;
2-
using GalaSoft.MvvmLight;
2+
using Microsoft.Toolkit.Mvvm.ComponentModel;
33
using System;
44
using Windows.Storage;
5-
using Windows.UI.Xaml.Media;
65
using Windows.UI.Xaml.Media.Imaging;
76

87
namespace Files.Filesystem
@@ -36,23 +35,23 @@ public Uri FolderIconSourceLarge
3635
public bool LoadFileIcon
3736
{
3837
get => _LoadFileIcon;
39-
set => Set(ref _LoadFileIcon, value);
38+
set => SetProperty(ref _LoadFileIcon, value);
4039
}
4140

4241
private bool _LoadUnknownTypeGlyph;
4342

4443
public bool LoadUnknownTypeGlyph
4544
{
4645
get => _LoadUnknownTypeGlyph;
47-
set => Set(ref _LoadUnknownTypeGlyph, value);
46+
set => SetProperty(ref _LoadUnknownTypeGlyph, value);
4847
}
4948

5049
private CloudDriveSyncStatusUI _SyncStatusUI;
5150

5251
public CloudDriveSyncStatusUI SyncStatusUI
5352
{
5453
get => _SyncStatusUI;
55-
set => Set(ref _SyncStatusUI, value);
54+
set => SetProperty(ref _SyncStatusUI, value);
5655
}
5756

5857
private BitmapImage _FileImage;
@@ -64,7 +63,7 @@ public BitmapImage FileImage
6463
{
6564
if (value != null)
6665
{
67-
Set(ref _FileImage, value);
66+
SetProperty(ref _FileImage, value);
6867
}
6968
}
7069
}
@@ -74,15 +73,15 @@ public BitmapImage FileImage
7473
public string ItemPath
7574
{
7675
get => _ItemPath;
77-
set => Set(ref _ItemPath, value);
76+
set => SetProperty(ref _ItemPath, value);
7877
}
7978

8079
private string _ItemName;
8180

8281
public string ItemName
8382
{
8483
get => _ItemName;
85-
set => Set(ref _ItemName, value);
84+
set => SetProperty(ref _ItemName, value);
8685
}
8786

8887
private string _ItemType;
@@ -94,7 +93,7 @@ public string ItemType
9493
{
9594
if (value != null)
9695
{
97-
Set(ref _ItemType, value);
96+
SetProperty(ref _ItemType, value);
9897
}
9998
}
10099
}

Files/Filesystem/StorageFileHelpers/StorageFileExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Files.Common;
2-
using Files.Filesystem;
32
using Files.Helpers;
43
using Files.View_Models;
54
using Files.Views;

0 commit comments

Comments
 (0)