Example #1
0
        /// <summary>
        /// Don't allow users to choose WBS items
        /// </summary>
        public void lookupActivity_EditValueChanging(EditValueChangingEventArgs e)
        {
            TASK_AppointmentInfo changingValue = (TASK_AppointmentInfo)e.NewValue;

            if (changingValue.Status != AppointmentActivityType.Activity)
            {
                e.IsCancel = true;
                e.Handled  = true;
            }
        }
        private void ExecuteRemoveDivision(EditValueChangingEventArgs e)
        {
            var removingItem = ExtractRemovingItem(e);

            if (removingItem != null && removingItem.Name.Contains("METAL 2"))
            {
                e.IsCancel = true;
                e.Handled  = true;
                DXMessageBox.Show($"Sorry cannot delete {removingItem.Name} already scheduled", Title, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Example #3
0
        void LayoutGroupHeaderTextEdit_EditValueChanging(object sender, EditValueChangingEventArgs e)
        {
            var textBox     = (TextEdit)sender;
            var layoutGroup = textBox.DataContext as LayoutGroup;

            if (layoutGroup == null)
            {
                return;
            }
            if (textBox.EditValue != null && object.Equals(textBox.EditValue, e.NewValue) &&
                !((LayoutGroup)layoutGroup.Parent).View.Equals(LayoutGroupView.Tabs))
            {
                layoutGroup.View = LayoutGroupView.GroupBox;
            }
        }
        /// <summary>
        /// OnOddsEditValueChanging
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="eventArgs"></param>
        private void OnOddsEditValueChanging(object sender, EditValueChangingEventArgs eventArgs)
        {
            var tePrice = sender as SpinEdit;

            double newOdds = Convert.ToDouble(eventArgs.NewValue);
            double odds    = oddsContext.GetValidOdds(newOdds);

            tePrice.Increment = (decimal)oddsContext.OddsRange.Increment;

            if (odds != newOdds)
            {
                eventArgs.IsCancel = true;
                tePrice.EditValue  = (decimal)odds;
            }
        }
        private LookupItem ExtractRemovingItem(EditValueChangingEventArgs e)
        {
            if (e.OldValue != null && e.OldValue is List <object> old_Items)
            {
                if (e.NewValue == null)
                {
                    return(old_Items.SingleOrDefault() as LookupItem);
                }

                if (e.NewValue is List <object> new_items)
                {
                    var removingItem = old_Items?.Except(new_items).SingleOrDefault() as LookupItem;
                    return(removingItem);
                }
            }
            return(null);
        }
Example #6
0
        private void editor_EditValueChanging(object sender, EditValueChangingEventArgs e)
        {
            if (e.NewValue != null && ((DateTime)e.NewValue).Date > DateTime.Now.Date)
            {
                MessageBox.Show("Future date is not allowed", "Info", MessageBoxButton.OK, MessageBoxImage.Warning);
                e.IsCancel = true;
                e.Handled = true;
                return;
            }

            StringBuilder sb = new StringBuilder();
            foreach (var item in ViewModelService.Context.Collection)
            {
                if (item.Value.HasChanges())
                {
                    sb.AppendLine(item.Value.Description);
                }
            }

            if (sb.Length > 0)
            {
                var result = MessageBox.Show("Your have changes which have not been saved on the following screens : " + sb.ToString() + " Do you want to continue?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (result != MessageBoxResult.Yes)
                {
                    e.IsCancel = true;
                    e.Handled = true;
                }
            }
        }
        private void BaseEdit_OnEditValueChanging(object sender, EditValueChangingEventArgs e)
        {
            //var oldItems = e.OldValue as List<object>;
            //var newItems = e.NewValue as List<object>;

            //if (oldItems?.Count > 0)
            //{
            //    if (newItems == null)
            //    {

            //    }
            //    var removingItem = oldItems?.Except(newItems).Single();

            //    if (removingItem is LookupItem item)
            //    {
            //        e.IsCancel = item.Name.Contains("METAL");
            //        e.Handled = true;
            //    }
            //}

            //if (e.OldValue != null)
            //{
            //    Debug.WriteLine("======================Old Items==================");
            //    if (e.OldValue is List<object> oldItems)
            //    {
            //        foreach (var oldItem in oldItems)
            //        {
            //            if (oldItem is LookupItem item)
            //            {
            //                Debug.WriteLine(item.Name);
            //            }
            //        }
            //    }

            //    Debug.WriteLine("================================================");
            //}


            //if (e.NewValue != null)
            //{
            //    Debug.WriteLine("======================New Items==================");
            //    if (e.NewValue is List<object> newItems)
            //    {
            //        foreach (var newItem in newItems)
            //        {
            //            if (newItem is LookupItem item)
            //            {
            //                Debug.WriteLine(item.Name);
            //            }
            //        }
            //    }

            //    Debug.WriteLine("================================================");
            //}



            if (e.OldValue != null && e.OldValue is List <object> old_Items)
            {
                if (e.NewValue == null)
                {
                    Debug.WriteLine("===================Removing Item===================");
                    var removingItem = old_Items.SingleOrDefault() as LookupItem;
                    if (removingItem != null)
                    {
                        Debug.WriteLine("===================Removing Item===================");
                        Debug.WriteLine(removingItem.Name);
                    }
                }
                else
                {
                    if (e.NewValue is List <object> new_items)
                    {
                        var removingItem = old_Items?.Except(new_items).SingleOrDefault() as LookupItem;
                        if (removingItem != null)
                        {
                            Debug.WriteLine("===================Removing Item===================");
                            Debug.WriteLine(removingItem.Name);
                        }
                    }
                }
            }
            //var removingItem = oldItems?.Except(newItems).Single();

            //if (removingItem is LookupItem item)
            //{
            //    e.IsCancel = item.Name.Contains("METAL");
            //    e.Handled = true;
            //}
        }
        private void TrackBarEdit1EditValueChanging(object sender, EditValueChangingEventArgs e)
        {
            if (e.NewValue == null) return;

            TrackBarSort(Convert.ToInt32(e.NewValue));
        }