diff --git a/Lecture/P06.GraphicalData/GraphicalData.UnitTest/GraphicalData.UnitTest.csproj b/Lecture/P06.GraphicalData/GraphicalData.UnitTest/GraphicalData.UnitTest.csproj
index fb168802..3f7d7ee6 100644
--- a/Lecture/P06.GraphicalData/GraphicalData.UnitTest/GraphicalData.UnitTest.csproj
+++ b/Lecture/P06.GraphicalData/GraphicalData.UnitTest/GraphicalData.UnitTest.csproj
@@ -6,9 +6,9 @@
{32EE831B-AD46-48AC-B303-23A6D818B8D5}
Library
Properties
- TP.MVVMExample.UnitTest
- TP.MVVMExample.UnitTest
- v4.6.1
+ TP.GraphicalData
+ TP.GraphicalData.UnitTest
+ v4.7.1
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10.0
@@ -16,6 +16,7 @@
$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
False
UnitTest
+
true
diff --git a/Lecture/P06.GraphicalData/GraphicalData.UnitTest/MainViewModelUnitTest.cs b/Lecture/P06.GraphicalData/GraphicalData.UnitTest/MainViewModelUnitTest.cs
index 71283674..42cb8a42 100644
--- a/Lecture/P06.GraphicalData/GraphicalData.UnitTest/MainViewModelUnitTest.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData.UnitTest/MainViewModelUnitTest.cs
@@ -2,10 +2,10 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Windows;
-using TP.MVVMExample.Model;
-using TP.MVVMExample.ViewModel;
+using TP.GraphicalData.Model;
+using TP.GraphicalData.ViewModel;
-namespace TP.MVVMExample.UnitTest
+namespace TP.GraphicalData
{
[TestClass]
public class MainViewModelUnitTest
diff --git a/Lecture/P06.GraphicalData/GraphicalData/App.xaml b/Lecture/P06.GraphicalData/GraphicalData/App.xaml
index aecb185c..35cf37da 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/App.xaml
+++ b/Lecture/P06.GraphicalData/GraphicalData/App.xaml
@@ -1,4 +1,4 @@
-
diff --git a/Lecture/P06.GraphicalData/GraphicalData/App.xaml.cs b/Lecture/P06.GraphicalData/GraphicalData/App.xaml.cs
index 3c02b45d..7fdf377a 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/App.xaml.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/App.xaml.cs
@@ -1,17 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
+//____________________________________________________________________________
+//
+// Copyright (C) 2018, Mariusz Postol LODZ POLAND.
+//
+// To be in touch join the community at GITTER: https://gitter.im/mpostol/TP
+//____________________________________________________________________________
+
using System.Windows;
-namespace TP.MVVMExample
+namespace TP.GraphicalData
{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application { }
+
}
diff --git a/Lecture/P06.GraphicalData/GraphicalData/GraphicalData.csproj b/Lecture/P06.GraphicalData/GraphicalData/GraphicalData.csproj
index ccd5c63f..5cbf18fd 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/GraphicalData.csproj
+++ b/Lecture/P06.GraphicalData/GraphicalData/GraphicalData.csproj
@@ -58,16 +58,15 @@
Designer
-
+
-
-
-
+
MainWindow.xaml
-
+
+
MSBuild:Compile
@@ -81,7 +80,7 @@
MainWindow.xaml
Code
-
+
MSBuild:Compile
Designer
diff --git a/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/RelayCommand.cs b/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/RelayCommand.cs
index 7bf929e8..291a6f53 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/RelayCommand.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/RelayCommand.cs
@@ -1,8 +1,14 @@
-
+//____________________________________________________________________________
+//
+// Copyright (C) 2018, Mariusz Postol LODZ POLAND.
+//
+// To be in touch join the community at GITTER: https://gitter.im/mpostol/TP
+//____________________________________________________________________________
+
using System;
using System.Windows.Input;
-namespace TP.MVVMExample.MVVMLight
+namespace TP.GraphicalData.MVVMLight
{
///
@@ -12,7 +18,7 @@ namespace TP.MVVMExample.MVVMLight
/// Execute and CanExecute callback methods.
///
/// The handles automatic enabling/disabling of controls based on the CanExecute delegate.
- internal class RelayCommand : ICommand
+ public class RelayCommand : ICommand
{
#region constructors
diff --git a/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/ViewModelBase.cs b/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/ViewModelBase.cs
index aa422e42..8ead58ff 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/ViewModelBase.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/MVVMLight/ViewModelBase.cs
@@ -1,11 +1,19 @@
+///____________________________________________________________________________
+//
+// Copyright (C) 2018, Mariusz Postol LODZ POLAND.
+//
+// To be in touch join the community at GITTER: https://gitter.im/mpostol/TP
+//____________________________________________________________________________
+
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace TP.MVVMExample.MVVMLight
{
- internal class ViewModelBase : INotifyPropertyChanged
+ public class ViewModelBase : INotifyPropertyChanged
{
+
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
#endregion
diff --git a/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml b/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml
index c5093337..cdc8fc4b 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml
+++ b/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml
@@ -1,10 +1,9 @@
-
diff --git a/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml.cs b/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml.cs
index b41fe3be..aef369bd 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/MainWindow.xaml.cs
@@ -1,24 +1,11 @@
-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;
+using System.Windows;
-namespace TP.MVVMExample
+namespace TP.GraphicalData
{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
{
public MainWindow()
{
diff --git a/Lecture/P06.GraphicalData/GraphicalData/Model/DataLayerSimulator.cs b/Lecture/P06.GraphicalData/GraphicalData/Model/DataLayerr.cs
similarity index 76%
rename from Lecture/P06.GraphicalData/GraphicalData/Model/DataLayerSimulator.cs
rename to Lecture/P06.GraphicalData/GraphicalData/Model/DataLayerr.cs
index 89ec9a9f..a52f1f16 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/Model/DataLayerSimulator.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/Model/DataLayerr.cs
@@ -1,11 +1,11 @@
using System.Collections.Generic;
-namespace TP.MVVMExample.Model
+namespace TP.GraphicalData.Model
{
- internal class DataLayer
+ public class DataLayer
{
- internal IEnumerable User
+ public IEnumerable User
{
get
{
diff --git a/Lecture/P06.GraphicalData/GraphicalData/Model/User.cs b/Lecture/P06.GraphicalData/GraphicalData/Model/User.cs
index 454c2be2..3ff4e1ee 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/Model/User.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/Model/User.cs
@@ -1,7 +1,7 @@
using System;
-namespace TP.MVVMExample.Model
+namespace TP.GraphicalData.Model
{
///
/// Class User - a class representing user
diff --git a/Lecture/P06.GraphicalData/GraphicalData/Properties/AssemblyInfo.cs b/Lecture/P06.GraphicalData/GraphicalData/Properties/AssemblyInfo.cs
index 86f9e751..5166466c 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/Properties/AssemblyInfo.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/Properties/AssemblyInfo.cs
@@ -1,11 +1,7 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
[assembly: AssemblyTitle("WpfApplication2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,22 +10,7 @@
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
@@ -38,19 +19,7 @@
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: InternalsVisibleToAttribute("TP.MVVMExample.UnitTest")]
+//[assembly: InternalsVisibleToAttribute("TP.MVVMExample.UnitTest")]
diff --git a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/DelegateCommand.cs b/Lecture/P06.GraphicalData/GraphicalData/TreeView/DelegateCommand.cs
similarity index 93%
rename from Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/DelegateCommand.cs
rename to Lecture/P06.GraphicalData/GraphicalData/TreeView/DelegateCommand.cs
index 044c8595..40671ee3 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/DelegateCommand.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/TreeView/DelegateCommand.cs
@@ -2,7 +2,7 @@
using System;
using System.Windows.Input;
-namespace TP.Lecture.TreeViewExample
+namespace TP.GraphicalData
{
///
/// Class DelegateCommand implements
diff --git a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MainWindow.xaml b/Lecture/P06.GraphicalData/GraphicalData/TreeView/MainWindow.xaml
similarity index 90%
rename from Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MainWindow.xaml
rename to Lecture/P06.GraphicalData/GraphicalData/TreeView/MainWindow.xaml
index 5f1f7815..2608a1fd 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MainWindow.xaml
+++ b/Lecture/P06.GraphicalData/GraphicalData/TreeView/MainWindow.xaml
@@ -1,11 +1,10 @@
-
+ Title="Application title" Height="350" Width="525">
diff --git a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MainWindow.xaml.cs b/Lecture/P06.GraphicalData/GraphicalData/TreeView/MainWindow.xaml.cs
similarity index 88%
rename from Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MainWindow.xaml.cs
rename to Lecture/P06.GraphicalData/GraphicalData/TreeView/MainWindow.xaml.cs
index 7480a977..78f08a46 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MainWindow.xaml.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/TreeView/MainWindow.xaml.cs
@@ -1,6 +1,6 @@
using System.Windows;
-namespace TP.Lecture.TreeViewExample
+namespace TP.GraphicalData.TreeView
{
///
/// Interaction logic for MainWindow.xaml
diff --git a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MyViewModel.cs b/Lecture/P06.GraphicalData/GraphicalData/TreeView/MyViewModel.cs
similarity index 57%
rename from Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MyViewModel.cs
rename to Lecture/P06.GraphicalData/GraphicalData/TreeView/MyViewModel.cs
index 779f4567..20020f95 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/MyViewModel.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/TreeView/MyViewModel.cs
@@ -1,10 +1,18 @@
-using Microsoft.Win32;
+//____________________________________________________________________________
+//
+// Copyright (C) 2018, Mariusz Postol LODZ POLAND.
+//
+// To be in touch join the community at GITTER: https://gitter.im/mpostol/TP
+//____________________________________________________________________________
+
+using Microsoft.Win32;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
+using TP.GraphicalData.MVVMLight;
-namespace TP.Lecture.TreeViewExample
+namespace TP.GraphicalData.TreeView
{
///
/// Class MyViewModel - ViewModel implementation
@@ -12,30 +20,20 @@ namespace TP.Lecture.TreeViewExample
///
public class MyViewModel : INotifyPropertyChanged
{
+
#region constructors
public MyViewModel()
{
- HierarchicalAreas = new ObservableCollection();
- Click_Button = new DelegateCommand(LoadDLL);
- Click_Browse = new DelegateCommand(Browse);
+ HierarchicalAreas = new ObservableCollection();
+ Click_Button = new RelayCommand(LoadDLL);
+ Click_Browse = new RelayCommand(Browse);
}
#endregion
#region DataContext
- public ObservableCollection HierarchicalAreas { get; set; }
- public string PathVariable
- {
- get { return pathVariable; }
- set { pathVariable = value; }
- }
- public Visibility ChangeControlVisibility
- {
- get { return _visibility; }
- set
- {
- _visibility = value;
- }
- }
+ public ObservableCollection HierarchicalAreas { get; set; }
+ public string PathVariable { get; set; }
+ public Visibility ChangeControlVisibility { get; set; } = Visibility.Hidden;
public ICommand Click_Browse { get; }
public ICommand Click_Button { get; }
#endregion
@@ -49,16 +47,14 @@ private void RaisePropertyChanged(string propertyName_)
#endregion
#region private
- private string pathVariable;
- private Visibility _visibility = Visibility.Hidden;
private void LoadDLL()
{
- if (pathVariable.Substring(pathVariable.Length - 4) == ".dll")
+ if (PathVariable.Substring(PathVariable.Length - 4) == ".dll")
TreeViewLoaded();
}
private void TreeViewLoaded()
{
- ITreeViewItem rootItem = new ITreeViewItem { Name = pathVariable.Substring(pathVariable.LastIndexOf('\\') + 1) };
+ TreeViewItem rootItem = new TreeViewItem { Name = PathVariable.Substring(PathVariable.LastIndexOf('\\') + 1) };
HierarchicalAreas.Add(rootItem);
}
private void Browse()
@@ -67,13 +63,11 @@ private void Browse()
test.Filter = "Dynamic Library File(*.dll)| *.dll";
test.ShowDialog();
if (test.FileName.Length == 0)
- {
MessageBox.Show("No files selected");
- }
else
{
- pathVariable = test.FileName;
- _visibility = Visibility.Visible;
+ PathVariable = test.FileName;
+ ChangeControlVisibility = Visibility.Visible;
RaisePropertyChanged("ChangeControlVisibility");
RaisePropertyChanged("PathVariable");
}
diff --git a/Lecture/P06.GraphicalData/GraphicalData/TreeView/TreeViewItem.cs b/Lecture/P06.GraphicalData/GraphicalData/TreeView/TreeViewItem.cs
new file mode 100644
index 00000000..75dfc1fb
--- /dev/null
+++ b/Lecture/P06.GraphicalData/GraphicalData/TreeView/TreeViewItem.cs
@@ -0,0 +1,48 @@
+//____________________________________________________________________________
+//
+// Copyright (C) 2018, Mariusz Postol LODZ POLAND.
+//
+// To be in touch join the community at GITTER: https://gitter.im/mpostol/TP
+//____________________________________________________________________________
+
+using System;
+using System.Collections.ObjectModel;
+
+namespace TP.GraphicalData.TreeView
+{
+ public class TreeViewItem
+ {
+ public TreeViewItem()
+ {
+ Children = new ObservableCollection();
+ Children.Add(null);
+ this.m_WasBuilt = false;
+ }
+ public string Name { get; set; }
+ public ObservableCollection Children { get; set; }
+ public bool IsExpanded
+ {
+ get { return m_IsExpanded; }
+ set
+ {
+ m_IsExpanded = value;
+ if (m_WasBuilt)
+ return;
+ Children.Clear();
+ BuildMyself();
+ m_WasBuilt = true;
+ }
+ }
+
+ private bool m_WasBuilt;
+ private bool m_IsExpanded;
+ private void BuildMyself()
+ {
+ Random random = new Random();
+ for (int i = 0; i < random.Next(7); i++)
+ this.Children.Add(new TreeViewItem() { Name = "sample" + i });
+ }
+
+ }
+}
+
diff --git a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/ITreeViewItem.cs b/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/ITreeViewItem.cs
deleted file mode 100644
index a660eae2..00000000
--- a/Lecture/P06.GraphicalData/GraphicalData/TreeViewExample/ITreeViewItem.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-
-using System;
-using System.Collections.ObjectModel;
-
-namespace TP.Lecture.TreeViewExample
-{
- public class ITreeViewItem
- {
- public ITreeViewItem()
- {
- Children = new ObservableCollection();
- Children.Add(null);
- this._wasBuilt = false;
- }
- public string Name { get; set; }
- public ObservableCollection Children { get; set; }
- public bool IsExpanded
- {
- get { return _isExpanded; }
- set
- {
- _isExpanded = value;
- if (_wasBuilt)
- return;
- Children.Clear();
- buildMyself();
- _wasBuilt = true;
- }
- }
-
- private bool _wasBuilt;
- private bool _isExpanded;
- private void buildMyself()
- {
- Random random = new Random();
- for (int i = 0; i < random.Next(7); i++)
- this.Children.Add(new ITreeViewItem() { Name = "sample" + i });
- }
-
- }
-}
-
diff --git a/Lecture/P06.GraphicalData/GraphicalData/ViewModel/MainViewModel.cs b/Lecture/P06.GraphicalData/GraphicalData/ViewModel/MainViewModel.cs
index a426c7f9..c4ba48a0 100644
--- a/Lecture/P06.GraphicalData/GraphicalData/ViewModel/MainViewModel.cs
+++ b/Lecture/P06.GraphicalData/GraphicalData/ViewModel/MainViewModel.cs
@@ -1,16 +1,23 @@
+//____________________________________________________________________________
+//
+// Copyright (C) 2018, Mariusz Postol LODZ POLAND.
+//
+// To be in touch join the community at GITTER: https://gitter.im/mpostol/TP
+//____________________________________________________________________________
using System;
using System.Collections.ObjectModel;
using System.Windows;
-using TP.MVVMExample.Model;
+using TP.GraphicalData.Model;
+using TP.GraphicalData.MVVMLight;
using TP.MVVMExample.MVVMLight;
-namespace TP.MVVMExample.ViewModel
+namespace TP.GraphicalData.ViewModel
{
///
/// This class contains properties that the can data bind to.
///
- internal class MainViewModel : ViewModelBase
+ public class MainViewModel : ViewModelBase
{
#region constructors
@@ -68,7 +75,7 @@ public RelayCommand DisplayTextCommand
public RelayCommand FetchDataCommend
{
get; private set;
- }
+ }
#endregion
#region Unit test instrumentation
@@ -80,8 +87,8 @@ public RelayCommand FetchDataCommend
/// using .
///
/// The message box show delegate.
- internal Func MessageBoxShowDelegate { get; set; } = MessageBox.Show;
- internal DataLayer DataLayer
+ public Func MessageBoxShowDelegate { get; set; } = MessageBox.Show;
+ public DataLayer DataLayer
{
get { return m_DataLayer; }
set