c#


WPF Application moves offscreen during remote access session


i have a problem in which i am hoping to find the best and easiest to implement solution.
I have written a WPF application which can be dragged around the desktop but i usually put it in the top right hand corner of the screen.
My problem is that when i remote dial in from another location - where the resolution is always lower - the application is offscreen and there is no way for me to get it back unless i kill the process and relaunch it.
I have thought of some ideas in order to always keep it visible.
1] Whenever it is running have it spawn a child thread that checks the visible resolution in a loop. When it is outside the detected bounds it will update its location.
2] Use some sort of messaging system to send it a message when i remote in - and that will trigger it to re-align itself.
Does anyone have any suggestions??
You could have a DispatcherTimer that fires periodically (every few seconds) to ensure that the window is on one of the visible screens. If not, it would reposition so that it is.
You can use the System.Windows.Forms.Screen class to access information about the user's desktop and screen setup, even though you're using WPF.
Something like:
bool isWithin = false;
foreach (Screen screen in Screen.AllScreens)
{
if (screen.Bounds.Contains(windowLocation))
isWithin = true;
}
// if !isWithin, move to 0,0

Related Links

How to convert array elements in native iOS (Objective-C to C#)
How to add new items in Gridview through POPUP WINDOW
how to avoid open page already exist on Navigation stack? [duplicate]
Create Entity Framework model based on an existing database in ASP.NET Core
Rotate image in a button
WPF: Updating Database (TwoWay) doesn´t work with Linq-Query
c# How to avoid child form to inherit his mdi parent WindowState property?
Using type FileInfo in WPF XAML
Password encryption in PHP equivalent to C#
Is it possible that a C# method parameter of some kind of int can accept null and can update argument
How to dynamically merge a reactivelist of observables into one observable in ReactiveUI, C#
Cannot implicitly convert type 'app.a1<<string>>' to 'app.a1<<object>>'
What exactly are the resources used when querying a database and why do they need disposing?
RegularExpressionValidator ErrorMessage With Border Overflowing Across Two Lines
How to make custom date validation attribute?
C# Stack Array, Push method pushes the value to ALL entries

Categories

HOME
c#
sql-server-2014
readdir
x86-64
hex
itext7
xss
thermal-printer
docker-compose
hibernate-mapping
runtime
olap
decoding
chef-recipe
element
jsfiddle
multibinding
hapijs
novacode-docx
bootstrap-datetimepicker
cherrypy
android-navigation-drawer
infinite-loop
ithit-webdav-server
inspec
continuous-fourier
units-of-measurement
2checkout
boost-log
loopback
log4net-configuration
jcr
javax
ragel
rythm
mapquest
iterm2
scalamock
jslider
socketcluster
delphi-xe
vpython
niagara-ax
azure-data-catalog
automapper-4
easyquery
hdpi
ear
e4
jscoverage
wink
aot
overhead
scanf
sharing
portaudio
ownership
consolidation
strtol
konakart
weblogic-maven-plugin
audiorecord
laterjs
jmap
google-app-engine-php
angular-promise
taverna
eaaccessory
polarion
data-representation
veeam
qf-test
go-gin
ios-enterprise
rda
pidgin
object-oriented-database
mahara
jython-2.5
gwt2
openafs
flatten
jqueryi-ui-buttonset
facebook-winjs-sdk
virtual-destructor
mediastreamsource
iphone-maps
helios
calendarextender
mdd
focus-stealing

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App