Skip to content

Instantly share code, notes, and snippets.

@yukkuribemani
Created November 1, 2014 15:31
Show Gist options
  • Save yukkuribemani/8d52fc881742993ecaf1 to your computer and use it in GitHub Desktop.
Save yukkuribemani/8d52fc881742993ecaf1 to your computer and use it in GitHub Desktop.
C#+WPFで作る日めくり式カレンダー(仮) ref: http://qiita.com/yukkuribemani/items/6f9fe61f7f10a20c0aa3
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 WpfCallender
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DateTime date = DateTime.Today;
HolidayJudge(date);
Today.Text = date.ToString("yyyy/MM/dd");
BeforeDay.Click += (s, e) =>
{
date = date.AddDays(-1);
Today.Text = date.ToString("yyyy/MM/dd");
HolidayJudge(date);
};
NextDay.Click += (s, e) =>
{
date = date.AddDays(1);
Today.Text = date.ToString("yyyy/MM/dd");
HolidayJudge(date);
};
}
public void HolidayJudge(DateTime today)
{
if (today.DayOfWeek == DayOfWeek.Saturday || today.DayOfWeek == DayOfWeek.Sunday)
{
MessageBox.Show("今日は休みです!! やったね!!!");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment