我已经创建了WPF应用。关闭窗口时(通过单击标题栏上的X),我正在隐藏应用程序,我们可以从任务栏图标重新启动或退出该应用程序。
function updatedata(Request $req)
{
dd($req->input());
$post=User::find($req->input('userid'));
$post->name=$req->input('name');
$post->address=$req->input('address');
$post->photo=$req->input('image');
$post->gender=$req->input('gender');
$post->hobbies= implode(',', Input::get('hobbies'));
$post->std=$req->input('std');
$requestData = $req->all();
if($req->hasFile('image'))
{
$image=$req->file('image');
$rules = array('file' => 'required|mimes:png,gif,jpeg'); // 'required|mimes:png,gif,jpeg,txt,pdf,doc'
$validator = \Illuminate\Support\Facades\Validator::make(array('file'=> $file), $rules);
$pathToStore=public_path('/');
if($validator->passes())
{
$filename = $file->getClientOriginalName();
$extension = $file -> getClientOriginalExtension();
$picture = sha1($filename . time()) . '.' . $extension;
$upload_success = $file->move($pathToStore, $picture);
if($upload_success)
{
//if success, create thumb
$image = Image::make($picture)->resize(600, 531)->save($pathToStore,$picture);
$oldfilename=$user->photo;
$user->photo=$filename;
Storage::delete($oldfilename);
}
}
$requestData['photo'] = "$pathToStore/{$picture}";
}
$post->update($requestData);
return redirect()->route('show');
}
通知图标对我而言很好,即当我双击任务栏图标App即将降落。以下是双击事件的代码
NotifyIcon notifyIcon = new NotifyIcon();
string a = Properties.Resources.SuccessTitle;
notifyIcon.Icon = Properties.Resources.pencil;
notifyIcon.ContextMenu = new ContextMenu(new MenuItem[]
{ exitMenuItem });
notifyIcon.Visible = true;
notifyIcon.Text = "My App Name";
notifyIcon.DoubleClick += notifyIcon_DoubleClick;
当应用程序处于最大化或最小化状态时,单击exe也可以正常工作。
if (window.IsVisible)
{
if (window.WindowState == WindowState.Minimized)
{
window.WindowState = WindowState.Normal;
window.Activate();
}
else
{
window.Activate();
}
}
else
{
window.Visibility = Visibility.Visible;
}
现在,在隐藏窗口的情况下单击exe时,我希望具有相同的效果。 我该如何实现。 我尝试调试代码,发现当应用隐藏时
MainWindowHandle = 0X00000000
,并且在可见或最小化或最大化时,MainWindowHandle具有一些有效值。