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

C# and ReSharper: Checking an object's type
How to pass more parametrers than used in an oracle query in ODP.NET without getting exception?
How to: HTTP GET and POST request with parameters in Win 8 modern app using C# and XAML
Word Interop Catch Document Edit Event
MVC best practises for Create functions in Controllers [closed]
C# create temporary url to receive HTTP request
WCF (ServiceHost) is not reachable while created from outside via Activator.CreateInstance
browser Unique id asp.net
How to pass values to javascript from c# to ascx page
What is the fastest way to count set bits in UInt32 in C#
How to write a comment in a Razor view?
FileIOPermission in WebSite
How to get linqpad to update columns
A control not contributing to the size of its container
How to set MinWorkingSet and MaxWorkingSet in a 64-bit .NET process?
Why does a domain user get UnauthorizedAccessException with read-write permissions granted to “Everyone”?

Categories

HOME
oauth-2.0
logging
ftp
fortran
ldap
azure-eventhub
casting
window.open
bigtable
salesforce-lightning
singleton
sugarcrm
aggregate-functions
meson-build
markdown
digital
urllib2
template10
printf
audio-streaming
quality-center
apdu
tftp
dynamic-memory-allocation
ilog
sampling
asp.net-webhooks
var
lex
definition
php-mongodb
ocpjp
hierarchical-clustering
react.rb
beanshell
totalview
multi-select
computed-properties
gevent
mongodb-3.3
magick.net
objectify
weblogic-maven-plugin
sbt-proguard
mojolicious
javapackager
vensim
avd
strcpy
chrome-mobile
fedena
growl
vundle
powerpoint-2010
livescript
sat4j
disparity-mapping
nest-initiative
triplestore
debuggervisualizer
azure-caching
farpoint-spread
starling-framework
ardor3d
misfire-instruction
nokogiri
record-locking
http-compression
cloudmade
dnsbl
aspmenu-control
animationdrawable
overlays
jexcelapi
designated-initializer
response-time
html5-animation
table-valued-parameters
numerical-computing
data-formats
time-management
authkit
jgrowl
memory-consumption

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