void OnImageDialog(GXImageDlg dlg, GXActionArgs arg) { if (InvokeRequired) { BeginInvoke(new ImageDialogEventHandler(OnImageDialog), dlg, arg).AsyncWaitHandle.WaitOne(); } else { DescriptionList.Items.Clear(); if (dlg.ShowDialog(this) != DialogResult.OK) { imageIdentifier = null; arg.Action = ActionType.None; return; } if (dlg.IsAscii) { imageIdentifier = ASCIIEncoding.ASCII.GetBytes(dlg.TextTb.Text); } else { imageIdentifier = GXDLMSTranslator.HexToBytes(dlg.TextTb.Text); } arg.Text = "Updating image " + Path.GetFileNameWithoutExtension(dlg.FileNameTb.Text) + "..."; OnDescription("Updating image " + dlg.FileNameTb.Text); image = dlg.Image; } }
void OnImageDialog(GXImageDlg dlg, GXActionArgs arg) { if (InvokeRequired) { BeginInvoke(new ImageDialogEventHandler(OnImageDialog), dlg, arg).AsyncWaitHandle.WaitOne(); } else { DescriptionList.Items.Clear(); if (dlg.ShowDialog(this) != DialogResult.OK) { arg.Action = ActionType.None; return; } GXImageUpdateStatus status = new GXImageUpdateStatus(); arg.Tag = status; status.ImageIdentifier = dlg.GetImageIdentifier(); arg.Text = "Updating image " + Path.GetFileNameWithoutExtension(dlg.FileNameTb.Text) + "..."; OnDescription("Updating image " + dlg.FileNameTb.Text); status.Image = dlg.Image; } }