Exemple #1
0
 private void onClick(object sender, ControlEventArgs args)
 {
     try
     {
         if (this.TestEdit.Text != null)
         {
             WriteToChat(this.TestEdit.Text);
         }
         else
         {
             WriteToChat("There is no text in the edit box.");
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.LogError(errorLogFile, ex);
     }
 }
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     e.Control.Paint -= new PaintEventHandler(Control_Paint);
 }
Exemple #3
0
 private void Form1_ControlRemoved(object sender, ControlEventArgs e)
 {
     Console.WriteLine("ControlRemoved");
 }
		private void btnStartLocationHere_Click(object sender, ControlEventArgs e)
		{
			try
			{
				edtStartLocationCoords.Text = PlayerCoords.ToString("0.0");
				edtStartLocationCoords.Caret = 0;
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
		private void btnRouteCopy_Click(object sender, ControlEventArgs e)
		{
			const int MAX_LENGTH = 225;

			try
			{
				if (lstRoute.RowCount == 0)
				{
					Util.Error("There is no route to copy");
				}
				else
				{
					if (mRouteCopyIndex >= lstRoute.RowCount)
						mRouteCopyIndex = 0;
					string route = "";
					for (; mRouteCopyIndex < lstRoute.RowCount; mRouteCopyIndex++)
					{
						Location loc;
						if (null != (loc = GetLocation(lstRoute[mRouteCopyIndex][LocationList.ID][0] as string)))
						{
							string routeSegment = (mRouteCopyIndex > 0 ? " >> " : "")
								+ loc.Name + " [" + loc.Coords.ToString("0.0") + "]";
							if (route.Length + routeSegment.Length > MAX_LENGTH)
							{
								route += " >>";
								Util.HelpMessage("The route was too long to fit into a tell, so only part "
									+ "of it was copied. Click Copy again to copy the next part.");
								break;
							}

							route += routeSegment;
						}
					}
					System.Windows.Forms.Clipboard.SetText(route);
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
		private void btnModifyReset_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
					Util.Error("Select a location first");
				else
					ShowDetails(mDetailsLoc);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
		private void btnModifyExitCoordsHere_Click(object sender, ControlEventArgs e)
		{
			try
			{
				edtModifyExitCoords.Text = PlayerCoords.ToString("0.0");
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
		private void btnDetailsArrowTarget_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
					Util.Error("Select a location first");
				else
				{
					mArrowHud.DestinationLocation = mDetailsLoc;
					mArrowHud.Visible = true;
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 private void gridControl1_ControlAdded(object sender, ControlEventArgs e)
 {
 }
Exemple #10
0
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     base.OnControlRemoved(e);
     this.TableLayout();
 }
Exemple #11
0
 private void panel1_ControlRemoved(object sender, ControlEventArgs e)
 {
     Size = new System.Drawing.Size(250, Size.Height);
 }
 private void tab_staffProfile_ControlRemoved(object sender, ControlEventArgs e)
 {
     this.Controls.Clear();
 }
 protected override void OnControlAdded(ControlEventArgs e)
 {
     e.Control.Padding = new Padding(3, 3, 3, 3);
     base.OnControlAdded(e);
 }
Exemple #14
0
 /// <summary>
 ///   This ensures that all the scrolling controls are properly positioned whenever a new control is added.
 /// </summary>
 /// <param name="sender">The object that triggered the event.</param>
 /// <param name="e">A <see cref="ControlEventArgs" /> describing the event arguments.</param>
 private void m_pnlToolStrip_ControlAdded(object sender, ControlEventArgs e)
 {
     checkScroll();
 }
 void HandleControlAdded(object sender, ControlEventArgs e)
 {
     m_widthOfLeftDockedControls = null;
 }
		private void btnSearchGo_Click(object sender, ControlEventArgs e)
		{
			try
			{
				List<Location> results;
				LocationType limitTo = (LocationType)choSearchLimit.Data[choSearchLimit.Selected];

				if (chkSearchNearby.Checked)
				{
					Coordinates coords;
					if (!Coordinates.TryParse(edtSearchCoords.Text, out coords))
					{
						Util.Error("Invalid coordinates for nearby search");
						return;
					}
					double radius;
					if (!double.TryParse(edtSearchRadius.Text, out radius) || radius <= 0)
					{
						Util.Error("Invalid search radius; must be a number greater than 0");
						return;
					}
					if (chkSearchName.Checked)
					{
						results = mLocDb.Search(edtSearchName.Text, searchIn[choSearchIn.Selected],
							coords, radius, limitTo);
					}
					else
					{
						results = mLocDb.Search(coords, radius, limitTo);
					}
				}
				else if (chkSearchName.Checked)
				{
					results = mLocDb.Search(edtSearchName.Text, searchIn[choSearchIn.Selected], limitTo);
				}
				else
				{
					Util.Error("You must select either a Text or Nearby search");
					return;
				}
				FillLocationList(lstSearchResults, results, chkSearchShowRelative.Checked);
				lblSearchMatchesFound.Text = results.Count.ToString("#,0");
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
		private void btnDetailsCopyCoords_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
				{
					Util.Error("Select a location first");
				}
				else
				{
					System.Windows.Forms.Clipboard.SetText(mDetailsLoc.Name + " ["
						+ mDetailsLoc.Coords.ToString("0.0") + "]");
					//+ " (Relative to me: "
					//+ PlayerCoords.RelativeTo(mDetailsLoc.Coords).ToString("0.0") + ")");
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 protected override void OnControlAdded(ControlEventArgs e)
 {
     base.OnControlAdded(e);
 }
		private void btnDetailsLocateOnMap_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
				{
					Util.Error("Select a location first");
				}
				else
				{
					if (mMapHud.Zoom < 4.1f)
						mMapHud.Zoom = 4.1f;
					else if (mMapHud.Zoom > 10f)
						mMapHud.Zoom = 10f;

					mMapHud.CenterOnCoords(mDetailsLoc.Coords);
					mMapHud.Visible = true;
					mMapHud.Minimized = false;
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #20
0
 /// <summary>
 /// Updates the document icon when a control is added
 /// </summary>
 private void DocumentControlAdded(Object sender, ControlEventArgs e)
 {
     this.UpdateToolTipText();
     this.UpdateDocumentIcon(this.FileName);
 }
		private void btnModifySave_Click(object sender, ControlEventArgs e)
		{
			try
			{
				Coordinates coords, exitCoords;
				if (mDetailsLoc == null)
				{
					Util.Error("You must select a location before modifying it");
					return;
				}
				if (mDetailsLoc.IsInternalLocation)
				{
					Util.Error("This location cannot be modified");
					return;
				}
				if (!Coordinates.TryParse(edtModifyCoords.Text, out coords))
				{
					Util.Error("Invalid location coordinates: " + edtModifyCoords.Text);
					return;
				}
				if (!Coordinates.TryParse(edtModifyExitCoords.Text, true, out exitCoords))
				{
					Util.Error("Invalid exit coordinates: " + edtModifyExitCoords.Text);
					return;
				}
				if (exitCoords == Coordinates.NO_COORDINATES && chkModifyUseInRoute.Checked)
				{
					Util.Error("In order to be used in route finding, a location must have exit coordinates");
					return;
				}
				mDetailsLoc.Name = edtModifyName.Text;
				mDetailsLoc.Coords = coords;
				mDetailsLoc.ExitCoords = exitCoords;
				mDetailsLoc.Type = (LocationType)choModifyType.Data[choModifyType.Selected];
				mDetailsLoc.UseInRouteFinding = chkModifyUseInRoute.Checked;
				mDetailsLoc.Notes = edtModifyDescription.Text;
				mDetailsLoc.IsCustomized = true;
				mLocDb.Save(Util.FullPath("locations.xml"));
				Util.Message("The location " + mDetailsLoc.Name + " has been successfully modified");
				if (mDetailsLoc.Equals(choRouteFrom.Data[choRouteFrom.Selected]))
				{
					choRouteFrom.Text[choRouteFrom.Selected] = mDetailsLoc.Name;
					chkRouteFromHere.Checked = false;
					edtRouteFromCoords.Text = mDetailsLoc.Coords.ToString();
				}
				if (mDetailsLoc.Equals(choRouteTo.Data[choRouteTo.Selected]))
				{
					choRouteTo.Text[choRouteTo.Selected] = mDetailsLoc.Name;
					chkRouteToHere.Checked = false;
					edtRouteToCoords.Text = mDetailsLoc.Coords.ToString();
				}
				ShowDetails(mDetailsLoc);
				UpdateFavoritesList();
				UpdateListCoords(lstSearchResults, chkSearchShowRelative.Checked);
				UpdateListCoords(lstRoute, chkRouteShowRelative.Checked);
				UpdateListCoords(lstFavorites, chkFavoritesShowRelative.Checked);
				UpdateListCoords(lstRecent, chkRecentShowRelative.Checked);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #22
0
 private void Forecast_ControlRemoved(object sender, ControlEventArgs e)
 {
     //Thread_Time.Dispose();
     timer1.Enabled = false;
     timer2.Enabled = false;
 }
		private void btnRouteGenerate_Click(object sender, ControlEventArgs e)
		{
			try
			{
				Coordinates fromCoords, toCoords;
				Coordinates.TryParse(edtRouteFromCoords.Text, true, out fromCoords);
				if (!Coordinates.TryParse(edtRouteToCoords.Text, out toCoords))
				{
					Util.Error("Invalid end point coordinates");
					return;
				}

				RouteStart.StartPoint.Coords = fromCoords;

				mRouteStartLoc = choRouteFrom.Data[choRouteFrom.Selected] as Location;
				mRouteEndLoc = choRouteTo.Data[choRouteTo.Selected] as Location;

				if (mRouteStartLoc == null || mRouteStartLoc.Coords != fromCoords)
				{
					mRouteStartLoc = RouteStart.StartPoint.ToLocation(mLocDb);
				}
				if (mRouteEndLoc == null || mRouteEndLoc.Coords != toCoords)
				{
					mRouteEndLoc = new Location(Location.GetNextInternalId(), "End Point",
						LocationType._EndPoint, toCoords, "");
				}

				if (fromCoords == Coordinates.NO_COORDINATES)
					mRouteStartLoc = Location.NO_LOCATION;

				mRoute = RouteFinder.FindRoute(mLocDb, mStartLocations.Values,
						mPortalDevices.Values, mRouteStartLoc, mRouteEndLoc, out mRoutePackage);

				if (mRoute.Count > 0)
				{
					lblRouteDistance.Text = (mRoute.Distance.ToString("0.00") + " km");
				}
				else
				{
					lblRouteDistance.Text = "No route found";
					Util.Warning("Unable to find a route.  Try turning on more start locations or "
						+ "increasing the maximum run distance between portals.");
				}
				mRouteCopyIndex = 0;
				FillLocationList(lstRoute, mRoute, chkRouteShowRelative.Checked);
				mMapHud.Route = mRoute;
				mMapHud.ShowRoute = true;
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 private void tab_profile_ControlRemoved(object sender, ControlEventArgs e)
 {
     this.panel1.Dispose();
 }
		private void btnDestCommandHelp_Click(object sender, ControlEventArgs e)
		{
			try
			{
				ShowLocCommandHelp(false);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 /// <summary>
 /// Control Added Event
 /// </summary>
 /// <param name="e"></param>
 protected override void OnControlAdded(ControlEventArgs e)
 {
     ControlFonts.Add(e.Control, (Font)e.Control.Font.Clone());
     base.OnControlAdded(e);
 }
 protected override void OnControlAdded(ControlEventArgs e)
 {
     base.OnControlAdded(e);
     e.Control.BackColor = Color.White;
     e.Control.ForeColor = Helpers.ColorFromHex("#343843");
     using (Font font = new Font("Segoe UI", 9f))
     {
         e.Control.Font = font;
     }
 }
 /// <summary>
 /// Control Added Event
 /// </summary>
 /// <param name="e"></param>
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     ControlFonts.Remove(e.Control);
     base.OnControlRemoved(e);
 }
Exemple #29
0
 protected override void OnControlAdded(ControlEventArgs e)
 {
     base.OnControlAdded(e);
     e.Control.BackColor = Color.White;
     e.Control.ForeColor = Color.FromArgb(72, 75, 82);
     e.Control.Font = new Font("Segoe UI", 10);
 }
Exemple #30
0
 private void flp_lessons_ControlAdded(object sender, ControlEventArgs e)
 {
     flp_lessons.ScrollControlIntoView(e.Control);
 }
		private void btnSearchHere_Click(object sender, ControlEventArgs e)
		{
			try
			{
				edtSearchCoords.Text = PlayerCoords.ToString();
				edtSearchCoords_Change(edtSearchCoords.Text);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 void form_ControlAdded(object sender, ControlEventArgs e)
 {
     Add(e.Control);
 }
		private void btnDetailsShrink_Click(object sender, ControlEventArgs e)
		{
			try
			{
				Rectangle pos = DefaultView.Position;
				if (pos.Size != nbkMainTabsSize[MainTab.Atlas])
				{
					SetViewSize(nbkMainTabsSize[MainTab.Atlas]);
					btnDetailsShrink.Text = HideDetailsText;
				}
				else
				{
					SetViewSize(new Size(pos.Width, 136));
					btnDetailsShrink.Text = ShowDetailsText;
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 private void FlatTabControl_ControlRemoved(object sender, ControlEventArgs e)
 {
     FindUpDown();
     UpdateUpDown();
 }
		private void btnDetailsRouteEnd_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
					Util.Error("Select a location first");
				else
					SetRouteEnd(mDetailsLoc);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     base.OnControlRemoved(e);
     RemoveMessageFilter();
     _bMouseTrackingOn = false;
 }
		private void btnDetailsAddFav_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
					Util.Error("Select a location first");
				else if (mDetailsLoc.IsInternalLocation)
					Util.Warning("This location cannot be added as a favorite");
				else if (mDetailsLoc.IsFavorite)
					Util.Warning(mDetailsLoc.Name + " is already in your favorites list");
				else
				{
					mDetailsLoc.IsFavorite = true;
					nbkAtlas.ActiveTab = AtlasTab.Favorites;
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #38
0
 private void pnHis_ControlAdded(object sender, ControlEventArgs e)
 {
     countQueue();
 }
		private void btnDetailsDungeonMap_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
				{
					Util.Error("Select a location first");
				}
				else if (!mDungeonHud.DungeonMapAvailable(mDetailsLoc))
				{
					if (mDetailsLoc.Type != LocationType.Dungeon)
					{
						Util.Warning("Dungeon maps are only available for dungeons.");
					}
					else
					{
						Util.Warning("No dungeon map available for " + mDetailsLoc.Name);
					}
				}
				else
				{
					mDungeonHud.Visible = true;
					mDungeonHud.Minimized = false;
					mDungeonHud.LoadDungeonById(mDungeonHud.GetDungeonId(mDetailsLoc));
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #40
0
 private void pnMainQ_ControlRemoved(object sender, ControlEventArgs e)
 {
     countQueue();
 }
		private void btnModifyExitCoordsNone_Click(object sender, ControlEventArgs e)
		{
			try
			{
				edtModifyExitCoords.Text = Coordinates.NO_COORDINATES_STRING;
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #42
0
 private void pnlContents_ControlRemoved(object sender, ControlEventArgs e)
 {
     Controller.ShowingJobList = false;
 }
		private void btnModifySaveNew_Click(object sender, ControlEventArgs e)
		{
			try
			{
				Coordinates coords, exitCoords;
				if (!Coordinates.TryParse(edtModifyCoords.Text, out coords))
				{
					Util.Error("Invalid location coordinates: " + edtModifyCoords.Text);
					return;
				}
				if (!Coordinates.TryParse(edtModifyExitCoords.Text, true, out exitCoords))
				{
					Util.Error("Invalid exit coordinates: " + edtModifyExitCoords.Text);
					return;
				}
				if (exitCoords == Coordinates.NO_COORDINATES && chkModifyUseInRoute.Checked)
				{
					Util.Error("In order to be used in route finding, a location must have exit coordinates");
					return;
				}
				Location newLocation = new Location(
					Location.GetNextCustomId(),
					edtModifyName.Text,
					(LocationType)choModifyType.Data[choModifyType.Selected],
					coords,
					edtModifyDescription.Text,
					exitCoords);
				newLocation.UseInRouteFinding = chkModifyUseInRoute.Checked;
				newLocation.IsCustomized = true;
				mLocDb.Add(newLocation);
				mLocDb.Save(Util.FullPath("locations.xml"));
				Util.Message("The new location " + newLocation.Name
					+ " has been added to the locations database");
				char firstChar = char.IsLetter(newLocation.Name[0]) ? char.ToUpper(newLocation.Name[0]) : '#';
				if (choRouteFromLtr.Text[choRouteFromLtr.Selected][0] == firstChar)
					choRouteFrom.Add(newLocation.Name, newLocation);
				if (choRouteToLtr.Text[choRouteToLtr.Selected][0] == firstChar)
					choRouteTo.Add(newLocation.Name, newLocation);
				ShowDetails(newLocation);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #44
0
 private void ControlWasAdded(object sender, ControlEventArgs e)
 {
     DeepAddControl(e.Control);
 }
		private void btnDeleteLocation_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mDetailsLoc == null)
				{
					Util.Error("You must select a location to delete it");
				}
				else if (!Util.IsControlDown())
				{
					Util.Warning("You must hold down the control key while clicking to delete a location");
				}
				else
				{
					if (mLocDb.Remove(mDetailsLoc))
					{
						mLocDb.Save(Util.FullPath("locations.xml"));
						Util.Message("The location " + mDetailsLoc.Name
							+ " has been successfully removed from the database");
						ShowDetails(null);
					}
					else
					{
						Util.Error("This location cannot be deleted");
					}
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #46
0
 private void ControlWasRemoved(object sender, ControlEventArgs e)
 {
     DeepRemoveControl(e.Control);
 }
		private void btnRouteNext_Click(object sender, ControlEventArgs e)
		{
			try
			{
				if (mRoutePackage == null)
				{
					btnRouteGenerate_Click(null, null);
					return;
				}
				Route route = RouteFinder.FindRoute(mRoutePackage);

				if (route.Count > 0)
				{
					lblRouteDistance.Text = (route.Distance.ToString("0.00") + " km");
					mRouteCopyIndex = 0;
					FillLocationList(lstRoute, route, chkRouteShowRelative.Checked);
					mRoute = route;
					mMapHud.Route = mRoute;
					mMapHud.ShowRoute = true;
				}
				else
				{
					Util.Warning("Can't find any more routes.");
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 private void tabMain_ControlAdded(object sender, ControlEventArgs e)
 {
     tabMain.SelectedTabPageIndex = tabMain.TabPages.Count - 1;
 }
		private void btnLocationsUpdate_Click(object sender, ControlEventArgs e)
		{
			try
			{
				bool downloading = mDownloadClient.IsBusy;
				bool converting = mXmlConverterWorker.IsBusy;
				if (mDownloadClient.IsBusy || mXmlConverterWorker.IsBusy)
				{
					btnLocationsUpdate.Text = "Update Locations Database";
					if (mDownloadClient.IsBusy)
						mDownloadClient.CancelAsync();
					else if (mXmlConverterWorker.IsBusy)
						mXmlConverterWorker.CancelAsync();
					Util.Message("Update cancelled");
				}
				else
				{
					Uri requestUrl;
					if (!Uri.TryCreate(edtLocationsUrl.Text, UriKind.Absolute, out requestUrl))
					{
						Util.Error("Invalid download URL specified: " + edtLocationsUrl.Text);
						return;
					}

					FileInfo locationsFile;
					switch (choUpdateDatabaseType.Selected)
					{
						case UpdateDatabaseType.CrossroadsOfDereth:
							locationsFile = new FileInfo(codLocationsXmlPath);
							if (locationsFile.Exists && locationsFile.Length > 0)
							{
								mDownloadSizeEstimate = (int)(locationsFile.Length * 1.02); // 2% larger
							}
							else
							{
								mDownloadSizeEstimate = 3000 * 1024; // 3,000 KB
							}
							break;
						case UpdateDatabaseType.ACSpedia:
							locationsFile = new FileInfo(acsLocationsPath);
							if (locationsFile.Exists && locationsFile.Length > 0)
							{
								mDownloadSizeEstimate = (int)(locationsFile.Length * 1.02); // 2% larger
							}
							else
							{
								mDownloadSizeEstimate = 1400 * 1024; // 1,400 KB
							}
							break;
						default:
							Util.Error("Invalid database type selected: " + choUpdateDatabaseType.Selected);
							return;
					}

					mDownloadClient.DownloadFileAsync(requestUrl, locationsFile.FullName);

					txtDownloadStatusA.Text = "Connecting...";
					btnLocationsUpdate.Text = "Cancel";
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #50
0
 protected override void OnControlAdded(ControlEventArgs e)
 {
     base.OnControlAdded(e);
     e.Control.MouseMove += ControlOnMouseeMove;
 }
		private void btnStartLocationRunDistHelp_Click(object sender, ControlEventArgs e)
		{
			Util.HelpMessage("Some start locations (such as Abandoned Mines) require running "
				+ "through a dungeon.  The number you enter here will be added to the route "
				+ "distance when calculating a route from this start location.");
		}
 protected override void OnControlAdded(ControlEventArgs e)
 {
     GraphicsManager.SetControlBackColor(e.Control, BackColorState.Enabled, false);
 }
		private void btnStartLocationAdd_Click(object sender, ControlEventArgs e)
		{
			try
			{
				string name = edtStartLocationName.Text;
				Coordinates coords;
				if (!Coordinates.TryParse(edtStartLocationCoords.Text, true, out coords))
				{
					Util.Error("Invalid coordinates");
					return;
				}
				double runDistance;
				if (!double.TryParse(edtStartLocationRunDist.Text, out runDistance)
						&& edtStartLocationRunDist.Text != "")
				{
					Util.Error("Invalid run distance");
					return;
				}
				RouteStart loc;
				ListRow row = null;
				int rowIndex = -1;
				if (mStartLocations.TryGetValue(name, out loc))
				{
					loc.Name = name;
					loc.RunDistance = runDistance;
					loc.Coords = coords;
					if (loc.Type == RouteStartType.MansionRecall)
					{
						PortalDevice.MansionRunDistance = loc.RunDistance;
					}

					for (int r = 0; r < lstStartLocations.RowCount; r++)
					{
						if (0 == StringComparer.OrdinalIgnoreCase.Compare(name,
								lstStartLocations[r][StartLocationsList.Name][0]))
						{
							rowIndex = r;
							row = lstStartLocations[r];
							break;
						}
					}
				}
				else
				{
					loc = new RouteStart(name, RouteStartType.Regular, Location.LocationTypeInfo(LocationType.Custom).Icon,
						runDistance, coords, SavesPer.All, true);
					mStartLocations[name] = loc;
				}
				if (row == null)
				{
					int idx = 0;
					foreach (string nameKey in mStartLocations.Keys)
					{
						if (0 == mStartLocations.Comparer.Compare(nameKey, name))
							break;
						idx++;
					}
					if (idx == lstStartLocations.RowCount)
						row = lstStartLocations.Add();
					else
						row = lstStartLocations.Insert(idx);
					rowIndex = idx;

					row[StartLocationsList.Icon][1] = loc.Icon;
					row[StartLocationsList.Delete][1] = DeleteIcon;
				}
				loc.Enabled = true;
				row[StartLocationsList.Enabled][0] = true;
				row[StartLocationsList.Name][0] = name;
				row[StartLocationsList.Coords][0] = coords.ToString(true);

				if (coords != Coordinates.NO_COORDINATES)
				{
					row[StartLocationsList.Name].Color = Color.White;
					row[StartLocationsList.Coords].Color = Color.White;
				}
				else
				{
					row[StartLocationsList.Name].Color = Color.Gray;
					row[StartLocationsList.Coords].Color = Color.Gray;
				}

				if (btnStartLocationAdd.Text == "Add")
				{
					lstStartLocations.ScrollPosition = rowIndex;
				}

				edtStartLocationName.Text = "";
				edtStartLocationCoords.Text = "";
				edtStartLocationRunDist.Text = "";
				btnStartLocationAdd.Text = "Add";
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     GraphicsManager.SetControlBackColor(e.Control, Parent.BackColor, true);
 }
Exemple #55
0
 protected override void OnControlAdded(ControlEventArgs e)
 {
     base.OnControlAdded(e);
     AddedControls.Add(e.Control);
     e.Control.Tag = MainForm.Width + ":" + MainForm.Height;
 }
Exemple #56
0
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     base.OnControlRemoved(e);
     Invalidate();
 }
Exemple #57
0
    private void HandleDataReceived(object sender, ControlEventArgs e)
    {
        if (e.Matches.Count == 0)
            return;
        var result = e.Result;
        var match = e.Matches[0];
        if (match == typeof(Power)) {
            int pwr = Hex.From(result.Data);
            bool on = pwr == Power.TVon;
            if (on) {
                tvimage.SetFromIconName("gtk-yes", IconSize.LargeToolbar);
                tvstate.Text = "Zapnuto";
            } else {
                tvimage.SetFromIconName("gtk-no", IconSize.LargeToolbar);
                tvstate.Text = "Vypnuto";
            }
            return;
        }

        if (match == typeof(AspectRatio)) {
            int _aspect = Hex.From(result.Data);
            switch (_aspect) {
                case AspectRatio.A4_3:
                    aspect.Text = "4:3";
                    break;
                case AspectRatio.Aczoom1:
                    aspect.Text = "Cinema Zoom 1";
                    break;
                case AspectRatio.Awide:
                    aspect.Text = "Plná šířka";
                    break;
                case AspectRatio.Ascan:
                    aspect.Text = "Jen skenovat";
                    break;
                case AspectRatio.Aorig:
                    aspect.Text = "Originál";
                    break;
                case AspectRatio.A16_9:
                    aspect.Text = "16:9";
                    break;
                case AspectRatio.Azoom:
                    aspect.Text = "Přiblížený";
                    break;
                case AspectRatio.A14_9:
                    aspect.Text = "14:9";
                    break;
                default:
                    aspect.Markup = "<i>Neznámý</i>";
                    break;
            }
            return;
        }
        if (match == typeof(VolumeControl)) {
            volumeview.Text = Convert.ToString(Hex.From(result.Data));
            return;
        }
        if (match == typeof(Tune)) {
            programview.Text = Convert.ToString(Tune.Deformat(result.Data).Item1);
            return;
        }
        if (match == typeof(InputCmd)) {
            switch (Hex.From(result.Data)) {
                case InputCmd.DTV:
                    inputview.Text = "DTV";
                    break;
                case InputCmd.AV:
                    inputview.Text = "AV1";
                    break;
                case InputCmd.AV + InputCmd.Input2:
                    inputview.Text = "AV2";
                    break;
                case InputCmd.Component:
                    inputview.Text = "Komponentní";
                    break;
                case InputCmd.HDMI:
                    inputview.Text = "HDMI";
                    break;
                case InputCmd.RGB:
                    inputview.Text = "RGB";
                    break;
            }
            if (Hex.From(result.Data) == InputCmd.RGB)
                autoconf.Sensitive = true;
            else
                autoconf.Sensitive = false;
            return;
        }
    }
		private void btnResetHudPositions_Click(object sender, ControlEventArgs e)
		{
			try
			{
				ResetHudPositions(true);
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Exemple #59
0
    protected override void OnControlAdded(ControlEventArgs e)
    {
        if (e.Control is TabPage)
        {
            e.Control.BackColor = Color.FromArgb(50, 50, 50);
        }

        base.OnControlAdded(e);
    }
 protected override void OnControlAdded(ControlEventArgs e)
 {
     e.Control.Paint += new PaintEventHandler(Control_Paint);
     base.OnControlAdded(e);
 }