diff --git a/JianGongYun.sln b/JianGongYun.sln new file mode 100644 index 0000000..deb16c2 --- /dev/null +++ b/JianGongYun.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30717.126 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JianGongYun", "JianGongYun\JianGongYun.csproj", "{0B346099-B101-4426-800A-6FB1D4308F34}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0B346099-B101-4426-800A-6FB1D4308F34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B346099-B101-4426-800A-6FB1D4308F34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B346099-B101-4426-800A-6FB1D4308F34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B346099-B101-4426-800A-6FB1D4308F34}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0CE4D420-B3AF-4E56-87A7-31A8C32D4648} + EndGlobalSection +EndGlobal diff --git a/JianGongYun/App.xaml b/JianGongYun/App.xaml new file mode 100644 index 0000000..1a00d43 --- /dev/null +++ b/JianGongYun/App.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/JianGongYun/App.xaml.cs b/JianGongYun/App.xaml.cs new file mode 100644 index 0000000..c44ffeb --- /dev/null +++ b/JianGongYun/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace JianGongYun +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/JianGongYun/AssemblyInfo.cs b/JianGongYun/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/JianGongYun/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/JianGongYun/JianGongYun.csproj b/JianGongYun/JianGongYun.csproj new file mode 100644 index 0000000..4de20af --- /dev/null +++ b/JianGongYun/JianGongYun.csproj @@ -0,0 +1,38 @@ + + + + netcoreapp3.1;net45;net46 + true + true + true + $(NoWarn);0067 + logo.ico + WinExe + + AnyCPU;x64 + + + + + + + + + + + + Code + + + + + Always + + + + + $(DefaultXamlRuntime) + Designer + + + diff --git a/JianGongYun/MainWindow.xaml b/JianGongYun/MainWindow.xaml new file mode 100644 index 0000000..3816e38 --- /dev/null +++ b/JianGongYun/MainWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JianGongYun/MainWindow.xaml.cs b/JianGongYun/MainWindow.xaml.cs new file mode 100644 index 0000000..19e8d3b --- /dev/null +++ b/JianGongYun/MainWindow.xaml.cs @@ -0,0 +1,37 @@ +using AduSkin.Controls.Metro; +using AduSkin.Themes; +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 JianGongYun +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : MetroWindow + { + public MainWindow() + { + InitializeComponent(); + this.Closed += delegate { Application.Current.Shutdown(); }; + Theme.ColorChange += delegate + { + // 不要通过XAML来绑定颜色,无法获取到通知 + BorderBrush = Theme.CurrentColor.OpaqueSolidColorBrush; + }; + BorderBrush = new SolidColorBrush(color:Color.FromRgb(42,43, 48)); + } + } +} diff --git a/JianGongYun/Models/ControlModel.cs b/JianGongYun/Models/ControlModel.cs new file mode 100644 index 0000000..52517e9 --- /dev/null +++ b/JianGongYun/Models/ControlModel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JianGongYun.Models +{ + public class ControlModel + { + public ControlModel(string title, Type content, string xaml = "", string code = "", string tags = "") + { + Title = title; + Content = content; + Tags = tags; + XAML = xaml; + Code = code; + } + + public ControlModel() + { + Tags = string.Empty; + } + + public int Id { get; private set; } + + public string Title { get; set; } + + + public Type Content { get; set; } + + public string XAML { get; set; } + + public string Code { get; set; } + + public string Tags { get; set; } + + } +} diff --git a/JianGongYun/Style/ShowControl.xaml b/JianGongYun/Style/ShowControl.xaml new file mode 100644 index 0000000..bef5f8c --- /dev/null +++ b/JianGongYun/Style/ShowControl.xaml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/JianGongYun/ViewModel/MainViewModel.cs b/JianGongYun/ViewModel/MainViewModel.cs new file mode 100644 index 0000000..23d3b23 --- /dev/null +++ b/JianGongYun/ViewModel/MainViewModel.cs @@ -0,0 +1,28 @@ +using GalaSoft.MvvmLight; +using JianGongYun.Views; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Controls; + +namespace JianGongYun.ViewModel +{ + public class MainViewModel : ViewModelBase + { + public MainViewModel() + { + + } + + /// + /// 实用案例 + /// + private UserControl _MainInfo = new MainInfo(); + public UserControl MainInfo + { + get { return _MainInfo; } + set { Set(ref _MainInfo, value); } + } + + } +} diff --git a/JianGongYun/ViewModel/ModuleViewModel/PracticalCaseViewModel.cs b/JianGongYun/ViewModel/ModuleViewModel/PracticalCaseViewModel.cs new file mode 100644 index 0000000..51197cc --- /dev/null +++ b/JianGongYun/ViewModel/ModuleViewModel/PracticalCaseViewModel.cs @@ -0,0 +1,91 @@ +using GalaSoft.MvvmLight; +using JianGongYun.Models; +using JianGongYun.Views; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Windows.Controls; +using System.Windows.Data; + +namespace JianGongYun.ViewModel.ModuleViewModel +{ + public class PracticalCaseViewModel : ViewModelBase + { + public PracticalCaseViewModel() + { + + #region 控件 + _ControlList = new List() + { + new ControlModel("Win10菜单", typeof(Window1)), + new ControlModel("Win10菜单cccc", typeof(Window2)), + new ControlModel("教学计划", typeof(TeachingPlan)) + }; + _AllControl.Source = _ControlList; + _AllControl.View.Culture = new System.Globalization.CultureInfo("zh-CN"); + #endregion + } + + #region 控件 + private IEnumerable _ControlList; + /// + /// 所有控件 + /// + public IEnumerable AllControl + { + get { return _ControlList; } + set { Set(ref _ControlList, value); } + } + + private CollectionViewSource _AllControl; + /// + /// 所有控件 + /// + public CollectionViewSource AllControlViewSource + { + get { return _AllControl; } + set + { + Set(ref _AllControl, value); + } + } + #endregion + + private ControlModel _CurrentShowControl = null; + /// + /// 当前显示控件 + /// + public ControlModel CurrentShowControl + { + get + { + return _CurrentShowControl; + } + set + { + Set(ref _CurrentShowControl, value); + RaisePropertyChanged("Content"); + } + } + /// + /// 控件显示 + /// + private UserControl _content; + public UserControl Content + { + get + { + if (CurrentShowControl == null) + return null; + return (UserControl)Activator.CreateInstance(CurrentShowControl.Content); + + } + set + { + Set(ref _content, value); + } + } + } +} diff --git a/JianGongYun/ViewModel/ViewModelLocator.cs b/JianGongYun/ViewModel/ViewModelLocator.cs new file mode 100644 index 0000000..1563bcf --- /dev/null +++ b/JianGongYun/ViewModel/ViewModelLocator.cs @@ -0,0 +1,50 @@ +using CommonServiceLocator; +using GalaSoft.MvvmLight.Ioc; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JianGongYun.ViewModel +{ + /// + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// + public class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + public ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + ////if (ViewModelBase.IsInDesignModeStatic) + ////{ + //// // Create design time view services and models + //// SimpleIoc.Default.Register(); + ////} + ////else + ////{ + //// // Create run time view services and models + //// SimpleIoc.Default.Register(); + ////} + + SimpleIoc.Default.Register(); + } + + public MainViewModel Main + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } + + + public static void Cleanup() + { + // TODO Clear the ViewModels + } + } +} diff --git a/JianGongYun/Views/Login.xaml b/JianGongYun/Views/Login.xaml new file mode 100644 index 0000000..0550434 --- /dev/null +++ b/JianGongYun/Views/Login.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/JianGongYun/Views/Login.xaml.cs b/JianGongYun/Views/Login.xaml.cs new file mode 100644 index 0000000..5a20cfe --- /dev/null +++ b/JianGongYun/Views/Login.xaml.cs @@ -0,0 +1,30 @@ +using AduSkin.Controls.Metro; +using System; +using System.Collections.Generic; +using System.Text; +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.Shapes; + +namespace JianGongYun.Views +{ + /// + /// Login.xaml 的交互逻辑 + /// + public partial class Login : MetroWindow + { + public Login() + { + InitializeComponent(); + BorderBrush = new SolidColorBrush(color: Color.FromRgb(42, 43, 48)); + MainWindow main = new MainWindow(); + main.Show(); + this.Hide(); + } + } +} diff --git a/JianGongYun/Views/MainInfo.xaml b/JianGongYun/Views/MainInfo.xaml new file mode 100644 index 0000000..9d0ead6 --- /dev/null +++ b/JianGongYun/Views/MainInfo.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JianGongYun/Views/MainInfo.xaml.cs b/JianGongYun/Views/MainInfo.xaml.cs new file mode 100644 index 0000000..1895b87 --- /dev/null +++ b/JianGongYun/Views/MainInfo.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +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.Shapes; + +namespace JianGongYun.Views +{ + /// + /// MainInfo.xaml 的交互逻辑 + /// + public partial class MainInfo : UserControl + { + public MainInfo() + { + InitializeComponent(); + } + } +} diff --git a/JianGongYun/Views/TeachingPlan.xaml b/JianGongYun/Views/TeachingPlan.xaml new file mode 100644 index 0000000..f5340cd --- /dev/null +++ b/JianGongYun/Views/TeachingPlan.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/JianGongYun/Views/TeachingPlan.xaml.cs b/JianGongYun/Views/TeachingPlan.xaml.cs new file mode 100644 index 0000000..f9746a3 --- /dev/null +++ b/JianGongYun/Views/TeachingPlan.xaml.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; +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 JianGongYun.Views +{ + /// + /// TeachingPlan.xaml 的交互逻辑 + /// + public partial class TeachingPlan : UserControl + { + public TeachingPlan() + { + InitializeComponent(); + } + } +} diff --git a/JianGongYun/Views/Window1.xaml b/JianGongYun/Views/Window1.xaml new file mode 100644 index 0000000..e0767a6 --- /dev/null +++ b/JianGongYun/Views/Window1.xaml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/JianGongYun/Views/Window1.xaml.cs b/JianGongYun/Views/Window1.xaml.cs new file mode 100644 index 0000000..d4658ee --- /dev/null +++ b/JianGongYun/Views/Window1.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +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.Shapes; + +namespace JianGongYun.Views +{ + /// + /// Window1.xaml 的交互逻辑 + /// + public partial class Window1 : UserControl + { + public Window1() + { + InitializeComponent(); + } + } +} diff --git a/JianGongYun/Views/Window2.xaml b/JianGongYun/Views/Window2.xaml new file mode 100644 index 0000000..4544cc5 --- /dev/null +++ b/JianGongYun/Views/Window2.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/JianGongYun/Views/Window2.xaml.cs b/JianGongYun/Views/Window2.xaml.cs new file mode 100644 index 0000000..f3662c9 --- /dev/null +++ b/JianGongYun/Views/Window2.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +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.Shapes; + +namespace JianGongYun.Views +{ + /// + /// Window1.xaml 的交互逻辑 + /// + public partial class Window2 : UserControl + { + public Window2() + { + InitializeComponent(); + } + } +} diff --git a/JianGongYun/logo.ico b/JianGongYun/logo.ico new file mode 100644 index 0000000..92a4536 Binary files /dev/null and b/JianGongYun/logo.ico differ