Example #1
0
 /// <summary>
 /// Clear view.
 /// </summary>
 protected void Clear()
 {
     if (!Disposed && Control != null)
     {
         Control.Clear();
     }
 }
Example #2
0
        private void UpdateEntireTable()
        {
            Control.Clear();

            if (Data.Items.Count == 0)
            {
                Control.AddColumn("Inventory Empty");
            }
            else
            {
                // setup the columns
                Control.AddColumns(new string[] { "Item", "Amount", "Status" });
                Control.Columns[2].ToolTip = new ToolTip(Manager)
                {
                    Text = "Is the item available for use by other\nbuildings or reserved for this building?"
                };

                foreach (InventoryData item in Data.Items.Values)
                {
                    TableRow currentRow = Control.AddRow();
                    currentRow.Tag = item;

                    string name = ((Item)World.Prototypes[item.Item]).Name;
                    Control.AddAt(0, Control.RowsCount - 1, name);
                    Control.AddAt(1, Control.RowsCount - 1, item.Amount.ToString());

                    string status = (item.Output) ? "Available" : (item.Input) ? "Reserved" : "";

                    Control.AddAt(2, Control.RowsCount - 1, status);
                }
            }
        }
Example #3
0
 private void OnMessageClear(SketchView sender)
 {
     if (this.Element == sender)
     {
         Control.Clear();
     }
 }
Example #4
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == ImageWithTouch.ClearImagePathProperty.PropertyName)
            {
                Control.Clear();
            }
            else if (e.PropertyName == ImageWithTouch.SavedImagePathProperty.PropertyName)
            {
                Bitmap curDrawingImage = Control.GetImageFromView();

                Byte[] imgBytes = ImageHelper.BitmapToBytes(curDrawingImage);
                var    f        = new File(Element.SavedImagePath);

                f.CreateNewFile();

                FileOutputStream fo = new FileOutputStream(f);
                fo.Write(imgBytes);

                fo.Close();
            }
            else
            {
                UpdateControl(true);
            }
        }
Example #5
0
 public void Clear()
 {
     Control.Clear();
     targets = new Gtk.TargetList();
     clipboard.Clear();
     Update();
 }
        private void UpdateText(object sender, EventArgs e)
        {
            Control.Clear();
            Control.AppendText("View: \t");
            Control.AppendText(View);
            Control.AppendText("\n");

            Control.AppendText("BitRate: \t");
            Control.AppendText(BitRate);
            Control.AppendText(" bytes/second");
            Control.AppendText("\n");

            Control.AppendText("Connection Status: \t");
            if (ConnectionStatus)
            {
                Control.AppendText("Connected\n");
            }
            else
            {
                Control.AppendText("Not Connected\n");
            }

            Control.AppendText("Server IP: \t");
            Control.AppendText(IP);

            Control.AppendText("\n\n");
            Control.AppendText("Warnings:\n");
            Control.AppendText(Warnings);
        }
 private void OnMessageClear(SketchView sender)
 {
     if (sender == Element)
     {
         Control.Clear();
     }
 }
 void OnMessageClear(XamarinIntro.Views.SketchView sender)
 {
     if (sender == Element)
     {
         Control.Clear();
     }
 }
Example #9
0
        public PaintViewRenderer(Context context) : base(context)
        {
            _context = context;
            SetWillNotDraw(false);

            MessagingCenter.Subscribe <ViewModelBase, string>(this, "clear", (sender, args) =>
            {
                if (Control != null)
                {
                    if (Control.Tag.ToString() == args)
                    {
                        Control.Clear();
                    }
                }
            });
            MessagingCenter.Subscribe <ViewModelBase, string>(this, "save", (sender, args) =>
            {
                if (Control != null)
                {
                    if (Control.Tag.ToString() == args)
                    {
                        Control.Save(args);
                    }
                }
            });
        }
 /// <summary>
 /// Updates the source.
 /// </summary>
 void UpdateSource()
 {
     Control.Clear();
     UpdateHeader(false);
     Control.AddSource(Element.TemplatedItems);
     UpdateFooter(false);
     UpdateSelectedItem();
 }
Example #11
0
 void UpdateSource(bool init)
 {
     if (!init)
     {
         Control.Clear();
     }
     Control.AddSource(Element.TemplatedItems);
     UpdateSelectedItem();
 }
Example #12
0
 public void Clear(SolidBrush brush)
 {
     if (brush != null)
     {
         Control.Clear(brush.Color.ToSD());
     }
     else
     {
         Control.Clear(sd.Color.Transparent);
     }
 }
Example #13
0
 protected override void ApplyModelCore()
 {
     if (Model.Any(label => label.NodeEnabled))
     {
         Control.Clear();
         foreach (var modelAppoitmentStatus in Model)
         {
             var appointmentLabel = Control.CreateNewStatus(null);
             Control.Add(appointmentLabel);
             ApplyModel(modelAppoitmentStatus, appointmentLabel, ApplyValues);
         }
     }
 }
Example #14
0
 protected override void ApplyModelCore()
 {
     if (Model.Any(label => label.NodeEnabled))
     {
         Control.Clear();
         foreach (var modelAppoitmentStatus in Model)
         {
             Control.Add(modelAppoitmentStatus.GetValue <Color>("Color"),
                         modelAppoitmentStatus.GetValue <string>("DisplayName"),
                         modelAppoitmentStatus.GetValue <string>("MenuCaption"));
         }
     }
 }
Example #15
0
        public void Clear(SolidBrush brush)
        {
            // TODO: doesn't actually clear to transparent (e.g. on a bitmap)
            var rect = new s.RectangleF(0, 0, Control.PixelSize.Width, Control.PixelSize.Height);

            if (brush != null)
            {
                Control.Clear(brush.Color.ToDx());
            }
            else
            {
                Control.Clear(s.Color4.Black);
            }
        }
Example #16
0
        private void UpdateText(object sender, EventArgs e)
        {
            Console.WriteLine("A field was changed...");
            Control.Clear();
            Control.AppendText("View: \t");
            Control.AppendText(View);
            Control.AppendText("\n");

            Control.AppendText("BitRate: \t");
            Control.AppendText(BitRate);
            Control.AppendText("\n");

            Control.AppendText("\n");
            Control.AppendText("Warnings:\n");
            Control.AppendText(Warnings);
        }
Example #17
0
        /// <summary>
        /// Handles the <see cref="E:ElementPropertyChanged" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                base.OnElementPropertyChanged(sender, e);

                if (e.PropertyName == ImageWithTouch.ClearImagePathProperty.PropertyName)
                {
                    Control.Clear();
                }
                else if (e.PropertyName == ImageWithTouch.SavedImagePathProperty.PropertyName)
                {
                    UIImage curDrawingImage = Control.GetImageFromView();
                    NSData  data            = curDrawingImage.AsPNG();
                    NSError error;
                    data.Save(Element.SavedImagePath, true, out error);
                }
                else if (e.PropertyName == ImageWithTouch.EraseImagePathProperty.PropertyName)
                {
                    Control.Erase();
                }
                else
                {
                    UpdateControl(e.PropertyName == ImageWithTouch.CurrentLineColorProperty.PropertyName ||
                                  e.PropertyName == ImageWithTouch.CurrentImageProperty.PropertyName ||
                                  e.PropertyName == ImageWithTouch.CurrentLineWidthProperty.PropertyName);
                }
                if (e.PropertyName == ImageWithTouch.UndoImagePathProperty.PropertyName)
                {
                    Control.OnClickUndo();
                }
                if (e.PropertyName == ImageWithTouch.RedoImagePathProperty.PropertyName)
                {
                    Control.OnClickRedo();
                }

                if (e.PropertyName == ImageWithTouch.CurrentLineColorProperty.PropertyName)
                {
                    UpdateControl(true);
                }
            }
            catch (Exception exception)
            {
                //LoggingManager.Error(exception);
            }
        }
Example #18
0
        /// <summary>
        /// Updates the source.
        /// </summary>
        void UpdateSource()
        {
            bool hasHeader = Control.HasHeader();
            bool hasFooter = Control.HasFooter();

            Control.Clear();
            Control.AddSource(Element.TemplatedItems);
            UpdateSelectedItem();

            if (hasHeader)
            {
                UpdateHeader();
            }
            if (hasFooter)
            {
                UpdateFooter();
            }
        }
Example #19
0
 /// <summary>
 /// Clear all of the layers to their default values (by default), or specific layers with specific values if desired. This locks, then unlocks the bitmaps.
 /// </summary>
 /// <param name="visualValue">What to clear the visual map to if Layer.Visual is included in mask.</param>
 /// <param name="priorityValue">What to clear the priority map to if Layer.Priority is included in mask.</param>
 /// <param name="controlValue">What to clear the control map to if Layer.Control is included in mask.</param>
 /// <param name="auxiliaryValue">What to clear the auxiliary map to if Layer.Auxiliary is included in mask.</param>
 /// <param name="mask"></param>
 public virtual void Clear(byte visualValue = 15, byte priorityValue = 0, byte controlValue = 0, byte auxiliaryValue = 0, PictureLayer mask = PictureLayer.All)
 {
     Lock();
     if ((mask & PictureLayer.Visual) != 0)
     {
         Visual.Clear(visualValue);
     }
     if ((mask & PictureLayer.Priority) != 0)
     {
         Priority.Clear(priorityValue);
     }
     if ((mask & PictureLayer.Control) != 0)
     {
         Control.Clear(controlValue);
     }
     if ((mask & PictureLayer.Auxiliary) != 0)
     {
         Auxiliary.Clear(auxiliaryValue);
     }
     Unlock();
 }
Example #20
0
        private void UpdateText(object sender, EventArgs e)
        {
            Control.Clear();
            string text = String.Format("{0,35} {1,35}", "Red Team", "Blue Team\n");

            text += String.Format("{0,-18} {1,13} {2,40}\n", "UAV Position:", RedUAVXY, BlueUAVXY);
            text += String.Format("{0,-18} {1,14} {2,40}\n", "Tank Position:", RedTankXY, BlueTankXY);
            text += String.Format("{0,-18} {1,18} {2,42}\n", "Missiles Left:", RedMissilesRemaining, BlueMissilesRemaining);
            text += String.Format("{0,-18} {1,10} {2,40}\n\n", "Enemy Last Seen:", LastKnownBlueTankXY, LastKnownRedTankXY);
            text += String.Format("Game #{0}\n", GamesRun);
            text += String.Format("Turns Elapsed: {0}\n", TurnsElapsed);
            if (GamesRun <= 1)
            {
                text += String.Format("Red Win: {0,10}%\t{1,10}{2,10}%\n", "0", "Blue Win: ", "0");
            }
            else
            {
                text += String.Format("Red Win: {0,10}%\t{1,10}{2,10}%\n", WinPercent, "Blue Win: ", (100 - WinPercent));
            }
            text += String.Format("\nWarnings:\n{0}", Warnings);
            Control.AppendText(text);
        }
Example #21
0
        private void UpdateText(object sender, EventArgs e)
        {
            Control.Clear();
            string text = String.Format("{0,35}", "State Information\n");

            text += String.Format("{0,-18} {1,13}\n", "UAV Position:", MyUAVXY);
            text += String.Format("{0,-18} {1,14}\n", "Tank Position:", MyTankXY);
            text += String.Format("{0,-18} {1,18}\n", "Missiles Left:", MyMissilesRemaining);
            text += String.Format("{0,-18} {1,10}\n\n", "Enemy Last Seen:", LastKnownEnemyTankXY);
            text += String.Format("Game #{0}\n", GamesRun);
            text += String.Format("Turns Elapsed: {0}\n", TurnsElapsed);
            if (GamesRun <= 1)
            {
                text += String.Format("Win Percent: {0,10}%\n", "0");
            }
            else
            {
                text += String.Format("Win Percent: {0,10}%\n", WinPercent);
            }
            text += String.Format("\nWarnings:\n{0}", Warnings);
            Control.AppendText(text);
        }
Example #22
0
        public void GameReset()
        {
            Control.Clear();
            var zeroPosition = new Position(0, 0);

            redUAVXY            = zeroPosition;
            blueUAVXY           = zeroPosition;
            redTankXY           = zeroPosition;
            blueTankXY          = zeroPosition;
            lastKnownRedTankXY  = zeroPosition;
            lastKnownBlueTankXY = zeroPosition;

            redMissilesRemaining  = 0;
            blueMissilesRemaining = 0;
            turnsElapsed          = 0;
            winPercent            = 0;
            warnings = "";

            EventArgs args = new EventArgs();

            OnPropertyChanged(args);
        }
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == ImageWithTouch.ClearImagePathProperty.PropertyName)
            {
                Control.Clear();
            }
            else if (e.PropertyName == ImageWithTouch.SavedImagePathProperty.PropertyName)
            {
                UIImage curDrawingImage = Control.GetImageFromView();
                NSData  data            = curDrawingImage.AsJPEG();
                NSError error           = new NSError();
                bool    bSuccess        = data.Save(Element.SavedImagePath, true, out error);
            }
            else
            {
                UpdateControl(e.PropertyName == ImageWithTouch.CurrentLineColorProperty.PropertyName ||
                              e.PropertyName == ImageWithTouch.CurrentImageProperty.PropertyName ||
                              e.PropertyName == ImageWithTouch.CurrentLineWidthProperty.PropertyName);
            }
        }
        void UpdateItemsSource()
        {
            Control.Clear();
            _gengridItemDic.Clear();
            _itemHandleDic.Clear();
            _itemList.Clear();

            if (_collectionChanged != null)
            {
                _collectionChanged.CollectionChanged -= OnCollectionChanged;
                _collectionChanged = null;
            }

            if (Element.ItemsSource == null)
            {
                return;
            }

            foreach (var item in Element.ItemsSource)
            {
                var context = new GengridItemContext
                {
                    Data         = item,
                    RealizedView = null,
                };
                var    gridItem = Control.Append(_gridItemClass, context);
                IntPtr handle   = gridItem;
                _itemHandleDic.Add(handle, gridItem);
                _gengridItemDic.Add(item, gridItem);
                _itemList.Add(item);
            }

            if (Element.ItemsSource is INotifyCollectionChanged collection)
            {
                _collectionChanged            = collection;
                collection.CollectionChanged += OnCollectionChanged;
            }
        }
Example #25
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == ImageWithTouch.ClearImagePathProperty.PropertyName)
            {
                Control.IsImageCleared = true;
                Control.Clear();
            }
            else if (e.PropertyName == ImageWithTouch.BackgroundImagePathProperty.PropertyName)
            {
                Control.LoadBackgroundImage(Element.BackgroundImagePath, Element.Width, Element.Height);
            }
            else if (e.PropertyName == ImageWithTouch.SavedImagePathProperty.PropertyName)
            {
                Bitmap curDrawingImage = Control.GetImageFromView();

                if (curDrawingImage != null)
                {
                    Control.IsImageCleared = false;

                    Byte[]       imgBytes = ImageHelper.BitmapToBytes(curDrawingImage);
                    Java.IO.File f        = new Java.IO.File(Element.SavedImagePath);

                    f.CreateNewFile();

                    FileOutputStream fo = new FileOutputStream(f);
                    fo.Write(imgBytes);

                    fo.Close();
                }
            }
            else
            {
                UpdateControl(true);
            }
        }
Example #26
0
 /// <summary>
 /// Updates the source.
 /// </summary>
 void UpdateSource()
 {
     Control.Clear();
     Control.AddSource(Element.TemplatedItems);
     UpdateSelectedItem();
 }
        public static void Init(IConfig controlConfig, UUID godID, Control control, IPrimFactory factory)
        {
            factory.AddLinkSetRoot(factory.Host.ID);

            string userFolder = controlConfig.Get("UserFolder", ".");
            string godName = controlConfig.GetString(GOD_KEY, GOD);
            string sequenceFolder = controlConfig.Get("SequenceFolder", ".");
            string sequence = controlConfig.GetString(SEQUENCE_KEY);

            if (sequence == null) {
                control.HostPrim.Say("Unable to start sequence control. No sequence file specified.");
                throw new Exception("Unable to start sequence control. No sequence file specified.");
            }
            string location = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.Combine(userFolder, Path.Combine(godName, Path.Combine(sequenceFolder, sequence))));
            if (!File.Exists(location)) {
                control.HostPrim.Say("Unable to start sequence control. Sequence File '" + location + "' does not exist.");
                throw new Exception("Unable to start sequence control. Sequence File '" + location + "' does not exist.");
            }

            IButton PlayButton = control.MakeButton("Play");
            IButton PauseButton = control.MakeButton("Pause");
            IButton StopButton = control.MakeButton("Stop");
            IButton StepButton = control.MakeButton("Step");
            IToggle PauseToggle = new Toggle(PauseButton, 1, control.ToggleGlow);

            foreach (var pause in PauseToggle.Prims)
                pause.Colour = Color.White;

            PlayButton.OnTouched += (source, args) => {
                if (!control.Record.PlayingSequence) {
                    control.Clear(godName, godID);
                    control.Record.PlayRecording(godName, godID, sequence);
                }
            };
            StopButton.OnTouched += (source, args) => {
                control.Record.StopPlayback();
                control.Clear(godName, godID);
                control.HostPrim.Say("Stopped playback.");
            };
            PauseToggle.OnToggled += (source, args) => {
                control.Record.Paused = PauseToggle.IsOn;
                foreach (var prim in PauseToggle.Prims) {
                    prim.Glow = PauseToggle.IsOn ? .1d : 0d;
                    prim.Colour = Color.White;
                }
            };
            StepButton.OnTouched += (source, args) => {
                if (!control.Model.Step() && control.Record.PlayingSequence)
                    control.Record.PlayNextEvent();
            };
        }
Example #28
0
        private void UpdateText(object sender, EventArgs e)
        {
            Console.WriteLine("A field was changed...");
            Control.Clear();
            Control.AppendText("\t\tRed Team\t\tBlue Team\n");
            Control.AppendText("UAV Position:\t");
            Control.AppendText(RedUAVXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(RedUAVXY.Y.ToString());
            Control.AppendText("\t\t\t");
            Control.AppendText(BlueUAVXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(BlueUAVXY.Y.ToString());
            Control.AppendText("\n");

            Control.AppendText("Tank Position:\t");
            Control.AppendText(RedTankXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(RedTankXY.Y.ToString());
            Control.AppendText("\t\t\t");
            Control.AppendText(BlueTankXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(BlueTankXY.Y.ToString());
            Control.AppendText("\n");

            Control.AppendText("Missile Position:\t");
            Control.AppendText(RedMissileXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(RedMissileXY.Y.ToString());
            Control.AppendText("\t\t\t");
            Control.AppendText(BlueMissileXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(BlueMissileXY.Y.ToString());
            Control.AppendText("\n");

            Control.AppendText("Missiles Left:\t");
            Control.AppendText(RedMissilesRemaining.ToString());
            Control.AppendText("\t\t\t");
            Control.AppendText(BlueMissilesRemaining.ToString());
            Control.AppendText("\n");

            Control.AppendText("Enemy Last Seen:\t0,0\t\t\t0,0\n");
            Control.AppendText("Enemy Last Seen:\t");
            Control.AppendText(LastKnownBlueTankXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(LastKnownBlueTankXY.Y.ToString());
            Control.AppendText("\t\t\t");
            Control.AppendText(lastKnownRedTankXY.X.ToString());
            Control.AppendText(",");
            Control.AppendText(lastKnownRedTankXY.Y.ToString());
            Control.AppendText("\n");

            Control.AppendText("\n");
            Control.AppendText("Game #");
            Control.AppendText(GamesRun.ToString());
            Control.AppendText("\n");

            Control.AppendText("Turns Elapsed: ");
            Control.AppendText(TurnsElapsed.ToString());
            Control.AppendText("\n");

            Control.AppendText("Red Win %: ");
            Control.AppendText(WinPercent.ToString());
            Control.AppendText("%\t\t Blue Win %: ");
            Control.AppendText((100 - WinPercent).ToString());
            Control.AppendText("%\n");

            Control.AppendText("\n");
            Control.AppendText("Warnings:\n");
            Control.AppendText(Warnings);
        }
Example #29
0
 private void ClearImage(object sender, EventArgs e)
 {
     Control.Clear();
 }
Example #30
0
 public void Clear()
 {
     Control.Clear();
     clipboard.Clear();
 }
Example #31
0
 public void Clear()
 {
     Control.Clear();
 }