トップ «前の日記(2014-03-23) 最新 次の日記(2014-03-25)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|

2014-03-24 :-(

_ 午前

0530 起床

0710 食堂

0830 出勤 || テストしTARI

_ 午後

1300 コード発掘しTARI

_

1700 残業アワー

1800 退勤

1900 はうはう

2100 飯。白菜と豚バラ肉の煮物 鶏肉ですが

_ [C#][async][await]C# async await

勉強せねば

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private async void button1_Click(object sender, EventArgs e)
        {
            await LongProcess();
            resultsTextBox.AppendText("button1_Click finish\n");
        }

        public async Task LongProcess()
        {
            Task.Run(() =>
            {
                System.Threading.Thread.Sleep(5000);
                Console.WriteLine("LongProcess finish\n");
            });
        }

        private void resultsTextBox_TextChanged(object sender, EventArgs e)
        {

        }
    }

UI スレッドとスレッドプールの分離。IProgress を渡す

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private async void button1_Click(object sender, EventArgs e)
        {
            var progress = new Progress<String>(Report);
            await LongProcess(progress);
            resultsTextBox.AppendText("button1_Click finish\n");
        }
        public async Task LongProcess(IProgress<String> progress)
        {
            Task.Run(() =>
            {
                System.Threading.Thread.Sleep(5000);
                progress.Report("LongProcess finish");
            });
        }
        private void Report(String message)
        {
            resultsTextBox.AppendText(String.Format("{0}\n", message));
        }

    }

ref.

_ Async in C# 5.0

これ翻訳されてないですかね (´・ω・`)

Async in C# 5.0 - O'Reilly Media

1449337163