Ejemplo n.º 1
0
 protected virtual void OnDeleteAll(GumpButton button)
 {
     if (UseConfirmDialog)
     {
         Send(
             new ConfirmDialogGump(
                 User,
                 this,
                 title: "Delete All Entries?",
                 html:
                 "All entries in the " + Restrictions +
                 " will be deleted, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                 onAccept: subButton =>
         {
             Restrictions.Clear();
             Refresh(true);
         },
                 onCancel: b => Refresh(true)));
     }
     else
     {
         Restrictions.Clear();
         Refresh(true);
     }
 }
Ejemplo n.º 2
0
        public override void Clear()
        {
            Restrictions.Clear();
            Rules.Clear();
            Sounds.Clear();

            PetGiveDamageScalar = DefPetGiveDamageScalar;
            PetTakeDamageScalar = DefPetTakeDamageScalar;
        }
Ejemplo n.º 3
0
 public override void Clear()
 {
     Broadcasts.Clear();
     Locations.Clear();
     Restrictions.Clear();
     Rewards.Clear();
     Rules.Clear();
     Sounds.Clear();
     SuddenDeath.Clear();
     Timing.Clear();
     Weather.Clear();
 }
Ejemplo n.º 4
0
 protected virtual void OnDeleteAll(GumpButton button)
 {
     if (UseConfirmDialog)
     {
         new ConfirmDialogGump(User, this)
         {
             Title = "Delete All Entries?",
             Html  = "All entries in the " + Restrictions + " will be deleted, erasing all data associated with them.\n" +
                     "This action can not be undone.\n\nDo you want to continue?",
             AcceptHandler = b =>
             {
                 Restrictions.Clear();
                 Refresh(true);
             },
             CancelHandler = Refresh
         }.Send();
     }
     else
     {
         Restrictions.Clear();
         Refresh(true);
     }
 }
Ejemplo n.º 5
0
        private void OnLineGraphsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
            {
                foreach (GraphModel viewModel in e.NewItems)
                {
                    LineGraph lineGraph = this.AddLineGraph(viewModel.PointDataSource, viewModel.Color, 1, viewModel.Name);
                    lineGraph.Name = viewModel.Name;
                    lineGraphLines.Add(lineGraph);
                }
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
            {
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
            {
                foreach (var oldItem in e.OldItems)
                {
                    foreach (LineGraph line in lineGraphLines)
                    {
                        if (((GraphModel)oldItem).Name == line.Name)
                        {
                            Children.Remove(line);
                            lineGraphLines.Remove(line);
                        }
                    }
                }
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
            {
                bool bTemp = false;
                foreach (GraphModel viewModel in e.NewItems)
                {
                    foreach (LineGraph line in lineGraphLines)
                    {
                        if (Children.Contains(line) && line.Name == viewModel.Name)
                        {
                            Children.Remove(line);
                            lineGraphLines.Remove(line);
                            bTemp = true;
                            break;
                        }
                    }

                    if (bTemp)
                    {
                        LineGraph lineGraph = this.AddLineGraph(viewModel.PointDataSource, viewModel.Color, 1, viewModel.Name);
                        lineGraph.Name = viewModel.Name;
                        lineGraphLines.Add(lineGraph);
                        bTemp = false;
                    }
                }
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
            {
                Restrictions.Clear();
                Children.RemoveAll(typeof(LineGraph));
                lineGraphLines.Clear();
                break;
            }
            }

            double min = double.MaxValue, max = double.MinValue;

            foreach (var graphModel in LineGraphs)
            {
                if (graphModel.MaxValue > max)
                {
                    max = graphModel.MaxValue;
                }
                if (graphModel.MinValue < min)
                {
                    min = graphModel.MinValue;
                }
            }

            Restrictions.Clear();

            if (min != double.MaxValue && max != double.MinValue && max > min)
            {
                Restrictions.Add(new ViewportAxesRangeRestriction {
                    YRange = new DisplayRange(min, max)
                });
            }
            //Viewport.FitToView();
            Viewport.Visible = new DataRect(new DateTimeAxis().ConvertToDouble(DateTime.Now.AddHours(-23)), 0, new DateTimeAxis().ConvertToDouble(DateTime.MinValue.AddHours(23.5)), 100);
        }