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

Visual Studio 2008 not loading symbols when debugging a .DMP
Need emergency help with dw20.exe process? [closed]
Making scribbles on a monochrome image
Covariant instance types on open instance delegates
AS3 Typed Objets Serialization to C# Hashtables and back
How to get host domain from asp.net
I'm validating XML against XSD in Windows Forms using C# .NET and it's giving me the error “Please Suggest the fix”
how to Create “Keep Alive” for a chat app?
AT Command for receiving automatic SMS notification
NSAutoReleasePool and async functions
Apriori algorithm explanation
image upload and preview in mvc 2
Usage of Lazy<T>
Does LazyInitializer.EnsureInitialized<T> have an explicit promise of thread safety?
Using SqlDependency results in constant updates
Binding with a converter inside a template

Categories

HOME
joomla
gulp
stanford-nlp
typo3
okhttp3
bitbucket
opc-ua
xss
snmp
aggregation-framework
opacity
hibernate-mapping
open-search-server
ephesoft
yacc
pyodbc
ejb-3.0
angularjs-ng-repeat
openbsd
select2
vichuploaderbundle
box2d
exchange-transport-agents
appsettings
beacon
gpo
custom-component
xna
serenity-js
email-client
struts
scrapy-spider
windows-mobile
emr
keil
log4net-configuration
imageprocessor
azure-storage-files
dotnetnuke-module
yelp
redhat-brms
nscollectionview
file-conversion
fisheye
rbac
php-mongodb
codepen
gridgain
line-endings
remap
stream-socket-client
denodo
spring-cloud-bus
playframework-1.x
htop
business-catalyst
ios-keyboard-extension
lattice
alarmmanager
easy-thumbnails
normalisation
angularfire
jde
cexception
updating
eula
web-standards
esb-toolkit-2.1
indices
windows-search
oxygenxml
kernel-density
db2-connect
adabas
mysql-error-1146
lastinsertid
grunt-contrib-imagemin
dylan
ia-32
objectdatasource
kohana-orm
friendly-url
removeall
qmainwindow
microsoft-speech-platform
idoc
report-viewer2010
teamsystem
webpage-screenshot
php-gettext
joomla1.7
scsf
cgaffinetransform
parallel-python
javah
azure-appfabric
zend-acl
cons
ironpython-studio

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