void HandleSkillDetailClicked(object sender, EventArgs e) { _TBDialog = new TextBoxDialog(); _TBDialog.HeaderText = "Skill Detail"; _TBDialog.SingleLine = true; _TBDialog.Value = _DetailText; _TBDialog.OKClicked += delegate { _DetailText = _TBDialog.Value; SkillDetailButton.SetText(_DetailText); }; DialogParent.Add(_TBDialog.View); }
private void FeatTextClicked(ParsedFeat f) { _TextDialog = new TextBoxDialog(); _TextDialog.Title = "Feat Options"; _TextDialog.Value = f.Choice; _TextDialog.SingleLine = true; _TextDialog.OKClicked += (sender, e) => { CurrentMonster.FeatsList.Remove(f.Text); f.Choice = _TextDialog.Value; CurrentMonster.FeatsList.Add(f.Text); RebuildFeats(); }; DialogParent.Add(_TextDialog.View); }
void Handle_ButtonTouchUpInside(object sender, EventArgs e) { if (_ValueList == null) { if (_Property.PropertyType == typeof(string)) { _TextBoxDialog = new TextBoxDialog(); _TextBoxDialog.HeaderText = DisplayTitle; _TextBoxDialog.Value = (string)Value; _TextBoxDialog.SingleLine = !_Multiline; _TextBoxDialog.OKClicked += Handle_TextBoxDialogOKClicked; _DialogParent.AddSubview(_TextBoxDialog.View); } else if (_Property.PropertyType == typeof(int) || _Property.PropertyType == typeof(int?)) { NumberModifyPopover pop = new NumberModifyPopover(); pop.ShowOnView(_Button); if (_Property.PropertyType == typeof(int?)) { pop.Value = (int?)Value; } else { pop.Value = (int)Value; } pop.ValueType = DisplayTitle; pop.Title = DisplayTitle; pop.Data = _PropertyObject; pop.Nullable = (_Property.PropertyType == typeof(int?)); pop.NumberModified += HandlePopNumberModified; } else if (_Property.PropertyType == typeof(DieRoll)) { _HDDialog = new HDEditorDialog(); _HDDialog.HeaderText = DisplayTitle; _HDDialog.DieRoll = (DieRoll)Value; DialogParent.AddSubview(_HDDialog.View); _HDDialog.OKClicked += Handle_HDDialogOKClicked; } else if (_Property.PropertyType == typeof(bool)) { Value = !(bool)Value; UpdateButton(); } } }
protected override async Task ScanInternal(ScannedImageSource.Concrete source) { await Task.Factory.StartNew(async() => { if (UseWorker) { var parentHandle = DialogParent?.SafeHandle() ?? IntPtr.Zero; try { using (var worker = workerServiceFactory.Create()) { worker.Callback.ImageCallback += (img, tempPath) => { if (tempPath != null) { scannedImageHelper.RunBackgroundOcr(img, ScanParams, tempPath); } source.Put(img); }; CancelToken.Register(worker.Service.CancelTwainScan); await worker.Service.TwainScan(ScanDevice, ScanProfile, ScanParams, parentHandle); } } finally { if (parentHandle != IntPtr.Zero) { // If the worker process hard crashes while a modal window is open, it may leave the parent // window in a state where it can't be interacted with. This fixes that interaction. // // At the Windows API level, a modal window is implemented by doing two things: // 1. Setting the parent on the child window // 2. Disabling the parent window // The first is implicitly undone when the worker process dies. The second is undone here. Win32.EnableWindow(parentHandle, true); } } } else { twainWrapper.Scan(DialogParent, ScanDevice, ScanProfile, ScanParams, CancelToken, source, scannedImageHelper.RunBackgroundOcr); } }, TaskCreationOptions.LongRunning).Unwrap(); }
/// <summary> /// Die andere, nicht gewählte Option wird hier ausgeblendet. /// Die gewählte Option is zunächst noch etwas zu sehen und blendet sich dann auch langsam aus. /// </summary> /// <param name="mode"></param> private void PickType(int mode) { OnDialogFinished(new Events.DialogEventArgs(mode, this)); this.Invoke(new Action(() => { if (mode == SERVER) { _clienttext.Opacity = 0; _clientrect.Opacity = 0; } else { _servertext.Opacity = 0; _serverrect.Opacity = 0; } Animation.Animator.FadeOut(DialogParent, (s, e) => { DialogParent.RemoveFromSurface(); }); })); }
protected override async Task ScanInternal(ScannedImageSource.Concrete source) { await Task.Factory.StartNew(async() => { if (UseWorker) { using (var worker = workerServiceFactory.Create()) { worker.Callback.ImageCallback += (img, tempPath) => { if (tempPath != null) { scannedImageHelper.RunBackgroundOcr(img, ScanParams, tempPath); } source.Put(img); }; CancelToken.Register(worker.Service.CancelTwainScan); await worker.Service.TwainScan(ScanDevice, ScanProfile, ScanParams, DialogParent?.SafeHandle() ?? IntPtr.Zero); } } else { twainWrapper.Scan(DialogParent, ScanDevice, ScanProfile, ScanParams, CancelToken, source, scannedImageHelper.RunBackgroundOcr); } }, TaskCreationOptions.LongRunning).Unwrap(); }
public override void ViewDidLoad() { base.ViewDidLoad(); foreach (GradientView v in new GradientView[] { SpeedView, AttacksView, AbilitiesView }) { StylePanel(v); } CurrentMonster.Adjuster.PropertyChanged += MonsterAdjusterPropertyChanged; ButtonPropertyManager m; m = new ButtonPropertyManager(SpeedButton, DialogParent, CurrentMonster.Adjuster, "LandSpeed") { Title = "Land Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(ClimbButton, DialogParent, CurrentMonster.Adjuster, "ClimbSpeed") { Title = "Climb Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(SpaceButton, DialogParent, CurrentMonster.Adjuster, "Space") { Title = "Space" }; _Managers.Add(m); m = new ButtonPropertyManager(FlyButton, DialogParent, CurrentMonster.Adjuster, "FlySpeed") { Title = "Fly Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(BurrowButton, DialogParent, CurrentMonster.Adjuster, "BurrowSpeed") { Title = "Burrow Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(ReachButton, DialogParent, CurrentMonster.Adjuster, "Reach") { Title = "Reach" }; _Managers.Add(m); m = new ButtonPropertyManager(FlyQualityButton, DialogParent, CurrentMonster.Adjuster, "FlyQuality") { Title = "Fly Quality" }; var list = new List <KeyValuePair <object, string> >(); for (int i = 0; i < 5; i++) { list.Add(new KeyValuePair <object, string>(i, Monster.GetFlyQualityString(i).Capitalize())); } m.ValueList = list; m.FormatDelegate = a => { if (CurrentMonster.Adjuster.FlySpeed == null) { return("-"); } else { return(Monster.GetFlyQualityString((int)a).Capitalize()); } }; _Managers.Add(m); m = new ButtonPropertyManager(SwimButton, DialogParent, CurrentMonster.Adjuster, "SwimSpeed") { Title = "Swim Speed" }; _Managers.Add(m); m = new ButtonPropertyManager(SpecialAttacksButton, DialogParent, CurrentMonster, "SpecialAttacks") { Title = "Special Attacks", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(SpellLikeAbilitiesButton, DialogParent, CurrentMonster.Adjuster, "SpellLikeAbilities") { Title = "Spell-Like Abilities", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(SpellsKnownButton, DialogParent, CurrentMonster.Adjuster, "SpellsKnown") { Title = "Spells Known", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(SpellsPreparedButton, DialogParent, CurrentMonster.Adjuster, "SpellsPrepared") { Title = "SpellsPrepared", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(MeleeButton, DialogParent, CurrentMonster, "Melee") { Title = "Melee", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(RangedButton, DialogParent, CurrentMonster, "Ranged") { Title = "Ranged", Multiline = true }; _Managers.Add(m); foreach (GradientButton b in from x in _Managers select x.Button) { CMStyles.TextFieldStyle(b, 15f); } AttacksEditorButton.TouchUpInside += (sender, e) => { _AEDialog = new AttacksEditorDialog(CurrentMonster); _AEDialog.OKClicked += (senderx, e1) => { CharacterAttacks at = _AEDialog.Attacks; CurrentMonster.Melee = CurrentMonster.MeleeString(at); CurrentMonster.Ranged = CurrentMonster.RangedString(at); }; DialogParent.Add(_AEDialog.View); }; UpdateButtonState(); }