コード例 #1
0
ファイル: ColorPicker.cs プロジェクト: rprouse/DotSpatial
        /// <summary>
        /// Fires the ChangesApplied event.
        /// </summary>
        protected virtual void OnChangesApplied()
        {
            if (_rasterCategory != null)
            {
                _rasterCategory.LowColor  = grdSlider.MinimumColor;
                _rasterCategory.HighColor = grdSlider.MaximumColor;
            }

            Original.CopyProperties(_rasterCategory);
            ChangesApplied?.Invoke(this, EventArgs.Empty);
        }
コード例 #2
0
 public void SetData(MyModel model)
 {
     if (model.Initialized)
     {
         this.Model = model;
         ChangesApplied?.Invoke(Model);
     }
     else
     {
         // Handle case where model isn't initialized
     }
 }
コード例 #3
0
        /// <summary>
        /// Applies the changes that have been specified in this control.
        /// </summary>
        protected virtual void OnApplyChanges()
        {
            _originalLayer.Symbolizer = _newLayer.Symbolizer.Copy();
            _originalScheme           = _newLayer.Symbolizer.Scheme.Copy();
            if (_originalLayer.Symbolizer.ShadedRelief.IsUsed)
            {
                if (_originalLayer.Symbolizer.ShadedRelief.HasChanged || _originalLayer.Symbolizer.HillShade == null)
                {
                    _originalLayer.Symbolizer.CreateHillShade(mwProgressBar1);
                }
            }

            _originalLayer.WriteBitmap(mwProgressBar1);
            ChangesApplied?.Invoke(_originalLayer, EventArgs.Empty);
        }
コード例 #4
0
ファイル: LabelSetup.cs プロジェクト: CGX-GROUP/DotSpatial
        /// <summary>
        /// Fires the ChangesApplied event.
        /// </summary>
        protected virtual void OnChangesApplied()
        {
            _activeCategory.Expression = sqlExpression.ExpressionText;

            ChangesApplied?.Invoke(this, EventArgs.Empty);

            if (_original != null)
            {
                _original.CopyProperties(_layer);
                _original.CreateLabels();

                // We have no guarantee that the MapFrame property is set, but redrawing the map is important.
                _original.FeatureLayer.MapFrame?.Invalidate();
            }
        }
コード例 #5
0
ファイル: LayerDialog.cs プロジェクト: rprouse/DotSpatial
        /// <summary>
        /// Occurs during apply changes operations and is overrideable in subclasses.
        /// </summary>
        protected virtual void OnApplyChanges()
        {
            _rasterCategoryControl.ApplyChanges();

            ChangesApplied?.Invoke(_layer, EventArgs.Empty);
        }
コード例 #6
0
 /// <summary>
 /// Fires the ChangesApplied event
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     detailedPointSymbolControl1.ApplyChanges();
     ChangesApplied?.Invoke(this, EventArgs.Empty);
 }
コード例 #7
0
 /// <summary>
 /// Fires the ChangesApplied event.
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     // This duplicates the content from the edit copy, but leaves the original object reference intact so that the map updates.
     _original.CopyProperties(_symbolizer);
     ChangesApplied?.Invoke(this, EventArgs.Empty);
 }
コード例 #8
0
 /// <summary>
 /// Fires a the ChangesApplied event.
 /// </summary>
 /// <param name="changedItem">Item that was changed.</param>
 protected virtual void OnChangesApplied(object changedItem)
 {
     ChangesApplied?.Invoke(this, new ChangedObjectEventArgs(changedItem));
 }
コード例 #9
0
 /// <summary>
 /// Fires the ChangesApplied event
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     _original.CopyProperties(_symbolizer);
     ChangesApplied?.Invoke(this, EventArgs.Empty);
 }
コード例 #10
0
        /// <summary>
        /// Send changes to server
        /// </summary>
        public async Task <(SyncContext, ChangesApplied)> ApplyChangesAsync(SyncContext context, MessageApplyChanges message)
        {
            if (message.Changes == null || message.Changes.BatchPartsInfo.Count == 0)
            {
                return(context, new ChangesApplied());
            }

            SyncContext    syncContext    = null;
            ChangesApplied changesApplied = null;

            // Foreach part, will have to send them to the remote
            // once finished, return context
            foreach (var bpi in message.Changes.BatchPartsInfo.OrderBy(bpi => bpi.Index))
            {
                var applyChanges = new HttpMessageApplyChanges
                {
                    FromScope           = message.FromScope,
                    Schema              = new DmSetSurrogate(message.Schema),
                    Policy              = message.Policy,
                    UseBulkOperations   = message.UseBulkOperations,
                    ScopeInfoTableName  = message.ScopeInfoTableName,
                    SerializationFormat = message.SerializationFormat
                };

                HttpMessage httpMessage = new HttpMessage
                {
                    Step        = HttpStep.ApplyChanges,
                    SyncContext = context,
                    Content     = applyChanges
                };

                // If BPI is InMempory, no need to deserialize from disk
                // Set already contained in part.Set
                if (!message.Changes.InMemory)
                {
                    // get the batch
                    var partBatch = bpi.GetBatch();

                    // get the surrogate dmSet
                    if (partBatch != null)
                    {
                        applyChanges.Set = partBatch.DmSetSurrogate;
                    }
                }
                else if (bpi.Set != null)
                {
                    applyChanges.Set = new DmSetSurrogate(bpi.Set);
                }

                if (applyChanges.Set == null || applyChanges.Set.Tables == null)
                {
                    throw new ArgumentException("No changes to upload found.");
                }

                // no need to send filename
                applyChanges.BatchPartInfo = new BatchPartInfo
                {
                    FileName    = null,
                    Index       = bpi.Index,
                    IsLastBatch = bpi.IsLastBatch,
                    Tables      = bpi.Tables
                };
                applyChanges.InMemory   = message.Changes.InMemory;
                applyChanges.BatchIndex = bpi.Index;

                //Post request and get response
                var httpMessageResponse = await this.httpRequestHandler.ProcessRequest(httpMessage, message.SerializationFormat, cancellationToken);

                // Clear surrogate
                applyChanges.Set.Dispose();
                applyChanges.Set = null;

                if (httpMessageResponse == null)
                {
                    throw new Exception("Can't have an empty body");
                }

                HttpMessageApplyChanges httpMessageContent;
                if (httpMessageResponse.Content is HttpMessageApplyChanges)
                {
                    httpMessageContent = httpMessageResponse.Content as HttpMessageApplyChanges;
                }
                else
                {
                    httpMessageContent = (httpMessageResponse.Content as JObject).ToObject <HttpMessageApplyChanges>();
                }

                syncContext    = httpMessageResponse.SyncContext;
                changesApplied = httpMessageContent.ChangesApplied;
            }

            return(syncContext, changesApplied);
        }
コード例 #11
0
 public IActionResult DriverAdded(ChangesApplied input)
 {
     return(this.View(input));
 }
コード例 #12
0
 public IActionResult ShipmentChanged(ChangesApplied input)
 {
     return(this.View(input));
 }
コード例 #13
0
        /// <summary>
        /// Send changes to server
        /// </summary>
        public async Task <(SyncContext, ChangesApplied)> ApplyChangesAsync(SyncContext context, ScopeInfo fromScope, BatchInfo changes)
        {
            if (changes == null || changes.BatchPartsInfo.Count == 0)
            {
                return(context, new ChangesApplied());
            }

            SyncContext    syncContext    = null;
            ChangesApplied changesApplied = null;

            // Foreach part, will have to send them to the remote
            // once finished, return context
            foreach (var bpi in changes.BatchPartsInfo.OrderBy(bpi => bpi.Index))
            {
                HttpMessage httpMessage = new HttpMessage();
                httpMessage.Step        = HttpStep.ApplyChanges;
                httpMessage.SyncContext = context;

                httpMessage.ApplyChanges           = new HttpApplyChangesMessage();
                httpMessage.ApplyChanges.ScopeInfo = fromScope;

                // If BPI is InMempory, no need to deserialize from disk
                // Set already contained in part.Set
                if (!changes.InMemory)
                {
                    // get the batch
                    var partBatch = bpi.GetBatch();

                    // get the surrogate dmSet
                    if (partBatch != null)
                    {
                        httpMessage.ApplyChanges.Set = partBatch.DmSetSurrogate;
                    }
                }
                else if (bpi.Set != null)
                {
                    httpMessage.ApplyChanges.Set = new DmSetSurrogate(bpi.Set);
                }

                if (httpMessage.ApplyChanges.Set == null || httpMessage.ApplyChanges.Set.Tables == null)
                {
                    throw new ArgumentException("No changes to upload found.");
                }

                // no need to send filename
                httpMessage.ApplyChanges.BatchPartInfo = new BatchPartInfo
                {
                    FileName    = null,
                    Index       = bpi.Index,
                    IsLastBatch = bpi.IsLastBatch,
                    Tables      = bpi.Tables
                };
                httpMessage.ApplyChanges.InMemory   = changes.InMemory;
                httpMessage.ApplyChanges.BatchIndex = bpi.Index;

                //Post request and get response
                var httpMessageResponse = await this.httpRequestHandler.ProcessRequest(httpMessage, cancellationToken);

                // Clear surrogate
                httpMessage.ApplyChanges.Set.Dispose();
                httpMessage.ApplyChanges.Set = null;

                if (httpMessageResponse == null)
                {
                    throw new Exception("Can't have an empty body");
                }

                syncContext    = httpMessageResponse.SyncContext;
                changesApplied = httpMessageResponse.ApplyChanges.ChangesApplied;
            }

            return(syncContext, changesApplied);
        }
コード例 #14
0
 /// <summary>
 /// Applies the changes that have been specified in this control.
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     _originalLayer.Symbolizer = _newLayer.Symbolizer.Copy();
     ChangesApplied?.Invoke(_originalLayer, EventArgs.Empty);
 }
コード例 #15
0
 protected virtual void RaiseChangesApplied(BulkInsertAppliedEventArgs e)
 {
     ChangesApplied?.Invoke(this, e);
 }
コード例 #16
0
 public IActionResult OrderDeleted(ChangesApplied input)
 {
     return(this.View(input));
 }
コード例 #17
0
 /// <summary>
 /// Fires the ChangesApplied event.
 /// </summary>
 protected void OnApplyChanges()
 {
     UpdatePreview();
     _original.CopyProperties(_symbolizer);
     ChangesApplied?.Invoke(this, EventArgs.Empty);
 }
コード例 #18
0
ファイル: PropertyDialog.cs プロジェクト: rprouse/DotSpatial
        /// <summary>
        /// Fires the ChangesApplied event. If an original object IDescriptor has been set,
        /// then this directly handles the update.
        /// </summary>
        protected virtual void OnChangesApplied()
        {
            OriginalObject?.CopyProperties(PropertyGrid.SelectedObject);

            ChangesApplied?.Invoke(this, EventArgs.Empty);
        }
コード例 #19
0
 /// <summary>
 /// Fires the ChangesApplied event.
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     ChangesApplied?.Invoke(this, new FilterEventArgs(sqlQueryControl1.ExpressionText));
 }
コード例 #20
0
 protected virtual void RaiseChangesApplied(IList <IEntityStateEntry> entityStateEntries)
 {
     ChangesApplied?.Invoke(this, new ChangesAppliedEventArgs(entityStateEntries));
 }
コード例 #21
0
ファイル: Size2DDialog.cs プロジェクト: CGX-GROUP/DotSpatial
 /// <summary>
 /// Fires the ChangesApplied event
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     ChangesApplied?.Invoke(this, EventArgs.Empty);
 }
コード例 #22
0
        private void ApplyChangesClicked(object sender, RoutedEventArgs e)
        {
            if (SelectedElement == null && SelectedObject == null)
            {
                return;
            }

            int    tempIntValue;
            double tempDoubleValue;
            var    levelViewModel = (LevelViewModel)DataContext;

            if (SelectedElement != null)
            {
                SelectedElement.WorldElement.usesRotFlags =
                    editor_UseRotFlagsBox.IsChecked.GetValueOrDefault();     // Uses Rot Flags
                if (GetIntHex(editor_XYZRotFlagsBox.Text, out tempIntValue)) // XYZ Rot Flags
                {
                    SelectedElement.WorldElement.xyzRotFlags = tempIntValue;
                }

                if (GetDouble(editor_CosBox.Text, out tempDoubleValue)) // Cos
                {
                    SelectedElement.WorldElement.cosAlpha = tempDoubleValue;
                }

                if (GetDouble(editor_SinBox.Text, out tempDoubleValue)) // Sin
                {
                    SelectedElement.WorldElement.sinAlpha = tempDoubleValue;
                }

                if (GetDouble(editor_PosXBox.Text, out tempDoubleValue)) // X
                {
                    SelectedElement.WorldElement.pos.X = tempDoubleValue;
                }

                if (GetDouble(editor_PosYBox.Text, out tempDoubleValue)) // Y
                {
                    SelectedElement.WorldElement.pos.Y = tempDoubleValue;
                }

                if (GetDouble(editor_PosZBox.Text, out tempDoubleValue)) // Z
                {
                    SelectedElement.WorldElement.pos.Z = tempDoubleValue;
                }

                levelViewModel.RebuildScene();
            }
            else if (SelectedObject != null)
            {
                SelectedObject.ObjectData.Name = editor_Obj_NameBox.Text; // Name
                if (GetIntHex(editor_Obj_I6Box.Text, out tempIntValue))   // I6
                {
                    SelectedObject.ObjectData.I6 = (short)tempIntValue;
                }

                if (GetDouble(editor_Obj_Float1Box.Text, out tempDoubleValue)) // Float 1
                {
                    SelectedObject.ObjectData.Floats[0] = (float)tempDoubleValue;
                }

                if (GetDouble(editor_Obj_Float2Box.Text, out tempDoubleValue)) // Float 2
                {
                    SelectedObject.ObjectData.Floats[1] = (float)tempDoubleValue;
                }

                if (GetDouble(editor_Obj_Float3Box.Text, out tempDoubleValue)) // Float 3
                {
                    SelectedObject.ObjectData.Floats[2] = (float)tempDoubleValue;
                }

                SelectedObject.ObjectData.Properties.Clear();
                SelectedObject.ObjectData.Properties.AddRange(editor_Obj_PropertiesBox.Text.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries));

                levelViewModel.ObjectManager.RemoveObjectFromList(SelectedObject);

                var newObject = levelViewModel.ObjectManager.ParseObject(SelectedObject.ObjectData);

                SelectedObject = newObject;

                levelViewModel.RebuildScene();
            }
            ChangesApplied?.Invoke(this, EventArgs.Empty);
        }