public override void ViewDidLoad() { base.ViewDidLoad(); hubCode = Persistence.GetHubCode(); if (hubCode != null) { renderCode(); } //else }
/** * Updates the code menu item with the current code, if it has changed. */ private void UpdateCodeMenuItemText() { var code = Persistence.GetHubCode(); if (code == null) { codeMenuItem.Text = "Start League to generate an access code!"; } else { codeMenuItem.Text = "Access Code: " + code; } }
public AboutWindow() { InitializeComponent(); Logo.Source = Imaging.CreateBitmapSourceFromHIcon(Properties.Resources.mimic.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); StartOnStartupCheckbox.IsChecked = Persistence.LaunchesAtStartup(); AboutTitle.Content = "Mimic Conduit v" + Program.VERSION; if (Persistence.GetHubCode() != null) { RenderCode(); } Persistence.OnHubCodeChanged += RenderCode; }
/** * Updates the code menu item with the current code, if it has changed. */ private void UpdateCodeMenuItemText() { var code = Persistence.GetHubCode(); if (code == null) { codeMenuItem = "Start League to generate an access code!"; } else { codeMenuItem = "Access Code: " + code; } DebugLogger.Global.WriteMessage(codeMenuItem); }
/** * Renders the current hub code. This assumes that a hub token exists and doesn't check for null. */ private void RenderCode() { Dispatcher.Invoke(() => { QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeData qrCodeData = qrGenerator.CreateQrCode("https://remote.mimic.lol/" + Persistence.GetHubCode(), QRCodeGenerator.ECCLevel.Q); XamlQRCode qrCode = new XamlQRCode(qrCodeData); ConnectionQR.Source = qrCode.GetGraphic(20); ConnectionQR.Visibility = Visibility.Visible; CodeLabel.Content = Persistence.GetHubCode(); CodeLabel.Visibility = Visibility.Visible; ConnectionSteps.Visibility = Visibility.Visible; NoCodeText.Visibility = Visibility.Hidden; }); }