Пример #1
0
        private void btnSumCalculate_Click(object sender, RoutedEventArgs e)
        {
            if (data.GetType() == typeof(DirectoryCover))
            {
                if (CalculiatingState != CalculiatingStateKind.Working)
                {
                    DirectoryCover dCover = (DirectoryCover)data;
                    DirectoryInfo  di     = dCover.DirectoryElement;

                    //txtSize.Background = Brushes.White;

                    CalculiatorSize cSize = new CalculiatorSize();

                    cSize.UpdateFieleSum          += new CalculiatorSize.UpdateFieleSumEventHandler(cSize_UpdateFieleSum);
                    cSize.InvalidAccess           += new CalculiatorSize.InvalidAccessEventHandler(cSize_InvalidAccess);
                    cSize.ChangeCalculiatingState += new CalculiatorSize.ChangeCalculiatingStateEventHandler(cSize_ChangeCalculiatingState);

                    Thread thread = new Thread(cSize.Calculiate);
                    //thread.Priority = ThreadPriority.
                    thread.IsBackground = true;
                    thread.Start(di);
                }


                //long sum = CalculateSize(di);
                //txtSize.Text = SizeFileInString.GetSizeInStr(sum);
            }
        }
Пример #2
0
        private void btnSumCalculate_Click(object sender, RoutedEventArgs e)
        {
            if (data.GetType() == typeof(DirectoryCover))
            {
                if (CalculiatingState != CalculiatingStateKind.Working)
                {
                    DirectoryCover dCover = (DirectoryCover)data;
                    DirectoryInfo di = dCover.DirectoryElement;

                    //txtSize.Background = Brushes.White;

                    CalculiatorSize cSize = new CalculiatorSize();

                    cSize.UpdateFieleSum += new CalculiatorSize.UpdateFieleSumEventHandler(cSize_UpdateFieleSum);
                    cSize.InvalidAccess += new CalculiatorSize.InvalidAccessEventHandler(cSize_InvalidAccess);
                    cSize.ChangeCalculiatingState += new CalculiatorSize.ChangeCalculiatingStateEventHandler(cSize_ChangeCalculiatingState);

                    Thread thread = new Thread(cSize.Calculiate);
                    //thread.Priority = ThreadPriority.
                    thread.IsBackground = true;
                    thread.Start(di);
                }

                //long sum = CalculateSize(di);
                //txtSize.Text = SizeFileInString.GetSizeInStr(sum);
            }
        }