mirror of https://github.com/2dust/v2rayN
Remove some pop-up messages
parent
afaad49879
commit
0185b3b145
|
@ -54,7 +54,7 @@ namespace v2rayN
|
|||
{
|
||||
if (ConfigHandler.LoadConfig(ref _config) != 0)
|
||||
{
|
||||
UI.ShowWarning($"Loading GUI configuration file is abnormal,please restart the application{Environment.NewLine}加载GUI配置文件异常,请重启应用");
|
||||
UI.Show($"Loading GUI configuration file is abnormal,please restart the application{Environment.NewLine}加载GUI配置文件异常,请重启应用");
|
||||
Application.Current.Shutdown();
|
||||
Environment.Exit(0);
|
||||
return;
|
||||
|
|
|
@ -12,11 +12,6 @@ namespace v2rayN
|
|||
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
||||
}
|
||||
|
||||
public static void ShowWarning(string msg)
|
||||
{
|
||||
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
||||
}
|
||||
|
||||
public static MessageBoxResult ShowYesNo(string msg)
|
||||
{
|
||||
return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
|
|
|
@ -1186,7 +1186,7 @@ namespace v2rayN.Handler
|
|||
|
||||
ProfileItem profileItem = new();
|
||||
//Is v2ray configuration
|
||||
V2rayConfig? v2rayConfig = JsonUtile.Deserialize<V2rayConfig>(clipboardData);
|
||||
var v2rayConfig = JsonUtile.Deserialize<V2rayConfig>(clipboardData);
|
||||
if (v2rayConfig?.inbounds?.Count > 0
|
||||
&& v2rayConfig.outbounds?.Count > 0)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.Win32;
|
||||
using Splat;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
@ -125,7 +126,7 @@ namespace v2rayN.Handler
|
|||
}
|
||||
if (item.configType == EConfigType.Custom)
|
||||
{
|
||||
UI.Show(ResUI.NonVmessService);
|
||||
Locator.Current.GetService<NoticeHandler>()?.Enqueue(ResUI.NonVmessService);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -146,11 +147,12 @@ namespace v2rayN.Handler
|
|||
}
|
||||
if (CoreConfigHandler.GenerateClientConfig(item, fileName, out string msg, out string content) != 0)
|
||||
{
|
||||
UI.Show(msg);
|
||||
Locator.Current.GetService<NoticeHandler>()?.Enqueue(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
UI.ShowWarning(string.Format(ResUI.SaveClientConfigurationIn, fileName));
|
||||
msg = string.Format(ResUI.SaveClientConfigurationIn, fileName);
|
||||
Locator.Current.GetService<NoticeHandler>()?.SendMessageAndEnqueue(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,5 +29,11 @@ namespace v2rayN.Handler
|
|||
msg = $"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} {msg}";
|
||||
MessageBus.Current.SendMessage(msg, Global.CommandSendMsgView);
|
||||
}
|
||||
|
||||
public void SendMessageAndEnqueue(string msg)
|
||||
{
|
||||
_snackbarMessageQueue?.Enqueue(msg);
|
||||
MessageBus.Current.SendMessage(msg, Global.CommandSendMsgView);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,13 +64,13 @@ namespace v2rayN.ViewModels
|
|||
string remarks = SelectedSource.remarks;
|
||||
if (Utile.IsNullOrEmpty(remarks))
|
||||
{
|
||||
UI.Show(ResUI.PleaseFillRemarks);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utile.IsNullOrEmpty(SelectedSource.address))
|
||||
{
|
||||
UI.Show(ResUI.FillServerAddressCustom);
|
||||
_noticeHandler?.Enqueue(ResUI.FillServerAddressCustom);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,13 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.Show(ResUI.OperationFailed);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
private void BrowseServer()
|
||||
{
|
||||
//UI.Show(ResUI.CustomServerTips);
|
||||
//_noticeHandler?.Enqueue(ResUI.CustomServerTips);
|
||||
|
||||
if (UI.OpenFileDialog(out string fileName,
|
||||
"Config|*.json|YAML|*.yaml;*.yml|All|*.*") != true)
|
||||
|
@ -127,7 +127,7 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.ShowWarning(ResUI.FailedImportedCustomServer);
|
||||
_noticeHandler?.Enqueue(ResUI.FailedImportedCustomServer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ namespace v2rayN.ViewModels
|
|||
var address = SelectedSource.address;
|
||||
if (Utile.IsNullOrEmpty(address))
|
||||
{
|
||||
UI.Show(ResUI.FillServerAddressCustom);
|
||||
_noticeHandler?.Enqueue(ResUI.FillServerAddressCustom);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,32 +51,32 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (Utile.IsNullOrEmpty(SelectedSource.remarks))
|
||||
{
|
||||
UI.Show(ResUI.PleaseFillRemarks);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utile.IsNullOrEmpty(SelectedSource.address))
|
||||
{
|
||||
UI.Show(ResUI.FillServerAddress);
|
||||
_noticeHandler?.Enqueue(ResUI.FillServerAddress);
|
||||
return;
|
||||
}
|
||||
var port = SelectedSource.port.ToString();
|
||||
if (Utile.IsNullOrEmpty(port) || !Utile.IsNumeric(port)
|
||||
|| SelectedSource.port <= 0 || SelectedSource.port >= Global.MaxPort)
|
||||
{
|
||||
UI.Show(ResUI.FillCorrectServerPort);
|
||||
_noticeHandler?.Enqueue(ResUI.FillCorrectServerPort);
|
||||
return;
|
||||
}
|
||||
if (SelectedSource.configType == EConfigType.Shadowsocks)
|
||||
{
|
||||
if (Utile.IsNullOrEmpty(SelectedSource.id))
|
||||
{
|
||||
UI.Show(ResUI.FillPassword);
|
||||
_noticeHandler?.Enqueue(ResUI.FillPassword);
|
||||
return;
|
||||
}
|
||||
if (Utile.IsNullOrEmpty(SelectedSource.security))
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectEncryption);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseSelectEncryption);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (Utile.IsNullOrEmpty(SelectedSource.id))
|
||||
{
|
||||
UI.Show(ResUI.FillUUID);
|
||||
_noticeHandler?.Enqueue(ResUI.FillUUID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.Show(ResUI.OperationFailed);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (normalDNS.Contains("{") || normalDNS.Contains("}"))
|
||||
{
|
||||
UI.Show(ResUI.FillCorrectDNSText);
|
||||
_noticeHandler?.Enqueue(ResUI.FillCorrectDNSText);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ namespace v2rayN.ViewModels
|
|||
var obj2 = JsonUtile.Deserialize<Dns4Sbox>(normalDNS2);
|
||||
if (obj2 == null)
|
||||
{
|
||||
UI.Show(ResUI.FillCorrectDNSText);
|
||||
_noticeHandler?.Enqueue(ResUI.FillCorrectDNSText);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ namespace v2rayN.ViewModels
|
|||
var obj2 = JsonUtile.Deserialize<Dns4Sbox>(tunDNS2);
|
||||
if (obj2 == null)
|
||||
{
|
||||
UI.Show(ResUI.FillCorrectDNSText);
|
||||
_noticeHandler?.Enqueue(ResUI.FillCorrectDNSText);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1434,11 +1434,11 @@ namespace v2rayN.ViewModels
|
|||
InitSubscriptionView();
|
||||
RefreshServers();
|
||||
Reload();
|
||||
UI.Show(ResUI.OperationSuccess);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
_noticeHandler.Enqueue(ResUI.OperationFailed);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace v2rayN.ViewModels
|
|||
if (Utile.IsNullOrEmpty(localPort.ToString()) || !Utile.IsNumeric(localPort.ToString())
|
||||
|| localPort <= 0 || localPort >= Global.MaxPort)
|
||||
{
|
||||
UI.Show(ResUI.FillLocalListeningPort);
|
||||
_noticeHandler?.Enqueue(ResUI.FillLocalListeningPort);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ namespace v2rayN.ViewModels
|
|||
// || Utile.IsNullOrEmpty(KcpreadBufferSize.ToString()) || !Utile.IsNumeric(KcpreadBufferSize.ToString())
|
||||
// || Utile.IsNullOrEmpty(KcpwriteBufferSize.ToString()) || !Utile.IsNumeric(KcpwriteBufferSize.ToString()))
|
||||
//{
|
||||
// UI.Show(ResUI.FillKcpParameters);
|
||||
// _noticeHandler?.Enqueue(ResUI.FillKcpParameters);
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
@ -342,7 +342,7 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.ShowWarning(ResUI.OperationFailed);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace v2rayN.ViewModels
|
|||
|
||||
if (!hasRule)
|
||||
{
|
||||
UI.ShowWarning(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP/Process"));
|
||||
_noticeHandler?.Enqueue(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP/Process"));
|
||||
return;
|
||||
}
|
||||
//_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectRules);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
|
||||
return;
|
||||
}
|
||||
if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No)
|
||||
|
@ -192,7 +192,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectRules);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ namespace v2rayN.ViewModels
|
|||
if (lst.Count > 0)
|
||||
{
|
||||
Utile.SetClipboardData(JsonUtile.Serialize(lst));
|
||||
//UI.Show(ResUI.OperationSuccess"));
|
||||
//_noticeHandler?.Enqueue(ResUI.OperationSuccess"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectRules);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ namespace v2rayN.ViewModels
|
|||
string remarks = SelectedRouting.remarks;
|
||||
if (Utile.IsNullOrEmpty(remarks))
|
||||
{
|
||||
UI.Show(ResUI.PleaseFillRemarks);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
|
||||
return;
|
||||
}
|
||||
var item = SelectedRouting;
|
||||
|
@ -255,7 +255,7 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.ShowWarning(ResUI.OperationFailed);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ namespace v2rayN.ViewModels
|
|||
if (AddBatchRoutingRules(SelectedRouting, result) == 0)
|
||||
{
|
||||
RefreshRulesItems();
|
||||
UI.Show(ResUI.OperationSuccess);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ namespace v2rayN.ViewModels
|
|||
if (AddBatchRoutingRules(SelectedRouting, clipboardData) == 0)
|
||||
{
|
||||
RefreshRulesItems();
|
||||
UI.Show(ResUI.OperationSuccess);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ namespace v2rayN.ViewModels
|
|||
var url = SelectedRouting.url;
|
||||
if (Utile.IsNullOrEmpty(url))
|
||||
{
|
||||
UI.Show(ResUI.MsgNeedUrl);
|
||||
_noticeHandler?.Enqueue(ResUI.MsgNeedUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
RefreshRulesItems();
|
||||
}));
|
||||
UI.Show(ResUI.OperationSuccess);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.ShowWarning(ResUI.OperationFailed);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace v2rayN.ViewModels
|
|||
BlockDomain = "geosite:category-ads-all";
|
||||
|
||||
//_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
UI.Show(ResUI.OperationSuccess);
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
}
|
||||
|
||||
public void RoutingAdvancedEdit(bool blNew)
|
||||
|
@ -259,7 +259,7 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
if (SelectedSource is null || SelectedSource.remarks.IsNullOrEmpty())
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectRules);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
|
||||
return;
|
||||
}
|
||||
if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No)
|
||||
|
@ -284,7 +284,7 @@ namespace v2rayN.ViewModels
|
|||
var item = LazyConfig.Instance.GetRoutingItem(SelectedSource?.id);
|
||||
if (item is null)
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectRules);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace v2rayN.ViewModels
|
|||
string remarks = SelectedSource.remarks;
|
||||
if (string.IsNullOrEmpty(remarks))
|
||||
{
|
||||
UI.Show(ResUI.PleaseFillRemarks);
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace v2rayN.Views
|
|||
}
|
||||
else
|
||||
{
|
||||
UI.ShowWarning(ResUI.OperationFailed);
|
||||
UI.Show(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue