mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 19:20:27 +12:00
Fix history selection issue
This commit is contained in:
parent
82ad2deb94
commit
f576029f70
|
@ -312,14 +312,17 @@ private void UpdateTitle(HistoryItem[] historyItems = null)
|
|||
|
||||
private void UpdateControls()
|
||||
{
|
||||
if (him.RefreshInfo())
|
||||
{
|
||||
UpdatePictureBox();
|
||||
}
|
||||
else
|
||||
HistoryItem previousHistoryItem = him.HistoryItem;
|
||||
HistoryItem historyItem = him.UpdateSelectedHistoryItem();
|
||||
|
||||
if (historyItem == null)
|
||||
{
|
||||
pbThumbnail.Reset();
|
||||
}
|
||||
else if (historyItem != previousHistoryItem)
|
||||
{
|
||||
UpdatePictureBox();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePictureBox()
|
||||
|
|
|
@ -175,7 +175,7 @@ private void ImageHistoryForm_KeyDown(object sender, KeyEventArgs e)
|
|||
|
||||
private void ilvImages_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
him.RefreshInfo();
|
||||
him.UpdateSelectedHistoryItem();
|
||||
}
|
||||
|
||||
private void ilvImages_ItemDoubleClick(object sender, ItemClickEventArgs e)
|
||||
|
|
|
@ -59,34 +59,31 @@ public HistoryItemManager(Action<string> uploadFile, Action<string> editImage)
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool RefreshInfo()
|
||||
public HistoryItem UpdateSelectedHistoryItem()
|
||||
{
|
||||
HistoryItem tempHistoryItem = GetSelectedHistoryItem();
|
||||
HistoryItem = GetSelectedHistoryItem();
|
||||
|
||||
if (tempHistoryItem != null)
|
||||
if (HistoryItem != null)
|
||||
{
|
||||
if (HistoryItem != tempHistoryItem)
|
||||
{
|
||||
HistoryItem = tempHistoryItem;
|
||||
IsURLExist = !string.IsNullOrEmpty(HistoryItem.URL);
|
||||
IsShortenedURLExist = !string.IsNullOrEmpty(HistoryItem.ShortenedURL);
|
||||
IsThumbnailURLExist = !string.IsNullOrEmpty(HistoryItem.ThumbnailURL);
|
||||
IsDeletionURLExist = !string.IsNullOrEmpty(HistoryItem.DeletionURL);
|
||||
IsImageURL = IsURLExist && Helpers.IsImageFile(HistoryItem.URL);
|
||||
IsTextURL = IsURLExist && Helpers.IsTextFile(HistoryItem.URL);
|
||||
IsFilePathValid = !string.IsNullOrEmpty(HistoryItem.FilePath) && Path.HasExtension(HistoryItem.FilePath);
|
||||
IsFileExist = IsFilePathValid && File.Exists(HistoryItem.FilePath);
|
||||
IsImageFile = IsFileExist && Helpers.IsImageFile(HistoryItem.FilePath);
|
||||
IsTextFile = IsFileExist && Helpers.IsTextFile(HistoryItem.FilePath);
|
||||
|
||||
IsURLExist = !string.IsNullOrEmpty(HistoryItem.URL);
|
||||
IsShortenedURLExist = !string.IsNullOrEmpty(HistoryItem.ShortenedURL);
|
||||
IsThumbnailURLExist = !string.IsNullOrEmpty(HistoryItem.ThumbnailURL);
|
||||
IsDeletionURLExist = !string.IsNullOrEmpty(HistoryItem.DeletionURL);
|
||||
IsImageURL = IsURLExist && Helpers.IsImageFile(HistoryItem.URL);
|
||||
IsTextURL = IsURLExist && Helpers.IsTextFile(HistoryItem.URL);
|
||||
IsFilePathValid = !string.IsNullOrEmpty(HistoryItem.FilePath) && Path.HasExtension(HistoryItem.FilePath);
|
||||
IsFileExist = IsFilePathValid && File.Exists(HistoryItem.FilePath);
|
||||
IsImageFile = IsFileExist && Helpers.IsImageFile(HistoryItem.FilePath);
|
||||
IsTextFile = IsFileExist && Helpers.IsTextFile(HistoryItem.FilePath);
|
||||
|
||||
UpdateButtons();
|
||||
return true;
|
||||
}
|
||||
UpdateButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
cmsHistory.Enabled = false;
|
||||
}
|
||||
|
||||
cmsHistory.Enabled = false;
|
||||
return false;
|
||||
return HistoryItem;
|
||||
}
|
||||
|
||||
private HistoryItem GetSelectedHistoryItem()
|
||||
|
|
Loading…
Reference in a new issue