private void CreateNewIcon() { if (Car == null) { return; } ValuesStorage.Set(_key, NewIconLabel.Text); // TODO: Save style? var size = new Size(CommonAcConsts.UpgradeIconWidth, CommonAcConsts.UpgradeIconHeight); NewIcon.Measure(size); NewIcon.Arrange(new Rect(size)); NewIcon.ApplyTemplate(); NewIcon.UpdateLayout(); var bmp = new RenderTargetBitmap(CommonAcConsts.UpgradeIconWidth, CommonAcConsts.UpgradeIconHeight, 96, 96, PixelFormats.Pbgra32); bmp.Render(NewIcon); try { bmp.SaveTo(Car.UpgradeIcon); BetterImage.Refresh(Car.UpgradeIcon); } catch (IOException ex) { NonfatalError.Notify(AppStrings.UpgradeIcon_CannotChange, AppStrings.UpgradeIcon_CannotChange_Commentary, ex); } catch (Exception ex) { NonfatalError.Notify(AppStrings.UpgradeIcon_CannotChange, ex); } }
protected void OnNewIcon() { if (NewIcon != null) { NewIcon.Invoke(); } }
public void Execute() { if (!dragging) { if (_name == "add") { int width = (int)Math.Floor(Canvas.GetComponent <RectTransform>().rect.width); int height = (int)Math.Floor(Canvas.GetComponent <RectTransform>().rect.height); Transform dialog = Instantiate(AddIconDialog, new Vector3(width / 2, height / 2, 0), Quaternion.identity, Canvas.transform); NewIcon scr = dialog.GetComponent <NewIcon>(); if (scr != null) { scr.LauncherObject = LauncherObject; scr.Self = dialog.gameObject; } return; } //Debug.Log("Starting " + path); if (arguments == null || arguments == "") { System.Diagnostics.Process.Start(path); } else { System.Diagnostics.Process.Start(path, arguments); } LauncherObject.OpenLauncher(); // this actually closes the launcher } //else Debug.Log("Not starting"); dragging = false; }