我有一个vb.net程序,用Process.start()
调用.exe关于这个.exe的简短摘要:它从WebServer下载文件并在下载开始时发送一些Windows通知..如果我刚开始我的“LiveUpdate”,这个算法工作正常.exe“文件。
这是我在vb.net代码中的调用:
Process.Start(location & "LiveUpdate.exe", "-f "settings.ini")
这是我的c#通知方法
public void Popup(string title, string description, Icon systemIcon, ToolTipIcon icon = ToolTipIcon.Info)
{
var notification = new NotifyIcon()
{
Visible = true,
Icon = systemIcon, //SystemIcons.Information,
BalloonTipIcon = icon,
BalloonTipTitle = title,
BalloonTipText = description
};
Task.Run(() => OpenAndCloseNotification(notification, 2));
}
public void OpenAndCloseNotification(NotifyIcon notification, int secconds)
{
var milisecconds = secconds * 1000;
notification.ShowBalloonTip(milisecconds);
Thread.Sleep(milisecconds);
notification.Dispose();
}
好吧,vb.net不允许弹出Windows - 通知?如果您需要,我会附上更多代码,提前谢谢。
对不起,来晚了
这就是它的外观,您可以更改背景图像并删除透明胶片。如果不这样做,请选择具有普通背景的背景,因此它将该颜色设置为透明,并且仅保留中心图像的形状。
<blockquote class="imgur-embed-pub" lang="en" data-id="a/V2WnhOA"><a href="//imgur.com/V2WnhOA"></a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
Private x, y As Integer
Private fondo As Image
Private icono As Icon
Private WithEvents temporizador As Timer
Private inicio As DateTime
Private tiempo As Integer
Private Sub FNotifi_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim destination = New Bitmap(Size.Width, Size.Height)
Dim original = Image.FromFile(".\Resources\Imagenes\Fondo1_2.bmp")
Using g = Graphics.FromImage(destination)
g.InterpolationMode = InterpolationMode.NearestNeighbor
g.DrawImage(original, New Rectangle(0, 0, destination.Width, destination.Height), New Rectangle(0, 0, original.Width, original.Height), GraphicsUnit.Pixel)
End Using
Dim bmp As Bitmap
' bmp = New Bitmap(".\Resources\Imagenes\Fondo1_2.bmp")
bmp = New Bitmap(destination)
'el color del pixel(1,1) (esquina sup. izda.) del Bitmap será renderizado
'como transparente en el Bitmap (color RGB 255,0,0)
'bmp.MakeTransparent(bmp.GetPixel(1, 1))
'colocar el Bitmap como fondo del formulario
Me.BackgroundImage = bmp
'el color del pixel(1,1) (esquina sup. izda.) del Bitmap será renderizado
'como transparente también en el formulario (color RGB 255,0,0)
Me.TransparencyKey = bmp.GetPixel(1, 1)
Me.BackgroundImageLayout = ImageLayout.Zoom
Dim workingArea As Rectangle = Screen.GetWorkingArea(Me)
x = workingArea.Right - Size.Width
y = workingArea.Bottom - Size.Height
Me.Location = New Point(x, y)
End Sub
Public Sub New(Titulo As String, mensaje As String, ByRef tempo As Timer, Optional tiempo As Integer = 10000)
' Esta llamada es exigida por el diseñador.
InitializeComponent()
inicio = Now
temporizador = tempo
Me.tiempo = tiempo
LblTitulo.Text = Titulo
LblMensaje.Text = mensaje
End Sub
<blockquote class="imgur-embed-pub" lang="en" data-id="a/BW171wJ"><a href="//imgur.com/BW171wJ"></a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
<blockquote class="imgur-embed-pub" lang="en" data-id="a/BW171wJ"><a href="//imgur.com/BW171wJ"></a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
自Windows 10以来,我也遇到过许多Windows通知问题。我不知道它取决于什么,但有时是有效的,有些则不然。
你试图直接在clic的按钮事件上显示通知吗?至少那样你会检查它是否有效。
无论如何,最后我必须做的是创建我自己的通知,其中一个表单在所需时间内显示在桌面的角落。
如果您对此解决方案感兴趣,我会向您展示代码