protected virtual void Dispose(bool isdisposable)
 {
     if (GridSource != null)
     {
         GridSource.Clear();
     }
 }
示例#2
0
        private async void Scan()
        {
            FilterColumns.Clear();

            if (!ValidateIpRanges())
            {
                return;
            }

            if (AppStats.ApplicationState == AppState.Supervising)
            {
                RequestStop();
            }

            await Task.Run(() =>
            {
                while (AppStats.CurrentlyRunningThreadsCount > 0) // to avoid concurency when manual rescan invoked TODO: develop some better solution
                {
                    Thread.Sleep(100);
                }

                if (_currentTaskIsFinishedEvent.WaitOne())
                {
                    if (AppStats.ApplicationState != AppState.Chilling &&
                        AppStats.ApplicationState != AppState.Supervising)
                    {
                        _currentTaskIsFinishedEvent.Set();
                        return;
                    }

                    ScanningProcessStarted?.Invoke();

                    ResetScannedNodesCount();

                    AppStats.ApplicationState = AppState.Scaning;

                    Application.Current.Dispatcher.Invoke(() => GridSource.Clear());

                    GenerateRowsFromIpRangesAndArangeScanTasks();

                    CreateFileterColumnsList();

                    var requiredThreadsCount = (byte)Math.Min(GridSource.Count, Config.MaxThreads);

                    var multiTask       = new MultiThreadedTask(requiredThreadsCount);
                    multiTask.Finished += MultiTask_Finished;

                    multiTask.Begin(ScanProc);
                }
            });
        }
示例#3
0
        private void BindLsbGrid()
        {
            GridSource.Clear();
            GridSource.AddRange(this._viewModel.LSBList.OrderBy(w => w.N_SORT).ThenBy(w => w.N_GROUP));
            this.modTPPLGPCLSBBindingSource.DataSource = GridSource;
            SetGridViewRowNum.SetRowNum(gridView1);
            this.gridView1.UpdateSummary();
            this.gridView1.RefreshData();
            this.gridView1.BestFitColumns();

            if (GridSource.Count > 0)
            {
                lbl_info.Text = $"订单需排产量(按整炉计算):{GridSource.FirstOrDefault().N_TOTAL_WGT}" +
                                $";订单需排炉数:{ GridSource.FirstOrDefault().N_ORDER_LS}";
            }
            else
            {
                lbl_info.Text = "";
            }
        }
示例#4
0
        private void InitDrop()
        {
            var dropPlanToReq = new GridViewDragDropHelper(
                gridView1, gridView1, (row1, row2) =>
            {
                if (row1 == row2)
                {
                    return;
                }

                var plan1 = this.gridView1.GetRow(row1) as Mod_TPP_LGPC_LSB;
                if (row2 < GridSource.Count)
                {
                    row2 = row2 < 0 ? 0 : row2;
                    if (row2 >= gridView1.RowCount)
                    {
                        row2 = gridView1.RowCount - 1;
                    }
                    var plan2 = this.gridView1.GetRow(row2) as Mod_TPP_LGPC_LSB;
                    if (plan2 == null)
                    {
                        return;
                    }
                    GridSource.Remove(plan1);
                    var left  = GridSource.TakeWhile(x => x.N_SORT < plan2.N_SORT).ToList();
                    var right = GridSource.Where(x => left.Contains(x) == false).ToList();
                    GridSource.Clear();
                    GridSource.AddRange(left);
                    GridSource.Add(plan1);
                    GridSource.AddRange(right);
                }
                else
                {
                    GridSource.Remove(plan1);
                    GridSource.Add(plan1);
                }

                foreach (var item in GridSource)
                {
                    item.N_SORT = GridSource.IndexOf(item) + 1;
                }

                this.gridView1.RefreshData();
            });

            dropPlanToReq.AllowDrop = true;

            var dropPlanToReq2 = new GridViewDragDropHelper(
                gridView2, gridView2, (row1, row2) =>
            {
                if (row1 == row2)
                {
                    return;
                }

                var plan1 = this.gridView2.GetRow(row1) as Mod_TPP_LGPC_LCLSB;
                if (row2 < GridLsSource.Count)
                {
                    row2      = row2 < 0 ? 0 : row2;
                    var plan2 = this.gridView2.GetRow(row2) as Mod_TPP_LGPC_LCLSB;
                    if (plan2 == null)
                    {
                        return;
                    }
                    GridLsSource.Remove(plan1);
                    var left  = GridLsSource.TakeWhile(x => x.N_SORT < plan2.N_SORT).ToList();
                    var right = GridLsSource.Where(x => left.Contains(x) == false).ToList();
                    GridLsSource.Clear();
                    GridLsSource.AddRange(left);
                    GridLsSource.Add(plan1);
                    GridLsSource.AddRange(right);
                }
                else
                {
                    GridLsSource.Remove(plan1);
                    GridLsSource.Add(plan1);
                }

                foreach (var item in GridLsSource)
                {
                    item.N_SORT = GridLsSource.IndexOf(item) + 1;
                }

                this.gridView2.RefreshData();
            });

            dropPlanToReq2.AllowDrop = true;
        }