/// <summary> /// Close group /// </summary> public void CloseGroup() { if (groupForm != null) { groupForm.Close(); groupForm = null; } }
/// <summary> /// Show group /// </summary> public void ShowGroup() { if (groupForm != null) { if (!(groupForm.Visible)) { groupForm.Close(); groupForm = new GroupForm(); groupForm.Show(); } } else { groupForm = new GroupForm(); groupForm.Show(); } }
/// <summary> /// Toggle group /// </summary> public void ToggleGroup() { if (groupForm == null) { groupForm = new GroupForm(); groupForm.Show(); } else { if (groupForm.Visible) { groupForm.Close(); groupForm = null; } else { groupForm.Close(); groupForm = new GroupForm(); groupForm.Show(); } } }
/// <summary> /// Default constructor /// </summary> public MainForm() { instance = this; InitializeComponent(); Translator.TranslatorInterface = new TranslatorInterface(); Translator.LoadTranslation(this); startGameNowTranslated = Translator.GetTranslation("START_GAME_NOW"); cruiseControlTranslated = Translator.GetTranslation("CRUISE_CONTROL"); speedLimitTranslated = Translator.GetTranslation("SPEED_LIMIT"); vehicleTranslated = Translator.GetTranslation("VEHICLE"); inTranslated = Translator.GetTranslation("IN"); statusTranslated = Translator.GetTranslation("STATUS"); deliverCargoTranslated = Translator.GetTranslation("DELIVER_CARGO"); cargoTranslated = Translator.GetTranslation("CARGO"); sourceTranslated = Translator.GetTranslation("SOURCE"); destinationTranslated = Translator.GetTranslation("DESTINATION"); routeTranslated = Translator.GetTranslation("ROUTE"); remainingTimeTranslated = Translator.GetTranslation("REMAINING_TIME"); ofTranslated = Translator.GetTranslation("OF"); yieldTranslated = Translator.GetTranslation("YIELD"); weightTranslated = Translator.GetTranslation("WEIGHT"); deadlineTranslated = Translator.GetTranslation("DEADLINE"); deadlineAvailableTranslated = Translator.GetTranslation("DEADLINE_AVAILABLE"); idleTranslated = Translator.GetTranslation("IDLE"); unlimitedTranslated = Translator.GetTranslation("UNLIMITED"); totalRouteTranslated = Translator.GetTranslation("TOTAL_ROUTE"); totalWeightTranslated = Translator.GetTranslation("TOTAL_WEIGHT"); totalYieldTranslated = Translator.GetTranslation("TOTAL_YIELD"); cabinTranslated = Translator.GetTranslation("CABIN"); chassisTranslated = Translator.GetTranslation("CHASSIS"); engineTranslated = Translator.GetTranslation("ENGINE"); transmissionTranslated = Translator.GetTranslation("TRANSMISSION"); wheelsTranslated = Translator.GetTranslation("WHEELS"); trailerTranslated = Translator.GetTranslation("TRAILER"); averageTranslated = Translator.GetTranslation("AVERAGE"); fuelTranslated = Translator.GetTranslation("FUEL"); fuelRemainingDistanceTranslated = Translator.GetTranslation("FUEL_REMAINING_DISTANCE"); fuelStatusTranslated = Translator.GetTranslation("FUEL_STATUS"); pleaseRefillFuelTranslated = Translator.GetTranslation("PLEASE_REFILL_FUEL"); lowFuelTranslated = Translator.GetTranslation("LOW_FUEL"); enoughFuelTranslated = Translator.GetTranslation("ENOUGH_FUEL"); refillLaterTranslated = Translator.GetTranslation("REFILL_LATER"); MaterialSkinManager material_skin_manager = MaterialSkinManager.Instance; material_skin_manager.AddFormToManage(this); material_skin_manager.Theme = MaterialSkinManager.Themes.DARK; material_skin_manager.ColorScheme = new ColorScheme(Primary.Blue700, Primary.Blue800, Primary.Blue500, Accent.LightBlue200, TextShade.WHITE); PluginManager.InstallPlugins(); telemetry = new Ets2SdkTelemetry(); telemetry.Data += Telemetry_Data; speedChart.Legends[0].Title = Translator.GetTranslation(Configuration.UseMetricUnit ? "SPEED_IN_KMH" : "SPEED_IN_MPH"); speedChart.Series[0].Name = Translator.GetTranslation("CURRENT"); speedChart.Series[1].Name = Translator.GetTranslation("LIMIT"); drivetrainImages = new Image[] { Resources.Drivetrain, Resources.DrivetrainSlightlyDamaged, Resources.DrivetrainDamaged, Resources.DrivetrainHeavilyDamaged, Resources.DrivetrainFullyDamaged }; cargoImages = new Image[] { Resources.NoCargo, Resources.Cargo, Resources.CargoSlightlyDamaged, Resources.CargoDamaged, Resources.CargoHeavilyDamaged, Resources.CargoFullyDamaged }; thread = new Thread(() => { while (isThreadRunning) { users = Truckers2ConnectAPI.GetUsers(); GroupForm.UpdateUsers(); Thread.Sleep(500); } }); thread.Start(); }