Skip to content

Commit

Permalink
1.0 beta 1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaotianff committed Jan 1, 2020
1 parent 5e8727d commit c84926f
Show file tree
Hide file tree
Showing 28 changed files with 1,636 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Todo/Todo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.960
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo", "Todo\Todo.csproj", "{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Debug|x64.ActiveCfg = Debug|x64
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Debug|x64.Build.0 = Debug|x64
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Release|Any CPU.Build.0 = Release|Any CPU
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Release|x64.ActiveCfg = Release|x64
{3EFF13F0-1CEE-48A8-A84A-E46A4BECEB03}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {29E0173A-74F7-4AF9-8547-58380E5AE3C6}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions Todo/Todo/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
19 changes: 19 additions & 0 deletions Todo/Todo/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Application x:Class="Todo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Todo"
StartupUri="MainWindow.xaml" DispatcherUnhandledException="Application_DispatcherUnhandledException">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/Colors.xaml"/>
<ResourceDictionary Source="Styles/WindowStyle.xaml"/>
<ResourceDictionary Source="Styles/ListBoxStyle.xaml"/>
<ResourceDictionary Source="Styles/ImageStyle.xaml"/>
<ResourceDictionary Source="Styles/CheckBoxStyle.xaml"/>
<ResourceDictionary Source="Styles/TextBoxStyle.xaml"/>
<ResourceDictionary Source="Styles/ComboBoxStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
21 changes: 21 additions & 0 deletions Todo/Todo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Todo
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show("发生了异常," + e.Exception.Message);
}
}
}
64 changes: 64 additions & 0 deletions Todo/Todo/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<Window x:Class="Todo.MainWindow"
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:Todo"
mc:Ignorable="d"
Title="MainWindow" Height="550" Width="300" Style="{StaticResource newStyle}" Topmost="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="26.4"/>
<RowDefinition/>
<RowDefinition Height="100"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>

<StackPanel Grid.Row="1">
<local:TodoItemControl TodoContent="2、加入 单序列判断标志,单序列仍然 显示 在序列下拉列表 中,但是不处理切换 事件。" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden" MouseDoubleClick="TodoItemControl_MouseDoubleClick" LostFocus="TodoItemControl_LostFocus"/>
<local:TodoItemControl TodoContent="HelloWorld" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden" MouseDoubleClick="TodoItemControl_MouseDoubleClick"/>
<local:TodoItemControl TodoContent="HelloWorld" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden" MouseDoubleClick="TodoItemControl_MouseDoubleClick"/>
<local:TodoItemControl TodoContent="HelloWorld" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden" MouseDoubleClick="TodoItemControl_MouseDoubleClick"/>
</StackPanel>

<!--<ListBox Grid.Row="1" Style="{StaticResource StyleListBox}" ItemContainerStyle="{StaticResource StyleListBoxItem}" Name="listbox_todo">
<ListBox.ItemTemplate>
<ItemContainerTemplate>
<Grid Height="50">
<CheckBox IsChecked="{Binding TodoFininishFlag}" VerticalAlignment="Center" Style="{StaticResource CheckBoxStyle}" Margin="3,10,0,0" HorizontalAlignment="Left"/>
--><!--<Label Content="TODO" Height="50" VerticalAlignment="Center" VerticalContentAlignment="Center"/>--><!--
<TextBox Text="{Binding TodoContent}" FontWeight="Bold" VerticalAlignment="Center" x:Name="todoTbox" Visibility="{Binding TodoEditFlag}" Style="{StaticResource TextBoxStyle}" HorizontalAlignment="Center" Margin="30,3,50,3"/>
<Label Content="{Binding TodoDate}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,3,3,3"/>
</Grid>
</ItemContainerTemplate>
</ListBox.ItemTemplate>
--><!--<ListBoxItem>
<local:TodoItemControl TodoContent="HelloWorld" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden"/>
</ListBoxItem>
<ListBoxItem>
<local:TodoItemControl TodoContent="HelloWorld" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden"/>
</ListBoxItem>
<ListBoxItem>
<local:TodoItemControl TodoContent="HelloWorld" TodoFininishFlag="False" TodoDate="上午" TodoEditFlag="Hidden"/>
</ListBoxItem>--><!--
</ListBox>-->

<Border Grid.Row="2" BorderBrush="{StaticResource AccentBaseColor}" BorderThickness="0,1,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>

<Label Content="备注" HorizontalAlignment="Left" VerticalAlignment="Top"/>

<RichTextBox Grid.Row="1" BorderBrush="Transparent" BorderThickness="0" />
</Grid>
</Border>

<WrapPanel Grid.Row="3">
<Image Width="25" Height="25" Source="add.png" Style="{StaticResource ImageStyle}" Name="add" MouseDown="Add_MouseDown"/>
<Image Width="25" Height="25" Source="setting.png" Style="{StaticResource ImageStyle}"/>
</WrapPanel>
</Grid>
</Window>
112 changes: 112 additions & 0 deletions Todo/Todo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
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 Todo.Model;
using Todo.Utilities;
using System.Collections.ObjectModel;

namespace Todo
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public ObservableCollection<TodoItem> TodoList { get; set; } = new ObservableCollection<TodoItem>();

public MainWindow()
{
InitializeComponent();
InitializeCommands();

//listbox_todo.ItemsSource = TodoList;
}


private void InitializeCommands()
{
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, CloseWindow));
CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, MaximizeWindow, CanResizeWindow));
CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, MinimizeWindow, CanMinimizeWindow));
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, RestoreWindow, CanResizeWindow));
CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, ShowSystemMenu));
}

private void CanResizeWindow(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = ResizeMode == ResizeMode.CanResize || ResizeMode == ResizeMode.CanResizeWithGrip;
}

private void CanMinimizeWindow(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = ResizeMode != ResizeMode.NoResize;
}

private void CloseWindow(object sender, ExecutedRoutedEventArgs e)
{
this.Close();
//SystemCommands.CloseWindow(this);
}

private void MaximizeWindow(object sender, ExecutedRoutedEventArgs e)
{
SystemCommands.MaximizeWindow(this);
}

private void MinimizeWindow(object sender, ExecutedRoutedEventArgs e)
{
SystemCommands.MinimizeWindow(this);
}

private void RestoreWindow(object sender, ExecutedRoutedEventArgs e)
{
SystemCommands.RestoreWindow(this);
}


private void ShowSystemMenu(object sender, ExecutedRoutedEventArgs e)
{
var element = e.OriginalSource as FrameworkElement;
if (element == null)
return;

var point = WindowState == WindowState.Maximized ? new Point(0, element.ActualHeight)
: new Point(Left + BorderThickness.Left, element.ActualHeight + Top + BorderThickness.Top);
point = element.TransformToAncestor(this).Transform(point);
SystemCommands.ShowSystemMenu(this, point);
}


private void Add_MouseDown(object sender, MouseButtonEventArgs e)
{
TodoList.Add(new TodoItem() { TodoContent = "Helloworld",TodoDate = "2019",TodoEditFlag = Visibility.Visible,TodoFininishFlag = false});
}

private void TodoItemControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var item = sender as TodoItemControl;

item.TodoEditFlag = Visibility.Visible;
item.TodoDisplayFlag = Visibility.Hidden;
}

private void TodoItemControl_LostFocus(object sender, RoutedEventArgs e)
{
var item = sender as TodoItemControl;

item.TodoEditFlag = Visibility.Hidden;
item.TodoDisplayFlag = Visibility.Visible;
}
}
}
30 changes: 30 additions & 0 deletions Todo/Todo/Model/TodoItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Todo.Model
{
public class TodoItem : INotifyPropertyChanged
{
private string todoContent;
private bool todoFininishFlag;
private string todoDate;
private Visibility todoEditFlag;

public string TodoContent { get => todoContent; set { todoContent = value;RaiseChangee("TodoContent"); } }
public bool TodoFininishFlag { get => todoFininishFlag; set { todoFininishFlag = value; RaiseChangee("TodoFininishFlag"); } }
public string TodoDate { get => todoDate; set { todoDate = value; RaiseChangee("TodoDate"); } }
public Visibility TodoEditFlag { get => todoEditFlag; set { todoEditFlag = value; RaiseChangee("TodoEditFlag"); } }

public void RaiseChangee(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public event PropertyChangedEventHandler PropertyChanged;
}
}
55 changes: 55 additions & 0 deletions Todo/Todo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Todo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Todo")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]


// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit c84926f

Please sign in to comment.