添加项目文件。

This commit is contained in:
wangbin 2020-12-15 21:19:38 +08:00
parent b481655fff
commit 648372b043
23 changed files with 660 additions and 0 deletions

25
JianGongYun.sln Normal file
View File

@ -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

18
JianGongYun/App.xaml Normal file
View File

@ -0,0 +1,18 @@
<Application x:Class="JianGongYun.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d1p1:Ignorable="d"
xmlns:local="clr-namespace:JianGongYun"
xmlns:vm="clr-namespace:JianGongYun.ViewModel"
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
StartupUri="/Views/Login.xaml">
<Application.Resources>
<ResourceDictionary>
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/JianGongYun;component/Style/ShowControl.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

17
JianGongYun/App.xaml.cs Normal file
View File

@ -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
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -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)
)]

View File

@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net45;net46</TargetFrameworks>
<GenerateDocumentFile>true</GenerateDocumentFile>
<UseWpf>true</UseWpf>
<UseWindowsForms>true</UseWindowsForms>
<NoWarn>$(NoWarn);0067</NoWarn>
<ApplicationIcon>logo.ico</ApplicationIcon>
<OutputType>WinExe</OutputType>
<StartupObject />
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AduSkin" Version="1.1.1.8" />
<PackageReference Include="CommonServiceLocator" Version="2.0.5" />
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\Window2.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="logo.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Window2.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

View File

@ -0,0 +1,38 @@
<Metro:MetroWindow
x:Class="JianGongYun.MainWindow"
xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun"
mc:Ignorable="d"
Title="建工云课堂" MinWidth="600" MinHeight="350"
d:DesignHeight="1200" d:DesignWidth="1600"
BorderThickness="0" WindowStyle="None"
Background="#FFF"
DataContext="{Binding Source={StaticResource Locator},Path=Main}">
<Metro:MetroWindow.Menu>
<Metro:MetroTitleMenu Height="40">
<Metro:MetroTitleMenuItem Header="联系我们">
<Metro:MetroMenuItem Header="QQ" />
</Metro:MetroTitleMenuItem>
<Metro:MetroTitleMenuItem Header="关于">
<MenuItem Style="{StaticResource MenuItem_NonStyle}" Height="30">
<MenuItem.Header>
<Grid>
<TextBlock Text="主题色" Margin="33,0" VerticalAlignment="Center"/>
<Metro:MetroColorPicker x:Name="Theme" Width="20" Height="20" Background="{StaticResource DefaultBrush}" DefaultColor="{StaticResource DefaultBrush}" />
</Grid>
</MenuItem.Header>
</MenuItem>
</Metro:MetroTitleMenuItem>
</Metro:MetroTitleMenu>
</Metro:MetroWindow.Menu>
<Grid>
<ContentControl Content="{Binding MainInfo}"/>
</Grid>
</Metro:MetroWindow>

View File

@ -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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
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));
}
}
}

View File

@ -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; }
}
}

View File

@ -0,0 +1,18 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin">
<!--空MenuHeader-->
<Style x:Key="MenuItem_NonStyle" TargetType="{x:Type MenuItem}">
<Setter Property="Height" Value="Auto" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Grid Margin="1">
<ContentPresenter x:Name="Presenter" ContentSource="Header" Margin="{TemplateBinding Padding}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@ -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()
{
}
/// <summary>
/// 实用案例
/// </summary>
private UserControl _MainInfo = new MainInfo();
public UserControl MainInfo
{
get { return _MainInfo; }
set { Set(ref _MainInfo, value); }
}
}
}

View File

@ -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<ControlModel>()
{
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<ControlModel> _ControlList;
/// <summary>
/// 所有控件
/// </summary>
public IEnumerable<ControlModel> AllControl
{
get { return _ControlList; }
set { Set(ref _ControlList, value); }
}
private CollectionViewSource _AllControl;
/// <summary>
/// 所有控件
/// </summary>
public CollectionViewSource AllControlViewSource
{
get { return _AllControl; }
set
{
Set(ref _AllControl, value);
}
}
#endregion
private ControlModel _CurrentShowControl = null;
/// <summary>
/// 当前显示控件
/// </summary>
public ControlModel CurrentShowControl
{
get
{
return _CurrentShowControl;
}
set
{
Set(ref _CurrentShowControl, value);
RaisePropertyChanged("Content");
}
}
/// <summary>
/// 控件显示
/// </summary>
private UserControl _content;
public UserControl Content
{
get
{
if (CurrentShowControl == null)
return null;
return (UserControl)Activator.CreateInstance(CurrentShowControl.Content);
}
set
{
Set(ref _content, value);
}
}
}
}

View File

@ -0,0 +1,50 @@
using CommonServiceLocator;
using GalaSoft.MvvmLight.Ioc;
using System;
using System.Collections.Generic;
using System.Text;
namespace JianGongYun.ViewModel
{
/// <summary>
/// This class contains static references to all the view models in the
/// application and provides an entry point for the bindings.
/// </summary>
public class ViewModelLocator
{
/// <summary>
/// Initializes a new instance of the ViewModelLocator class.
/// </summary>
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
////if (ViewModelBase.IsInDesignModeStatic)
////{
//// // Create design time view services and models
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
////}
////else
////{
//// // Create run time view services and models
//// SimpleIoc.Default.Register<IDataService, DataService>();
////}
SimpleIoc.Default.Register<MainViewModel>();
}
public MainViewModel Main
{
get
{
return ServiceLocator.Current.GetInstance<MainViewModel>();
}
}
public static void Cleanup()
{
// TODO Clear the ViewModels
}
}
}

View File

@ -0,0 +1,13 @@
<Metro:MetroWindow xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin"
x:Class="JianGongYun.Views.Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
Title="Login" Height="450" Width="800">
<Grid>
</Grid>
</Metro:MetroWindow>

View File

@ -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
{
/// <summary>
/// Login.xaml 的交互逻辑
/// </summary>
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();
}
}
}

View File

@ -0,0 +1,71 @@
<UserControl x:Class="JianGongYun.Views.MainInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:JianGongYun.ViewModel.ModuleViewModel"
xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="900">
<UserControl.DataContext>
<viewmodel:PracticalCaseViewModel/>
</UserControl.DataContext>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#FFF" BorderThickness="0,0,1,0" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<ListBox ItemsSource="{Binding AllControlViewSource.View}" BorderThickness="0" Background="#2F3035" SelectedItem="{Binding CurrentShowControl}">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Cursor" Value="Hand"/>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Border MinHeight="40" Width="245" Background="#00000000" x:Name="Bd" BorderBrush="#2F3035" BorderThickness="0 1 0 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Title}" Foreground="White" Margin="20,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Grid>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#3E7FFF" />
</DataTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Bd" Property="Background" Value="WhiteSmoke" />
</MultiTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Border>
<Grid Grid.Column="1">
<Border Margin="0" Height="Auto" Width="Auto" CornerRadius="6" >
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ContentPresenter Grid.Row="0" Height="Auto" Content="{Binding Content}"/>
</Grid>
</Border>
</Grid>
</Grid>
</UserControl>

View File

@ -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
{
/// <summary>
/// MainInfo.xaml 的交互逻辑
/// </summary>
public partial class MainInfo : UserControl
{
public MainInfo()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
<UserControl x:Class="JianGongYun.Views.TeachingPlan"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

View File

@ -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
{
/// <summary>
/// TeachingPlan.xaml 的交互逻辑
/// </summary>
public partial class TeachingPlan : UserControl
{
public TeachingPlan()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,14 @@
<UserControl x:Class="JianGongYun.Views.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d">
<Grid Background="Aqua">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="0" Text="5r4354545"></TextBox>
</Grid>
</UserControl>

View File

@ -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
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : UserControl
{
public Window1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
<UserControl x:Class="JianGongYun.Views.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
>
<Grid>
<TextBox Text="fdfdfdfdfdfdf"></TextBox>
</Grid>
</UserControl>

View File

@ -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
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window2 : UserControl
{
public Window2()
{
InitializeComponent();
}
}
}

BIN
JianGongYun/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB