PK qЏL 14-TasksAndWinForms/PK [yDУy@ЮЛ Л 14-TasksAndWinForms/App.configяЛП
PK LАJVёЊм м 14-TasksAndWinForms/Form1.csяЛПusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
namespace TasksAndWinForms {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
Debug.Print("--------");
Debug.Print("button1_Click: TID == {0}: begin", Thread.CurrentThread.ManagedThreadId);
var t1 = Task.Run(() => {
Debug.Print("Task t1: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
var t2 = Task.Run(() => {
Debug.Print("Task t2: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print("Task t2: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
Thread.Sleep(500);
Debug.Print("Task t1: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
Thread.Sleep(100);
Debug.Print("button1_Click: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}
private void button2_Click(object sender, EventArgs e) {
Debug.Print("--------");
Debug.Print("button2_Click: TID == {0}: begin", Thread.CurrentThread.ManagedThreadId);
var sched = TaskScheduler.FromCurrentSynchronizationContext();
var t1 = Task.Run(() => {
Debug.Print("Task t1: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
var t2 = Task.Factory.StartNew(() => {
Debug.Print(" Task t2: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
var t3 = Task.Factory.StartNew(() => {
Debug.Print(" + Task t3: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print(" + Task t3: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
var t4 = Task.Run(() => {
Debug.Print(" - Task t4: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print(" - Task t4: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
var t5 = Task.Factory.StartNew(() => {
Debug.Print(" * Task t5: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print(" * Task t5: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}, TaskCreationOptions.HideScheduler); // Will behave in the same way as t3 - as HideScheduler hides scheduler from children
Thread.Sleep(1000);
Debug.Print("Task t2: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}, CancellationToken.None, TaskCreationOptions.None, sched);
// t2.Wait();
Thread.Sleep(1000);
Debug.Print("Task t1: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
Thread.Sleep(100);
Debug.Print("button2_Click: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}
private void button3_Click(object sender, EventArgs e) {
Debug.Print("--------");
Debug.Print("button3_Click: TID == {0}: begin", Thread.CurrentThread.ManagedThreadId);
var sched = TaskScheduler.FromCurrentSynchronizationContext();
var t1 = Task.Run(() => {
Debug.Print("Task t1: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
var t2 = Task.Factory.StartNew(() => {
Debug.Print(" Task t2: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
var t3 = Task.Factory.StartNew(() => {
Debug.Print(" + Task t3: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print(" + Task t3: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
var t4 = Task.Run(() => {
Debug.Print(" - Task t4: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print(" - Task t4: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
var t5 = Task.Factory.StartNew(() => {
Debug.Print(" * Task t5: TID == {0}: start", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(500);
Debug.Print(" * Task t5: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}, TaskCreationOptions.HideScheduler); // Will behave in the same way as t3 - as HideScheduler hides scheduler from children
Thread.Sleep(1000);
Debug.Print("Task t2: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}, CancellationToken.None, TaskCreationOptions.HideScheduler, sched); // Now t3, nor t5 will not see our custom scheduler.
// i.e. TaskScheduler.Current will return TaskScheduler.Default even if the current Task is running inside non-default scheduler.
// t2.Wait();
Thread.Sleep(1000);
Debug.Print("Task t1: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
});
Thread.Sleep(100);
Debug.Print("button3_Click: TID == {0}: end", Thread.CurrentThread.ManagedThreadId);
}
}
}
PK rLАJВCЯы
% 14-TasksAndWinForms/Form1.Designer.csяЛПnamespace TasksAndWinForms {
partial class Form1 {
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(441, 18);
this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(112, 35);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(468, 58);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 20);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// button2
//
this.button2.Location = new System.Drawing.Point(441, 157);
this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 35);
this.button2.TabIndex = 2;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(441, 304);
this.button3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(112, 35);
this.button3.TabIndex = 3;
this.button3.Text = "button3";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(962, 712);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
}
}
PK rLАJО|EIЙ Й 14-TasksAndWinForms/Form1.resxяЛП
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PK [yDЏњsЧ Ч 14-TasksAndWinForms/Program.csяЛПusing System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TasksAndWinForms {
static class Program {
///
/// The main entry point for the application.
///
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
PK qЏL 14-TasksAndWinForms/Properties/PK [yD8HЄ Є . 14-TasksAndWinForms/Properties/AssemblyInfo.csяЛПusing System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TasksAndWinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TasksAndWinForms")]
[assembly: AssemblyCopyright("Copyright ТЉ 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fc2d01db-1ac6-4241-88e3-f240910fcd9d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
PK [yD9)8Е Е 4 14-TasksAndWinForms/Properties/Resources.Designer.csяЛП//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace TasksAndWinForms.Properties {
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if ((resourceMan == null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TasksAndWinForms.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
PK [yDZtvь ь - 14-TasksAndWinForms/Properties/Resources.resxяЛП
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PK [yDШэТј ј 3 14-TasksAndWinForms/Properties/Settings.Designer.csяЛП//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace TasksAndWinForms.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
PK [yD`иљ љ 0 14-TasksAndWinForms/Properties/Settings.settingsяЛП
PK Ѕ[yDлX#у у + 14-TasksAndWinForms/TasksAndWinForms.csprojяЛП
Debug
AnyCPU
{93D41717-2101-4A9C-A503-8DA8F1169631}
WinExe
Properties
TasksAndWinForms
TasksAndWinForms
v4.5
512
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
Form
Form1.cs
Form1.cs
ResXFileCodeGenerator
Resources.Designer.cs
Designer
True
Resources.resx
SettingsSingleFileGenerator
Settings.Designer.cs
True
Settings.settings
True
PK [yDZ
>~ ( 14-TasksAndWinForms/TasksAndWinForms.slnяЛП
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TasksAndWinForms", "TasksAndWinForms.csproj", "{93D41717-2101-4A9C-A503-8DA8F1169631}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93D41717-2101-4A9C-A503-8DA8F1169631}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93D41717-2101-4A9C-A503-8DA8F1169631}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93D41717-2101-4A9C-A503-8DA8F1169631}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93D41717-2101-4A9C-A503-8DA8F1169631}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
PK ih~F?ё=Љ , 14-TasksAndWinForms/TasksAndWinForms.v11.suoаЯрЁБс > ўџ ўџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџR o o t E n t r y џџџџџџџџ оз йjа P r o j I n f o E x џџџџ џџџџ e T a s k L i s t U s e r T a s k s $ ! џџџџ d W i n d o w M a n a g e r . P i n n e d F r a m e s 6 џџџџ џџџџ c §џџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџ џџџџ џџџџџџџџџџџџџџџџ
ўџџџ> џџџџџџџџ7 џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ8 9 : ; <