示例#1
0
 public void Startは重複しても問題ない()
 {
     //setUp
     var sut = new MyThread();
     var expected = ThreadBaseKind.Running;
     //exercise
     sut.Start();
     sut.Start(); //重複
     var actual = sut.ThreadBaseKind;
     //verify
     Assert.That(actual, Is.EqualTo(expected));
     //tearDown
     sut.Dispose();
 }
示例#2
0
        public void Startは重複しても問題ない()
        {
            //setUp
            var sut      = new MyThread();
            var expected = ThreadBaseKind.Running;

            //exercise
            sut.Start();
            sut.Start(); //重複
            var actual = sut.ThreadBaseKind;

            //verify
            Assert.That(actual, Is.EqualTo(expected));
            //tearDown
            sut.Dispose();
        }
示例#3
0
        public void StartOperation()
        {
            if (Operation == null && State == CopyHandleState.NotStarted)
            {
                return;
            }

            myThread.Start();
        }
示例#4
0
 public void Start()
 {
     if (_isStart)
     {
         return;
     }
     _isStart = true;
     _myThread.Start();
 }
            public override void OnCreate(Bundle p0)
            {
                base.OnCreate (p0);

                // Tell the framework to try to keep this fragment around
                // during a configuration change.
                RetainInstance = true;

                // Start up the worker thread.
                myThread = new MyThread (this);
                myThread.Start ();
            }
示例#6
0
            public override void OnCreate(Bundle p0)
            {
                base.OnCreate(p0);

                // Tell the framework to try to keep this fragment around
                // during a configuration change.
                RetainInstance = true;

                // Start up the worker thread.
                myThread = new MyThread(this);
                myThread.Start();
            }
示例#7
0
 public void new及びstart_stop_disposeしてisRunnigの状態を確認する_負荷テスト()
 {
     //exercise verify
     for (var i = 0; i < 3; i++){
         var sut = new MyThread();
         sut.Start();
         Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.Running));
         sut.Stop();
         Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.After));
         sut.Dispose();
     }
 }
示例#8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="index">Used to check if must start in this files index or in index + 1</param>
        public void Skip(int index)
        {
            try
            {
                //if (State == CopyHandleState.Runing && FileCopier.Writer != null)
                //{

                myThread.Pause();

                //If there is any file in copy process then stop copy,
                //free resources and delete the file with Cancel method.
                if (FileCopier.CurrentFile != null)
                {
                    FileCopier.CurrentFile.CopyState = CopyState.Skiped;
                    FileCopier.Skip();
                }

                //Terminate the copy process
                myThread.Cancel();

                myThread = new MyThread(new Action(() =>
                {
                    if (Operation != null)
                    {
                        Operation.Invoke();

                        RaiseFinished(Errors);

                        Errors.Clear();
                    }
                }));

                if (DiscoverdList.Index == index)
                {
                    DiscoverdList.Index++;
                    CopiedsFiles++;
                }

                myThread.Start();
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(Error.GetErrorLog(ex.Message, "NeathCopyEngine", "NeathCopyHandle", "Skip"));
                using (var w = new StreamWriter(new FileStream(logsPath, FileMode.Append, FileAccess.Write)))
                {
                    w.WriteLine("-------------------------------");
                    w.WriteLine(System.DateTime.Now);
                    w.WriteLine(Error.GetErrorLogInLine(ex.Message, "NeathCopyEngine", "NeathCopyHandle", "Skip"));
                }
            }
        }
示例#9
0
 public void new及びstart_stop_disposeしてisRunnigの状態を確認する_負荷テスト()
 {
     //exercise verify
     for (var i = 0; i < 3; i++)
     {
         var sut = new MyThread();
         sut.Start();
         Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.Running));
         sut.Stop();
         Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.After));
         sut.Dispose();
     }
 }
示例#10
0
 public void start及びstopしてisRunnigの状態を確認する_負荷テスト()
 {
     //setUp
     var sut = new MyThread();
     //exercise verify
     for (var i = 0; i < 5; i++){
         sut.Start();
         Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.Running));
         sut.Stop();
         Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.After));
     }
     //tearDown
     sut.Dispose();
 }
示例#11
0
        public void start及びstopしてisRunnigの状態を確認する_負荷テスト()
        {
            //setUp
            var sut = new MyThread();

            //exercise verify
            for (var i = 0; i < 5; i++)
            {
                sut.Start();
                Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.Running));
                sut.Stop();
                Assert.That(sut.ThreadBaseKind, Is.EqualTo(ThreadBaseKind.After));
            }
            //tearDown
            sut.Dispose();
        }
示例#12
0
        public void Test()
        {
            ThreadClass thread = new ThreadClass();

            //Compare Current Thread Ids
            Assert.IsTrue(ThreadClass.Current().Instance.ManagedThreadId == System.Threading.Thread.CurrentThread.ManagedThreadId);

            //Compare instances of ThreadClass
            MyThread mythread = new MyThread();
            mythread.Start();
            while (mythread.Result == null) System.Threading.Thread.Sleep(1);
            Assert.IsTrue((bool)mythread.Result);

            ThreadClass nullThread = null;
            Assert.IsTrue(nullThread == null); //test overloaded operator == with null values
            Assert.IsFalse(nullThread != null); //test overloaded operator != with null values
        }
示例#13
0
        public IndexForm()
        {
            InitializeComponent();
            this.CenterToScreen();
            //서버접속 및 로그인정보 전달
            clientSocket = new TcpClient();
            clientSocket.Connect("127.0.0.1", 8888);
            serverStream = clientSocket.GetStream();
            WriteToServer("login$" + LoginInfo.login.id + "$");
            byte[] bytesFrom = new byte[(int)clientSocket.ReceiveBufferSize];
            serverStream.Read(bytesFrom, 0, (int)clientSocket.ReceiveBufferSize);
            string dataFromServer = System.Text.Encoding.UTF8.GetString(bytesFrom);

            string[] data = dataFromServer.Split('$');
            if (data[0] == "Not Allowed Access")
            {
                MessageBox.Show("로그인 불가!  " + data[0]);
                Application.ExitThread();
                Environment.Exit(0);
            }

            Init(); //로그인 된 유저 정보로 라벨 값 세팅
            OnlineUserInformation = new MyThread();
            OnlineUserInformation.Start(listBox1, listBox2);
            timer.Interval = 1000;
            timer.Tick    += new EventHandler(KeepChatList);
            timer.Start();


            //트레이아이콘 설정    안되면 윈도우 설정 시스템 알림켜기
            notifyIcon1.Icon = new System.Drawing.Icon(Path.GetFullPath(@"..\..\img\chat.ico"));
            notifyIcon1.Text = "챼팅챼팅";
            notifyIcon1.ShowBalloonTip(1000, "챼팅챼팅", LoginInfo.login.name + "님 환영합니다.", ToolTipIcon.None); //윈도우 자체 알림설정때문에 밀리초 안들음
            notifyIcon1.ContextMenuStrip.Items.Add("챼팅챼팅");
            notifyIcon1.ContextMenuStrip.Items.Add("도움말", null, Help_Clicked);
            notifyIcon1.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            notifyIcon1.ContextMenuStrip.Items.Add("로그아웃", null, button4_Click);
        }
示例#14
0
        public void Test()
        {
            SupportClass.ThreadClass thread = new SupportClass.ThreadClass();

            //Compare Current Thread Ids
            Assert.IsTrue(SupportClass.ThreadClass.Current().Instance.ManagedThreadId == System.Threading.Thread.CurrentThread.ManagedThreadId);


            //Compare instances of ThreadClass
            MyThread mythread = new MyThread();

            mythread.Start();
            while (mythread.Result == null)
            {
                System.Threading.Thread.Sleep(1);
            }
            Assert.IsTrue((bool)mythread.Result);


            SupportClass.ThreadClass nullThread = null;
            Assert.IsTrue(nullThread == null);  //test overloaded operator == with null values
            Assert.IsFalse(nullThread != null); //test overloaded operator != with null values
        }
示例#15
0
        private static void InitThread()
        {
            //delegate
            MyThread.LogErrorHandler = Console.WriteLine;
            DelayActionProcessor.LogErrorHandler = Console.WriteLine;
            DelayActionProcessor.LogInfoHandler = Console.WriteLine;

            mTaskDispatcher = new MyTaskDispatcher(3, true);
            mTaskDispatcher.DispatchAction(TestThread, "this is a param!");

            mThread = new MyThread();
            mThread.Start();
            mThread.QueueAction(TestThread, "this is a param!");

            //thread.Stop();
        }