simplify some repeated boilerplate on the DragEnter event by consolidating it to an extension method
This commit is contained in:
parent
b1be2f5937
commit
c2bec296e6
|
@ -248,5 +248,15 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions
|
|||
{
|
||||
return dialogResult == DialogResult.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the desired effect if data is present, else None
|
||||
/// </summary>
|
||||
public static void Set(this DragEventArgs e, DragDropEffects effect)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop)
|
||||
? effect
|
||||
: DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3236,7 +3236,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private static void FormDragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void FormDragDrop(object sender, DragEventArgs e)
|
||||
|
|
|
@ -709,7 +709,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void lvFirmwares_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void lvFirmwares_DragDrop(object sender, DragEventArgs e)
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Windows.Forms;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Client.EmuHawk.WinFormExtensions;
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -337,9 +338,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ColorChooserForm_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop)
|
||||
? DragDropEffects.Move
|
||||
: DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Move);
|
||||
}
|
||||
|
||||
private void Button7_Click(object sender, EventArgs e)
|
||||
|
@ -353,7 +352,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
};
|
||||
|
||||
var result = sfd.ShowDialog(this);
|
||||
if (result == DialogResult.OK)
|
||||
if (result.IsOk())
|
||||
{
|
||||
SaveColorFile(sfd.FileName);
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region Movie List
|
||||
|
||||
void RefreshMovieList()
|
||||
private void RefreshMovieList()
|
||||
{
|
||||
MovieView.VirtualListSize = _movieList.Count;
|
||||
UpdateList();
|
||||
|
@ -297,7 +297,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void MovieView_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void MovieView_DragDrop(object sender, DragEventArgs e)
|
||||
|
|
|
@ -211,7 +211,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void RecordBox_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void RecordBox_DragDrop(object sender, DragEventArgs e)
|
||||
|
|
|
@ -20,9 +20,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void listBox1_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop)
|
||||
? DragDropEffects.Link
|
||||
: DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Link);
|
||||
}
|
||||
|
||||
private void SetCount()
|
||||
|
|
|
@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
|
|||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||
using BizHawk.Client.EmuHawk.WinFormExtensions;
|
||||
|
||||
//TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it?
|
||||
//perhaps missing domains shouldnt fail a check
|
||||
|
@ -527,7 +528,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CDL_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void CDL_DragDrop(object sender, DragEventArgs e)
|
||||
|
@ -539,8 +540,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void tsbViewStyle_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateDisplay(true);
|
||||
|
|
|
@ -682,7 +682,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void NewCheatForm_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void CheatsContextMenu_Opening(object sender, CancelEventArgs e)
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected void GenericDragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Set(DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
protected void RefreshFloatingWindowControl(bool floatingWindow)
|
||||
|
|
Loading…
Reference in New Issue