public void execute()
 {
     LocationSource locationSource = LocationSourceManager.Instance.createLocationSource("LocationSource" + LocationSourceManager.Instance.LocationSources.Count, new DummyDiscriminator());
     //user.Discri = new ColorDiscriminator();
     LocationSourcePlayer locationSourcePlayer = null;
     try
     {
         locationSourcePlayer = new LocationSourcePlayer(locationSource, path);
     }
     catch (XmlException)
     {
         LocationSourceManager.Instance.deleteLocationSource(locationSource);
         System.Windows.Forms.MessageBox.Show("There is an error in your XML file. ", "Format Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
         return;
     }
     MapOverlayForm.Instance.AddUserMarker(locationSource.mapMarker);
     locationSource.Attach(locationSource.mapMarker);
     LocationSourceTrackForm locationSourceView = new LocationSourceTrackForm(locationSource, userListContainer, locationSourcePlayer);
 }
        public LocationSourceTrackForm(LocationSource locationSource, Panel parent, LocationSourcePlayer locationSourcePlayer)
        {
            this.locationSource = locationSource;
            this.parent = parent;
            this.locationSourcePlayer = locationSourcePlayer;

            this.container = new GroupBox();
            this.container.Width = this.parent.Width - 25;
            this.container.Height = 132;
            parent.Controls.Add(container);

            Label nameLabel = new Label();
            nameLabel.Text = "Name:";
            nameLabel.Location = new System.Drawing.Point(5, 14);
            nameLabel.AutoSize = true;
            container.Controls.Add(nameLabel);

            name = new Label();
            name.Text = this.locationSource.Name;
            name.Location = new System.Drawing.Point(45, 14);
            name.AutoSize = true;
            container.Controls.Add(name);

            Label latLabel = new Label();
            latLabel.Text = "Lat:";
            latLabel.Location = new System.Drawing.Point(5, 40);
            latLabel.AutoSize = true;
            container.Controls.Add(latLabel);

            lat = new Label();
            lat.Text = "unknown";
            lat.Location = new System.Drawing.Point(45, 40);
            lat.Width = 85;
            lat.Height = 13;
            container.Controls.Add(lat);

            Label lngLabel = new Label();
            lngLabel.Text = "Lng:";
            lngLabel.Location = new System.Drawing.Point(5, 60);
            lngLabel.AutoSize = true;
            container.Controls.Add(lngLabel);

            lng = new Label();
            lng.Text = "unknown";
            lng.Location = new System.Drawing.Point(45, 60);
            lng.Width = 85;
            lng.Height = 13;
            container.Controls.Add(lng);

            play = new CheckBox();
            play.Appearance = Appearance.Button;
            play.Text = "Play";
            play.Location = new System.Drawing.Point(5, 80);
            play.Width = 40;
            play.Click += delegate
            {
                this.stop.Enabled = true;
                this.stop.Checked = false;
                this.play.Checked = true;
                this.play.Enabled = false;
                this.locationSourcePlayer.Play();
            };
            container.Controls.Add(play);

            pause = new CheckBox();
            pause.Appearance = Appearance.Button;
            pause.Text = "Pause";
            pause.Location = new System.Drawing.Point(46, 80);
            pause.Width = 45;
            pause.Click += delegate
            {
                if (this.pause.Checked)
                    this.locationSourcePlayer.Pause = true;
                else
                    this.locationSourcePlayer.Pause = false;
            };
            container.Controls.Add(pause);

            stop = new CheckBox();
            stop.Appearance = Appearance.Button;
            stop.Checked = true;
            stop.Enabled = false;
            stop.Text = "Stop";
            stop.Location = new System.Drawing.Point(92, 80);
            stop.Width = 40;
            stop.Click += delegate
            {
                this.pressStop();
            };
            container.Controls.Add(stop);

            Button removeUser = new Button();
            removeUser.Text = "Remove Track";
            removeUser.Location = new System.Drawing.Point(5, 103);
            removeUser.Width = 127;
            removeUser.Click += delegate { new DeleteLocationSourceCommand(this.locationSource).execute(); };
            container.Controls.Add(removeUser);

            this.locationSource.Attach(this);
            this.locationSourcePlayer.RegisterUserTrackForm(this);
        }
Beispiel #3
0
        public LocationSourceTrackForm(LocationSource locationSource, Panel parent, LocationSourcePlayer locationSourcePlayer)
        {
            this.locationSource       = locationSource;
            this.parent               = parent;
            this.locationSourcePlayer = locationSourcePlayer;

            this.container        = new GroupBox();
            this.container.Width  = this.parent.Width - 25;
            this.container.Height = 132;
            parent.Controls.Add(container);

            Label nameLabel = new Label();

            nameLabel.Text     = "Name:";
            nameLabel.Location = new System.Drawing.Point(5, 14);
            nameLabel.AutoSize = true;
            container.Controls.Add(nameLabel);

            name          = new Label();
            name.Text     = this.locationSource.Name;
            name.Location = new System.Drawing.Point(45, 14);
            name.AutoSize = true;
            container.Controls.Add(name);

            Label latLabel = new Label();

            latLabel.Text     = "Lat:";
            latLabel.Location = new System.Drawing.Point(5, 40);
            latLabel.AutoSize = true;
            container.Controls.Add(latLabel);

            lat          = new Label();
            lat.Text     = "unknown";
            lat.Location = new System.Drawing.Point(45, 40);
            lat.Width    = 85;
            lat.Height   = 13;
            container.Controls.Add(lat);

            Label lngLabel = new Label();

            lngLabel.Text     = "Lng:";
            lngLabel.Location = new System.Drawing.Point(5, 60);
            lngLabel.AutoSize = true;
            container.Controls.Add(lngLabel);

            lng          = new Label();
            lng.Text     = "unknown";
            lng.Location = new System.Drawing.Point(45, 60);
            lng.Width    = 85;
            lng.Height   = 13;
            container.Controls.Add(lng);

            play            = new CheckBox();
            play.Appearance = Appearance.Button;
            play.Text       = "Play";
            play.Location   = new System.Drawing.Point(5, 80);
            play.Width      = 40;
            play.Click     += delegate
            {
                this.stop.Enabled = true;
                this.stop.Checked = false;
                this.play.Checked = true;
                this.play.Enabled = false;
                this.locationSourcePlayer.Play();
            };
            container.Controls.Add(play);

            pause            = new CheckBox();
            pause.Appearance = Appearance.Button;
            pause.Text       = "Pause";
            pause.Location   = new System.Drawing.Point(46, 80);
            pause.Width      = 45;
            pause.Click     += delegate
            {
                if (this.pause.Checked)
                {
                    this.locationSourcePlayer.Pause = true;
                }
                else
                {
                    this.locationSourcePlayer.Pause = false;
                }
            };
            container.Controls.Add(pause);

            stop            = new CheckBox();
            stop.Appearance = Appearance.Button;
            stop.Checked    = true;
            stop.Enabled    = false;
            stop.Text       = "Stop";
            stop.Location   = new System.Drawing.Point(92, 80);
            stop.Width      = 40;
            stop.Click     += delegate
            {
                this.pressStop();
            };
            container.Controls.Add(stop);

            Button removeUser = new Button();

            removeUser.Text     = "Remove Track";
            removeUser.Location = new System.Drawing.Point(5, 103);
            removeUser.Width    = 127;
            removeUser.Click   += delegate { new DeleteLocationSourceCommand(this.locationSource).execute(); };
            container.Controls.Add(removeUser);

            this.locationSource.Attach(this);
            this.locationSourcePlayer.RegisterUserTrackForm(this);
        }