foreground

How to bring a window foreground using c#?

守給你的承諾、 提交于 2019-12-03 04:33:21
I am trying to bring a window foreground. I am using this code. But its not working. Could someone please help? ShowWindowAsync(wnd.hWnd, SW_SHOW); SetForegroundWindow(wnd.hWnd); // Code from Karl E. Peterson, www.mvps.org/vb/sample.htm // Converted to Delphi by Ray Lischner // Published in The Delphi Magazine 55, page 16 // Converted to C# by Kevin Gale IntPtr foregroundWindow = GetForegroundWindow(); IntPtr Dummy = IntPtr.Zero; uint foregroundThreadId = GetWindowThreadProcessId(foregroundWindow, Dummy); uint thisThreadId = GetWindowThreadProcessId(wnd.hWnd, Dummy); if (AttachThreadInput

Communicate with foreground service android

余生颓废 提交于 2019-12-03 01:55:07
First question here, but I've been around for a while. What do I have: I'm building an Android app which plays audio streams and online playlists. Everything is working fine now, but I'm having issues in communicating with my service. The music is playing in a Service, started with startForeground, so it doesn't gets killed. I need to communicate from my activity with the service, for getting the track name, image, and a couple of things more. Whats my issue: I think I need to start my service with bindService (instead of my current startService) so the activity can talk to it. However, when I

How to know if my application is in foreground or background, android?

久未见 提交于 2019-12-02 21:14:45
I need to check if my application is running in background or foreground and then perform some operations relatively to it. I searched a lot and a clear solution is not available. Make a parent activity in its onPause() and onResume() methods keep some variable to update them accordingly. When you create any new activity inherit your parent activity. Although this is the best solution I feel to achieve my task, but sometimes if the power button is clicked even though application is in background, it's onResume() is invoked. Use GETTASKS permission - This solution is also good. But it can only

Hide notification of foreground service while activity is visible

ⅰ亾dé卋堺 提交于 2019-12-02 20:46:16
Is their a way to start a service as a foreground service and hide the notification while an activity is visible? Consider a music player, while the app is opened, you don't need the notification (with i.e. the buttons), but whenever the music player is in the background, the notification should be shown. I know, how to do this, if I DON'T run my service in foreground... But when running in foreground, the service itself needs the notification and shows it and I can't manage the notification by myself... How can I solve that problem? You can do it like this. One prerequisite to this method is,

How to know if my android app is visible?

不羁的心 提交于 2019-12-02 19:11:54
I have a timer that start a notification when it ends. But I would like to fire a notification using notificationManager only if the app is not currently visible, and to show an alertDialog if the timer ends while the app is in foreground. I've already tried with this : ActivityManager actMngr = (ActivityManager) ValeoMobileApplication.getContext().getSystemService(Activity.ACTIVITY_SERVICE); List<RunningAppProcessInfo> runningAppProcesses = actMngr.getRunningAppProcesses(); Tools.log("TimerBroadcastReceiver", "onReceive", "All running processes are listed below :"); for (RunningAppProcessInfo

Datagrid foreground colour not working

眉间皱痕 提交于 2019-12-02 12:47:44
I have a simple datagrid that display bidimensional data. I have tried it in a test project and the result is nice. Here is the xmal: <Grid > <DataGrid Name="dg" Margin="50" FontSize="26" CellEditEnding="dg_CellEditEnding" BeginningEdit="dg_BeginningEdit" LoadingRow="DataGrid_LoadingRow" EnableRowVirtualization="False" AutoGeneratingColumn="dg_AutoGeneratingColumn"/> </Grid> and the relevant event code: private void DataGrid_LoadingRow(object sender, System.Windows.Controls.DataGridRowEventArgs e) { e.Row.Header = "R" + ((e.Row.GetIndex()) + 1).ToString(); } private void dg

Stop Background audio while starting

馋奶兔 提交于 2019-12-02 10:00:26
问题 I could make the application, to play the audio when it moves to the background, by adding the setting in info.plist file. But, when some other iOS application plays background audio, and when the current application comes to foreground, how to stop the background audio invoked by other application? 回答1: Have a look at AVAudioSession class and AVAudioSession programming guide by Apple. This will hopefully steer you in the right direction. To stop background audio when your application starts

Stop Background audio while starting

こ雲淡風輕ζ 提交于 2019-12-02 07:24:58
I could make the application, to play the audio when it moves to the background, by adding the setting in info.plist file. But, when some other iOS application plays background audio, and when the current application comes to foreground, how to stop the background audio invoked by other application? Have a look at AVAudioSession class and AVAudioSession programming guide by Apple. This will hopefully steer you in the right direction. To stop background audio when your application starts set your audio session to a non-mixable category and mode then set active. If you don't configure an audio

UILocalNotification not firing when the app is in working mode

筅森魡賤 提交于 2019-12-02 03:22:18
问题 There are quite a few questions on why local notification is not firing properly here and there,also there are several questions on why local notification is not firing when the application is in background state which I have also gone through them. But to my surprise I haven't found any notification post related to foreground state or in active state,i.e. in my app I am facing this strange issue,i.e. local notification fires when the app enters background mode and it doesn't fire when the

WPF: How do I set the Foreground property of a TextBlock by TextBlock text value?

一世执手 提交于 2019-12-02 02:08:36
it’s possible set the foreground property of a TextBlock by TextBlock text value? For example: Text value is Mike, foreground property is Black, value is Tim, property value is green, etc. I search with google, but I don’t find any solution. If you want the flexibility to do something smart, such as dynamically map texts to colors and so on, you could use a Converter class. I am assuming the text is set to bind to something, you could bind to the same something in Foreground but through a custom converter: <TextBlock Text="{Binding Path=Foo}" Foreground="{Binding Path=Foo, Converter=