Ejemplo n.º 1
0
        void LoadMoreItems(uint count, int baseIndex)
        {
            BackgroundWorker worker = new BackgroundWorker();

            //worker.RunWorkerAsync ();
            worker.DoWork += (o, ae) =>
            {
                DataServiceQuery <Order> query = northwindEntity.Orders.Expand("Customer");
                query = query.Skip <Order>(baseIndex).Take <Order>(50) as DataServiceQuery <Order>;
                IAsyncResult ar    = query.BeginExecute(null, null);
                var          items = query.EndExecute(ar);
                var          list  = items.ToList();

                Android.OS.Handler mainHandler = new Android.OS.Handler(Android.OS.Looper.MainLooper);
                Java.Lang.Runnable myRunnable  = new Java.Lang.Runnable(() =>
                {
                    GridSource.LoadItems(list);
                });
                mainHandler.Post(myRunnable);
            };

            worker.RunWorkerCompleted += (o, ae) =>
            {
                IsBusy = false;
            };

            IsBusy = true;
            worker.RunWorkerAsync();
        }
        public void RefreshMainPage()
        {
            ChecklistDockPanel.Children.Clear();
            listBoxUser.Items.Add(Relation.firstname + " " + Relation.lastname + " - " + Relation.id);

            Grid_CheckList.Columns.Clear();

            AddColumnToDataGrid(Grid_CheckList, new DataGridTextColumn(), "Sıra", 35, "Order");
            AddColumnToDataGrid(Grid_CheckList, new DataGridTextColumn(), "Rutin İş Açıklaması", 350, "WorkDescription");
            // locate names and work relationship, and create datagrid columns
            for (int i = listBoxUser.Items.Count - 1; -1 < i; i--)
            {
                string[] temp = listBoxUser.Items[i].ToString().Split('-');
                Label    tempLabel;

                if (i != listBoxUser.Items.Count - 1)
                {
                    ChecklistDockPanel.Children.Add(new Label()
                    {
                        Content = " | "
                    });
                }

                ChecklistDockPanel.Children.Add(tempLabel = new Label()
                {
                    Content = temp[0]
                });

                tempLabel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                string bindingPath = "Daily" + Math.Abs(i - listBoxUser.Items.Count);
                AddColumnToDataGrid(Grid_CheckList, new DataGridCheckBoxColumn(), Lang.SettingsRadioDaily, (int)(tempLabel.DesiredSize.Width / 2), bindingPath);

                bindingPath = "Weekly" + Math.Abs(i - listBoxUser.Items.Count);
                AddColumnToDataGrid(Grid_CheckList, new DataGridCheckBoxColumn(), Lang.SettingsRadioWeekly, (int)(tempLabel.DesiredSize.Width / 2) + 25, bindingPath);
            }

            if (CheckFirstFill)
            {
                for (int i = 0; i < WorkCount; i++)
                {
                    // description
                    GridSource[i].Order           = (i + 1);
                    GridSource[i].WorkID          = RoutineWorks[i].id;
                    GridSource[i].WorkDescription = RoutineWorks[i].work_description;
                }
                CheckFirstFill = false;
            }

            if (IsAdded)
            {
                IsAdded = false;
                GridSource.Add(new CheckListObject());
                GridSource[GridSource.Count - 1].Order           = GridSource.Count;
                GridSource[GridSource.Count - 1].WorkID          = RoutineWorks[GridSource.Count - 1].id;
                GridSource[GridSource.Count - 1].WorkDescription = RoutineWorks[GridSource.Count - 1].work_description;
            }
            Grid_CheckList.ItemsSource = GridSource;
            ReloadCheckList();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Runs the tool.
        /// </summary>
        public override bool Run(ITaskHandle task)
        {
            using (var grid = new GridSource(Input))
            {
                RasterColorScheme rcs;

                if (UseBuiltInColorScheme)
                {
                    rcs = grid.RetrieveColorScheme(GridSchemeRetrieval.Auto);
                    if (rcs == null)
                    {
                        Log.Error("No predefined color scheme was found.", null);
                        return(false);
                    }
                }
                else
                {
                    rcs = grid.GenerateColorScheme(GridSchemeGeneration.Gradient, ColorScheme);
                }

                MapConfig.GridProxyFormat = ProxyFormat;

                Output.Result = grid.CreateImageProxy(rcs);
            }

            return(Output.Result != null);
        }
 protected virtual void Dispose(bool isdisposable)
 {
     if (GridSource != null)
     {
         GridSource.Clear();
     }
 }
Ejemplo n.º 5
0
        private void UpdateTotal()
        {
            this.Total = GridSource.Sum(denom => denom.Total);

            // Refresh the total area in the grid
            gvDenom.UpdateTotalSummary();
        }
        public void MyAction()
        {
            var source = new MainWindowModel
            {
                FirstName = FirstName,
                LastName  = LastName
            };

            GridSource.Add(source);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Reprojects a grid
        /// </summary>
        public GridSource Reproject(GridSource grid, ISpatialReference newProjection, string saveAsFilename)
        {
            if (GdalUtils.Instance.WarpRaster(grid.Filename, saveAsFilename, newProjection))
            {
                //gridNew.AssignNewProjection(newProjection.ExportToProj4());
                return(new GridSource(saveAsFilename));
            }

            Logger.Current.Warn("Failed to warp raster datasource: " + grid.Filename);
            return(null);
        }
        public MainWindowViewModel()
        {
            var model = new MainWindowModel
            {
                FirstName = "A1",
                LastName  = "B1"
            };

            GridSource.Add(model);
            _canExecute = true;
        }
Ejemplo n.º 9
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);
                }
            });
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Runs the tool.
        /// </summary>
        public override bool Run(ITaskHandle task)
        {
            var grid = new GridSource(GridFilename);

            bool result;

            try
            {
                result = GisUtils.Instance.GridStatisticsToShapefile(grid, Vector.Datasource, Vector.SelectedOnly,
                                                                     OverwriteFields);
            }
            catch (Exception)
            {
                grid.Dispose();
                throw;
            }

            return(result);
        }
Ejemplo n.º 11
0
        private void Btn_workDelete_Click(object sender, RoutedEventArgs e)
        {
            RoutineWork routineWork = Grid_Checklist.SelectedItem as RoutineWork;
            var         result      = MessageBox.Show(routineWork.id + " id numaralı iş silinecek, onaylıyor musunuz ?", "Uyarı", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                foreach (var item in GridSource)
                {
                    if (item.WorkID == routineWork.id)
                    {
                        GridSource.Remove(item);
                        break;
                    }
                }
                DB.DeleteRoutineWork(routineWork);
                ReloadCheckList();
                RefreshMainPage();
            }
        }
Ejemplo n.º 12
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 = "";
            }
        }
Ejemplo n.º 13
0
        void LoadMoreItems(uint count, int baseIndex)
        {
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (o, ae) => {
                DataServiceQuery <Order> query = northwindEntity.Orders.Expand("Customer");
                query = query.Skip <Order> (baseIndex).Take <Order> (15) as DataServiceQuery <Order>;
                IAsyncResult ar    = query.BeginExecute(null, null);
                var          items = query.EndExecute(ar);
                var          list  = items.ToList();

                DispatchQueue.MainQueue.DispatchAsync(new Action(() => {
                    GridSource.LoadItems(list);
                }));
            };

            worker.RunWorkerCompleted += (o, ae) => {
                IsBusy = false;
                UIView.Animate(2, () => {
                    for (int i = 5; i < 0; i--)
                    {
                        LoaderBorder.Alpha = i - 0.1f;
                    }

                    LoaderBorder.Hidden = true;
                });
                this.LoaderIndicator.StopAnimating();
                this.LoaderIndicator.HidesWhenStopped = true;
                this.LoaderLable.Hidden = true;
            };

            IsBusy = true;
            {
                this.LoaderLable.Hidden = false;
                LoaderBorder.Hidden     = false;
                UIView.Animate(2, () => {
                    this.LoaderIndicator.StartAnimating();
                });
            }
            worker.RunWorkerAsync();
        }
Ejemplo n.º 14
0
        void LoadMoreItems(uint count, int baseIndex)
        {
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (o, ae) =>
            {
                DataServiceQuery <Order> query = northwindEntity.Orders.Expand("Customer");
                query = query.Skip <Order>(baseIndex).Take <Order>(50) as DataServiceQuery <Order>;
                IAsyncResult ar    = query.BeginExecute(null, null);
                var          items = query.EndExecute(ar);
                var          list  = items.ToList();
                Application.Current.Dispatcher.Invoke(new Action(() => { GridSource.LoadItems(list); }));
            };

            worker.RunWorkerCompleted += (o, ae) =>
            {
                IsBusy = false;
            };

            IsBusy = true;
            worker.RunWorkerAsync();
        }
Ejemplo n.º 15
0
        private void GenerateRowsFromIpRangesAndArangeScanTasks()
        {
            foreach (var ipRange in Config.IpAddressRanges)
            {
                int start = ipRange.Begin.ToInt();
                int end   = ipRange.End.ToInt();

                for (int i = start; i <= end; i++)
                {
                    byte[] bytes = BitConverter.GetBytes(i);

                    var ip = new IPAddress(new[] { bytes[3], bytes[2], bytes[1], bytes[0] });

                    var newRow = GenerateNodeFromUserParameterSet(ip);

                    Application.Current.Dispatcher.Invoke(() =>
                                                          GridSource.Add(newRow));

                    AddTask(newRow);
                }
            }
        }
Ejemplo n.º 16
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;
        }
 /// <summary>
 /// 生成DynamicUnstructureGeometry
 /// </summary>
 /// <param name="source"></param>
 /// <returns></returns>
 public override MeshBase CreateMesh(GridSource.GridderSource source)
 {
     return this.DoCreateMesh((DynamicUnstructuredGridderSource)source);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="source"></param>
 /// <param name="gridIndexes"></param>
 /// <param name="values"></param>
 /// <param name="minValue"></param>
 /// <param name="maxValue"></param>
 /// <returns></returns>
 public override TexCoordBuffer CreateTextureCoordinates(GridSource.GridderSource source, int[] gridIndexes, float[] values, float minValue, float maxValue)
 {
     return this.DoCreateMatrixTextureCoordinates((DynamicUnstructuredGridderSource)source, gridIndexes, values, minValue, maxValue);
 }
 public void Dispose()
 {
     GridSource?.Dispose();
     Dispose(true);
     GC.SuppressFinalize(true);
 }