protected virtual void OnRaiseDataEvent(DataObjectEventArgs args)
 {
     if (RaiseDataEvent != null)
     {
         RaiseDataEvent(this, args);
     }
 }
        /// <summary>
        /// Checks whether command is enabled and updates collection of options when editing saved.
        /// </summary>
        /// <param name="sender">OptimizeAndEdit page.</param>
        /// <param name="e">Event args.</param>
        private void _SchedulePageEditCommitted(object sender, DataObjectEventArgs e)
        {
            if (null != _schedulePage.CurrentSchedule)
            {
                _CreateOptions(_schedulePage.CurrentSchedule);
            }

            _CheckEnabled();
        }
Beispiel #3
0
        protected virtual void OnGetDataObject(DataObjectEventArgs e)
        {
            EventHandler <DataObjectEventArgs> handler = GetDataObject;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #4
0
        private static void HandleDataEvents(object sender, DataObjectEventArgs args)
        {
            DataObject data = args.dataObject;

            string identifier = data.Identifier;

            switch (identifier)
            {
            case "Get":
                Console.WriteLine("\n Key={0}\n Value={1}", data.Key, data.Value);
                break;

            case "Notification":
                Notification notification = (Notification)data.Value;

                if (notification.Key != null && notification.Value != null)
                {
                    Console.WriteLine("\n NOTIFICATION\n Key={0} \n Value={1} \t {2}", notification.Key, notification.Value, notification.Message);
                }
                else if (notification.Value == null)
                {
                    Console.WriteLine("\n NOTIFICATION\n Key={0} \t {1}", notification.Key, notification.Message);
                }
                else
                {
                    Console.WriteLine("\n NOTIFICATION\n {0}", notification.Message);
                }

                break;

            case "Subscriptions":
                var list = (List <string>)data.Value;
                if (list.Count > 0)
                {
                    Console.WriteLine("\nYou have following subscriptions:");
                    foreach (var sub in list)
                    {
                        Console.WriteLine(sub);
                    }
                }
                else
                {
                    Console.WriteLine("You don't have any subscriptions yet");
                }
                break;

            case "Exception occured":
                Exception e = (Exception)data.Value;
                Console.WriteLine(e.Message);
                break;
            }
        }
Beispiel #5
0
        private void BeginDragDrop(Point startingPoint)
        {
            DataObjectEventArgs e = new DataObjectEventArgs(startingPoint);

            OnGetDataObject(e);
            object data = e.DataObject;

            if (data == null)
            {
                return;
            }
            DragDropEffectsEventArgs de = new DragDropEffectsEventArgs();

            OnGetDragEffects(de);
            DragDropEffects          allowedEffects = de.DragDropEffects;
            DragDropEffects          effects        = DoDragDrop(data, allowedEffects);
            DragDropEffectsEventArgs finishedArgs   = new DragDropEffectsEventArgs();

            finishedArgs.DragDropEffects = effects;
            DragDropEventArgs ddea = new DragDropEventArgs(data, startingPoint, allowedEffects, effects);

            OnDragCompleted(ddea);
        }
        private void MyCopyCommand(object sender, DataObjectEventArgs e)
        {
            e.CancelCommand();

            var selection = txInput.Selection;
            var navigator = selection.Start.GetPositionAtOffset(0, LogicalDirection.Forward);
            var end       = selection.End;
            var buffer    = new StringBuilder();

            int offset;

            do
            {
                //Debug.Assert(navigator != null, "navigator != null");
                offset = navigator.GetOffsetToPosition(end);
                var context = navigator.GetPointerContext(LogicalDirection.Forward);
                if (context == TextPointerContext.Text)
                {
                    buffer.Append(
                        navigator.GetTextInRun(LogicalDirection.Forward),
                        0,
                        Math.Min(offset, navigator.GetTextRunLength(LogicalDirection.Forward)));
                }
                else if (context == TextPointerContext.EmbeddedElement)
                {
                    var link = navigator.Parent as SecurityHyperLink;

                    if (link != null)
                    {
                        buffer.Append(link.Security.Id);
                    }
                }
                navigator = navigator.GetNextContextPosition(LogicalDirection.Forward);
            }while (offset > 0);

            Clipboard.SetText(buffer.ToString());
        }
 /// <summary>
 /// Raises event about new item was commited.
 /// </summary>
 /// <param name="sender">Data grid control sender.</param>
 /// <param name="e">Item event args.</param>
 private void _DataGridCollectionViewSourceNewItemCommitted(object sender,
                                                            DataGridItemEventArgs e)
 {
     DataObjectEventArgs args = new DataObjectEventArgs((AppData.DataObject)e.Item);
     if (NewObjectCommitted != null)
         NewObjectCommitted(this, args);
 }
 private void ClipboardProtection(object sender, DataObjectEventArgs e)
 {
     _ = new Helpers.GeneralHelpers().ClearClipboardAsync();
 }
Beispiel #9
0
 private void CopyPasteEventHandler(object sender, DataObjectEventArgs e)
 {
     // cancel copy and paste
     e.CancelCommand();
 }
 private void PastingEventHandler(object sender, DataObjectEventArgs e)
 {
     // Right! Now you wanna copy and paste... Where's my coffe?
     e.CancelCommand();
 }
 private void DataGridCollectionViewSource_NewItemCommitted(object sender, Xceed.Wpf.DataGrid.DataGridItemEventArgs e)
 {
     DataObjectEventArgs args = new DataObjectEventArgs((ESRI.ArcLogistics.Data.DataObject)e.Item);
     if (NewObjectCommitted != null)
         NewObjectCommitted(this, args);
 }
 private void DataGridCollectionViewSource_EditBegun(object sender, DataGridItemEventArgs e)
 {
     DataObjectEventArgs args = new DataObjectEventArgs((ESRI.ArcLogistics.Data.DataObject)e.Item);
     if (EditBegun != null)
         EditBegun(this, args);
 }
 private void DataGridCollectionViewSource_NewItemCanceled(object sender, Xceed.Wpf.DataGrid.DataGridItemEventArgs e)
 {
     IsEditingInProgress = false;
     DataObjectEventArgs args = new DataObjectEventArgs((ESRI.ArcLogistics.Data.DataObject)e.Item);
     if (NewObjectCanceled != null)
         NewObjectCanceled(this, args);
     _SetSelectionStatus();
 }
 /// <summary>
 /// Handler raises event about new object was created.
 /// </summary>
 /// <param name="sender">View sender.</param>
 /// <param name="e">Event args.</param>
 private void _ScheduleViewsEditingManagerNewObjectCreated(object sender, DataObjectEventArgs e)
 {
     // Raise event about new object was created.
     if (NewObjectCreated != null)
         NewObjectCreated(this, e);
 }
 /// <summary>
 /// Handler raises event about edit begun.
 /// </summary>
 /// <param name="sender">View sender.</param>
 /// <param name="e">Event args.</param>
 private void _ScheduleViewsEditingManagerEditBegun(object sender, DataObjectEventArgs e)
 {
     // Raise event about editing was started.
     if (EditBegun != null)
         EditBegun(this, e);
 }
 /// <summary>
 /// Hndler raises event about editing was commited.
 /// </summary>
 /// <param name="sender">View sender.</param>
 /// <param name="e">Event args.</param>
 private void _ScheduleViewsEditingManagerEditCommitted(object sender, DataObjectEventArgs e)
 {
     // Raise event about editing was commited.
     if (EditCommitted != null)
         EditCommitted(this, e);
 }
        /// <summary>
        /// Raises event about new item was cancelled.
        /// </summary>
        /// <param name="sender">Data grid control sender.</param>
        /// <param name="e">Item event args.</param>
        private void _DataGridCollectionViewSourceNewItemCanceled(object sender,
                                                                  DataGridItemEventArgs e)
        {
            var args = new DataObjectEventArgs((AppData.DataObject)e.Item);
            if (NewObjectCanceled != null)
                NewObjectCanceled(this, args);

            IsEditingInProgress = false;
            _SetSelectionStatus(((ICollection<Barrier>)e.CollectionView.SourceCollection).Count);
        }
        /// <summary>
        /// Handler raise event about Editing was commited.
        /// </summary>
        /// <param name="sender">Data grid control sender.</param>
        /// <param name="e">Item event args.</param>
        private void _DataGridCollectionViewSourceEditCommitted(object sender,
                                                                DataGridItemEventArgs e)
        {
            BarriersDayStatusesManager.Instance.OnBarrierChanged();

            DataObjectEventArgs args = new DataObjectEventArgs((AppData.DataObject)e.Item);
            if (EditCommitted != null)
                EditCommitted(this, args);
        }
        /// <summary>
        /// Handler raises event about editing was cancelled.
        /// </summary>
        /// <param name="sender">Data grid control sender.</param>
        /// <param name="e">Item event args.</param>
        private void _DataGridCollectionViewSourceEditCanceled(object sender,
                                                               DataGridItemEventArgs e)
        {
            DataObjectEventArgs args = new DataObjectEventArgs((AppData.DataObject)e.Item);
            if (EditCanceled != null)
                EditCanceled(this, args);

            _regionsPage.OnEditCanceled(e);
            _SetSelectionStatus(((ICollection<Barrier>)e.CollectionView.SourceCollection).Count);
        }
 /// <summary>
 /// Handler raises event about editing was started.
 /// </summary>
 /// <param name="sender">Data grid control sender.</param>
 /// <param name="e">Item event args.</param>
 private void _DataGridCollectionViewSourceEditBegun(object sender, DataGridItemEventArgs e)
 {
     DataObjectEventArgs args = new DataObjectEventArgs((AppData.DataObject)e.Item);
     if (EditBegun != null)
         EditBegun(this, args);
 }
 private void OnPaste(object sender, DataObjectEventArgs e)
 {
     ((System.Windows.DataObjectPastingEventArgs)(e)).FormatToApply = "Text";
 }
        /// <summary>
        /// Handler raises event about edit was cancelled.
        /// </summary>
        /// <param name="sender">View sender.</param>
        /// <param name="e">Event args.</param>
        private void _ScheduleViewsEditingManagerEditCanceled(object sender, DataObjectEventArgs e)
        {
            IsEditingInProgress = false;

            // Raise event about edit was cancelled.
            if (EditCanceled != null)
                EditCanceled(this, new DataObjectEventArgs(e.Object));
        }
 private void MySettingDataCommand(object sender, DataObjectEventArgs e)
 {
     //do stuff
 }
        /// <summary>
        /// Handler raises event about new object was cancelled.
        /// </summary>
        /// <param name="sender">View sender.</param>
        /// <param name="e">Event args.</param>
        private void _ScheduleViewsEditingManagerNewObjectCanceled(object sender, DataObjectEventArgs e)
        {
            IsEditingInProgress = false;

            // Raise event about new object was cancelled.
            if (NewObjectCanceled != null)
                NewObjectCanceled(this, e);
        }
 private void MyCopyCommand(object sender, DataObjectEventArgs e)
 {
     //do stuff
 }
 private void _schedulePage_EditCommitted(object sender, DataObjectEventArgs e)
 {
     _CheckEnabled();
 }
Beispiel #27
0
 private void OnCancelCommand(object sender, DataObjectEventArgs e)
 {
     e.CancelCommand();
     Console.WriteLine("Canceled", e);
 }
 private void OnCancelCommand(object sender, DataObjectEventArgs e)
 {
     e.CancelCommand();
 }
Beispiel #29
0
 private void ParentPage_EditBegun(object sender, DataObjectEventArgs e)
 {
     _CheckEnabled();
 }
Beispiel #30
0
 private void PastingEventHandler(object sender, DataObjectEventArgs e)
 {
     // Prevent/disable paste
     e.CancelCommand();
 }
 private void _optimizePage_NewObjectCreated(object sender, DataObjectEventArgs e)
 {
     _CheckEnabled();
 }
        private void DataGridCollectionViewSource_EditCanceled(object sender, Xceed.Wpf.DataGrid.DataGridItemEventArgs e)
        {
            DataObjectEventArgs args = new DataObjectEventArgs((ESRI.ArcLogistics.Data.DataObject)e.Item);
            if (EditCanceled != null)
                EditCanceled(this, args);

            _regionsPage.OnEditCanceled(e);
            _SetSelectionStatus();
        }
Beispiel #33
0
 private void CopyCommand(object sender, DataObjectEventArgs e)
 {
     e.Handled = true;
     e.CancelCommand();
     Clipboard.SetText(Text);
 }
        /// <summary>
        /// Handler raises event about new item was created and invoking changing name of zone.
        /// </summary>
        /// <param name="sender">Data grid control sender.</param>
        /// <param name="e">Item event args.</param>
        private void _DataGridCollectionViewSourceNewItemCreated(object sender,
                                                                 DataGridItemEventArgs e)
        {
            // Invoking changing of the item's name. Those method must be invoked, otherwise
            // grid will not understand that item in insertion ro was changed and grid wouldnt allow
            // to commit this item.
            Dispatcher.BeginInvoke(new ParamsDelegate(_ChangeName),
                System.Windows.Threading.DispatcherPriority.DataBind, e);

            DataObjectEventArgs args = new DataObjectEventArgs((ESRI.ArcLogistics.Data.DataObject)e.Item);
            if (NewObjectCreated != null)
                NewObjectCreated(this, args);
        }
 public void OnDataContextChanged(DataObjectEventArgs sender, DependencyPropertyChangedEventArgs Args)
 {
     //MountEventListener();
 }
 /// <summary>
 /// Checks whether command is enabled when editing cancelled.
 /// </summary>
 /// <param name="sender">OptimizeAndEdit page.</param>
 /// <param name="e">Event args.</param>
 private void _SchedulePageEditCanceled(object sender, DataObjectEventArgs e)
 {
     _CheckEnabled();
 }
Beispiel #37
0
 private void _CheckEnabled(object sender, DataObjectEventArgs e)
 {
     _CheckEnabled();
 }
Beispiel #38
0
 private void _optimizePage_EditBegun(object sender, DataObjectEventArgs e)
 {
     _CheckEnabled();
 }
        private void DataGridCollectionViewSource_NewItemCanceled(object sender, Xceed.Wpf.DataGrid.DataGridItemEventArgs e)
        {
            DataObjectEventArgs args = new DataObjectEventArgs((ESRI.ArcLogistics.Data.DataObject)e.Item);
            if (NewObjectCanceled != null)
                NewObjectCanceled(this, args);

            _geocodablePage.OnNewItemCancelling();
            _SetSelectionStatus();
        }