1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-23 03:15:48 +02:00

Add a custom alert function with customizable icon and no text length limit

This commit is contained in:
chylex 2016-09-04 13:19:52 +02:00
parent 1450cc24a3
commit d76027558b
2 changed files with 17 additions and 4 deletions
Core/Handling
Resources/Scripts

View File

@ -155,6 +155,19 @@ public void OpenBrowser(string url){
BrowserUtils.OpenExternalBrowser(url);
}
public void Alert(string type, string contents){
MessageBoxIcon icon;
switch(type){
case "error": icon = MessageBoxIcon.Error; break;
case "warning": icon = MessageBoxIcon.Warning; break;
case "info": icon = MessageBoxIcon.Information; break;
default: icon = MessageBoxIcon.None; break;
}
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
}
public void Log(string data){
System.Diagnostics.Debug.WriteLine(data);
}

View File

@ -11,7 +11,7 @@
obj = eval("("+contents+")");
}catch(err){
if (!(onFailure && onFailure(err.message))){
alert("Problem loading '"+fileName+"' file for '"+identifier+"' plugin, the JavaScript syntax is invalid: "+err.message);
$TD.alert("warning", "Problem loading '"+fileName+"' file for '"+identifier+"' plugin, the JavaScript syntax is invalid: "+err.message);
}
return;
@ -20,7 +20,7 @@
onSuccess && onSuccess(obj);
}).catch(err => {
if (!(onFailure && onFailure(err))){
alert("Problem loading '"+fileName+"' file for '"+identifier+"' plugin: "+err);
$TD.alert("warning", "Problem loading '"+fileName+"' file for '"+identifier+"' plugin: "+err);
}
});
};
@ -36,7 +36,7 @@
continueLoading(token, identifier, fileNameUser, onSuccess, onFailure);
}).catch(err => {
if (!(onFailure && onFailure(err))){
alert("Problem generating '"+fileNameUser+"' file for '"+identifier+"' plugin: "+err);
$TD.alert("warning", "Problem generating '"+fileNameUser+"' file for '"+identifier+"' plugin: "+err);
}
});
}
@ -45,7 +45,7 @@
}
}).catch(err => {
if (!(onFailure && onFailure(err))){
alert("Problem checking '"+fileNameUser+"' file for '"+identifier+"' plugin: "+err);
$TD.alert("warning", "Problem checking '"+fileNameUser+"' file for '"+identifier+"' plugin: "+err);
}
});
};