I have a working Windows Service (on Windows 10, .Net471) that implements ServiceStack AppSelfHost Base and provides a number of (so far) simple REST APIs. I'd like to add NotifyIcon type of functionality, so that the service displays an icon in the Windows Notification Area for all users on the machine, and right-clicking that icon displays a context menu of actions. I've tried implementing the NotifyIcon WinForms component in the AppHost.Configure method, naively following the instructions here NotifyIcon. This naive implementation does not work; when the System.Windows.Forms.Application.Run() is called, the NotifyIcon functionality works, but the .Run() call (in AppHost.Configure) does not return, and then no ServiceStack REST APIs work; if I comment out the call to .Run(), the ServiceStack code works, but NotifyIcon functionality does not. Can anyone please point me towards links or examples that show a self-hosted ServiceStack implementation that provides an icon in the Windows Notification area, and a context menu of functions that appear when the icon is right-clicked? TIA!
Related
I am new to Xamarin and not sure if chose Xamarin.Forms to create a application for ios and android platform has a problem or not.
The application has some features below:
The application will be able to running some code in background without launching application by user.
The application can be launched by a href link or a notification.
The application is able to launch a builtin Camera application, and receive picture data from Camera application.
Thanks,
Bo
The features you are mentioning can be done with both. Actually, anything you can do on Xamarin.iOS and Xamarin.Android can be done with Forms. Because Forms is only an abstraction layer for the UI which is installed by a NuGet package.
Now, having that said when to use Forms or when to use iOS/Android? It is mostly about UI. Are you going to do some advanced or platform specific stuff is is easier to implement that with the platform specific project.
If you UI will be the same in both platforms and mostly consists of some lists and input fields, then that is a very good candidate for a Forms project.
Notice how I said it is easier to do in the platform specific projects. Again here, you can do anything in Forms as well by the means of Custom Renderers, it is just a bit harder to do.
Ideally try it out yourself and see what suits you best.
In regard with your need to execute code in the background. This will be tricky and is very dependent on the platform that you're on. You will definitely have to write platform specific code for that for which you can use the DependencyService to abstract it to your shared code.
However like AlancLui mentioned executing code in the background isn't something that is easy to do on mobile. On iOS it is restricted to accessing location data or playing music, but still your app needs to be running (in the background). Android has something called Services for this, which makes it a bit easier.
I am working on creating a Windows 10 Universal app. My goal is to have the app run in the background and periodically display a status notification to the user.
I've seen a few articles that talk about creating a background task within the app (https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/run-a-background-task-on-a-timer-), is this the best design pattern I can follow? I'm fairly new to Windows Universal apps and any recommendations on how to do this would be appreciated.
Look at the IBackgroundTask docs. In addition, you can easily implement notifications via the OS with Adaptive Toasts
Since the story around notifications can get complex depending on how you want to control UX, don't be afraid to research building an RT component if you can't find a UWP API that meets your needs. For instance, you can package an RT component with your UWP app that calls into native C++ libraries or more low-level Windows APIs to curate the notification experience for your user.
Microsoft Coded UI Test (CUIT). Can I create an independent (external) Visual Studio 2012 Premium or Ultimate solution in C# to record on my application UI without the application's source code? This solution can reference the application's assemblies. The CUIT API does not seem to help. It is not desirable to use Microsoft guidelines in doing CUIT, as it creates and inserts a test project into the application's solution. The development team does not want this test project, created by the QA team, to be part of their source code to check into their source control.
Coded UI testing with Visual Studio is about testing the user interface of an application. Coded UI does not care how the application was constructed (but see Note below). Coded UI test projects do not need to be in the same solution as the application. Coded UI can be used to test websites and web applications (via a web browser) where there is no Visual Studio solution available for the application. Coded UI can also be used as an automation tool, to automate routine operations that use several programs and websites to perform some action. For such automation there would be no single solution file that should have the Coded UI project.
My understanding of Microsoft's Coded UI guidelines is that sometimes it is good to have application and test in the same solution, just to keep them together so as to encourage testers and developers to use the test and keep them up to date. But there is nothing to force such togetherness.
I do not understand the impact of this sentence in the original question: "This solution can reference the application's assemblies."
Note: Coded UI needs the application under test to expose some of its user interface properties via the MSAA or UIA mechanisms. This is done for you with many types of software. See the "Platform Support" section of the "Content Index for Coded UI Test" at http://blogs.msdn.com/b/mathew_aniyan/archive/2010/02/11/content-index-for-coded-ui-test.aspx .
Added 2013-05-02:
The clarification, within the comment, about wanting to link a Coded UI test to the DLLs of an application suggests there may be some confusion between what Coded UI tests are for and what unit tests are for.
Coded UI accesses the user interface of an application much like a screen reader for the visually impaired would. It also moves the mouse pointer, clicks buttons or links and enters text much like the software for people who cannot use a normal keyboard or mouse. Coded UI does not access the code directly so it does not need to reference any DLLs of the application. Before testing your application, I suggest you experiment with writing Coded UI tests to drive the Windows Calculator or to fill in forms on web pages. There are many videos and tutorials on the internet that demonstrate how to use Coded UI. Once you have some understanding of what Coded UI does and how to use it, you should be in a much better position to test your application.
We are building a WinRT application with JavaScript (WinJS) that accesses REST/JSON web services via C# WinRT Component library. In the component library we have a Logon control (much like WebAuthenticationBroker) that allowes us to use ACS logon with our REST services.
Application Layers:
Client (JS)
WinRT component dll (C#)
C# ClassLibrary dll (C#)
UserControl (Xaml/C#, contains WebView)
The problem: When trying to create the logon control, the WinRT throws "HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)" exception (when entering the UserControl's constructor) even if I call it via Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher (recommended in MSDN article I found about WinJS/C++ component).
If I call it from a Xaml/C# client, the code works with or without the Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher.RunAsync().
I've tried to google this and also read all the UserControl, Dispatcher and WinJS documentation but I have not found anything relevant. Is this a known problem and could someone suggest a workaround?
Since I'm a first time poster, please be gentle :-) Any help is extremely welcome!
Xaml-based WinRT controls cannot be used in Javascript-based WinRT projects. You can use any WinRT class library, but not Xaml controls inside them.
If you still want to combine HTML-Javascript with Xaml, I would recommend creating a Xaml-based project, and wrapping your HTML UI in a WebView control.
I wouldn't expect it to be possible to use WinRT/XAML UI in an HTML/WinJS app. You would probably need to use some callbacks to request the UI to be created in a WinJS app/component library instead of the XAML one.
I have experience with Android's search functionality as described here: http://developer.android.com/guide/topics/search/index.html, but haven't been able to find anything similar for windows phone 7.
Alternatively, what is the best approach to provide search functionality within your windows phone application?
The search scope is within the application itself, and while it is obviously possible to implement it myself, I'm looking for something that follows the ui guidelines of windows phone 7, and possibly also an interface to provide search results from the app, even when the search button is pressed while the app is in the background.
You are fully responsible for handling search within your app. There are no WP7 specific guidelines or tools available. Do what's best within the context of your app.
You cannot integrate with the built in search facility to include app specific results with anything returned as part of a bing search.
To add, interface to Windows Phone 7 hardware search button is not exposed to third party developers. You need to provide your own search button in the application and handle it appropriately.