Animated Icons in Windows Phone SDK - c#

I am working on a weather app (for learning purposes) using Windows Phone SDK and C# as programming language.
I need to display an icon for each type of weather, for example, cloudy, raining, sunny, windy etc. I was wondering about what my options are.
I googled a little and found this. This is a Javascript library. Is there any way I can use this in my xaml page? If not, what are my options to show animated images in xaml?

No, you cannot use javascript based images in XAML.
You have several options here:
Use gif images (supported via third party components)
Use small videos (MediaElement)
Animate it yourself using XAML elements (hardest)
Use WebBrowser component and then import that js images (might also be hard)

Related

How can I use Rive animations in a WPF / XAML project?

I have a *.rive file and I want to use that in my WPF app like a loading spinner.
There is any way to use rive file in WPF using Image, Media Element etc.
Do I need to convert it as gif?
Short answer: You cannot
Rive is not just an animation tool, but an animation framework that requires a specially written runtime for different kinds of hosts.
Rive's documentation says they only have first-party support for:
The web (and a first-party React wrapper).
iOS, Android, Flutter, Tizen
React Native
"C++"
Note the lack of WPF, XAML, WinUI, UWP, Jupiter, Silverlight, WinForms, etc.
Microsoft's desktop developer story in 2021 sure is fun, isn't it?
MS hasn't had a clear and consistent desktop story since Windows 7, it's depressing, and still awful.
I note that "C++" isn't a platform, just a language, so it's odd that they describe it like that. Anyway, their C++ runtime ships with a renderer for Skia, which isn't of much use
Long answer: You can, if you want to put the effort in
Clone and build their C++ runtime.
Replace the Skia renderer with a new renderer of your own creation that renders to WPF somehow.
You can host Skia within WPF, but it's an opaque surface: the structure and contents of the Rive animation wouldn't be rendered directly by WPF which would introduce inefficiencies.
Also, I think WPF is still stuck on DirectX 9, and there might be functionality in Rive that would benefit from being on DX12.
And the rest is an exercise for the reader.
I haven't tested it but
here is a runtime for rive in C# + UWP
https://github.com/rive-app/rive-sharp
here is a way how to display UWP in WPF
In WPF control - display a UWP app

Custom UI control for Android and IOS using C#

I've just started looking at how I can generate and port applications to Android and IOS, I've started to look at Xamarin. First, I'm looking to generate custom UI control of a 10x10 Matrix (checkerboard - each square is a different colour) with each square being able to be selected and a specific image being displayed.
After looking at the documents and looking at MVVM examples, I'm not entirely sure what the best method of doing this : How should I structure the code (should I use just SVG drawing) or is there a better method of doing this in Android and IOS ?
To be honest I would start with Xamarin Forms and create a grid control with 10x10 image buttons. This way you get the event handling built-in. This would work for iOS, Android & Windows Phone out of the box. From there you could evolve it to more native specific code if necessary.
If you want to control the look pixel perfect then creating native custom rendered views would be the option but this is much more work of course so I would not start there. On Android you would subclass from Android.Widget.View and on iOS you would do it from MonoTouch.UIKit.UIView. For both you would override the Draw method.

Visual C#, How to display a `Unicode Character` in a label?

I have a Label and I want it to display a musical note.
This Note.
The problem is, I dont have any of the fonts that can display this note.
The fonts with support are LastResort Quivira and Symbola.
How can I display this character and make it so the compiled program will be able to display this character on another computer?
Not sure what UI framework you're using (WPF? WinForms? Browser?), but could you use Graphics Software to make a PNG or GIF of the note and display it that way? If you include the image as an Embedded Resource it would be easy to deploy with you're app.
I also see from your link the image is available in SVG format. There are libraries available for rendering SVG in WPF and WinForms.

How to render a formula in WPF or WinForms

Update 2018 TL;DR; LaTEX for WPF
https://github.com/ForNeVeR/wpf-math
Original question
I need to have a way to draw a mathematical formula in Windows Forms or WPF. Some "FormulaTextBox" control would be exactly what I need.
I'm not asking about full implementation of LaTEX, but at least something beyond RichTextBox possibilities, with division lines, square roots, etc.
Here's a list of options, pulled from several webpages online, as well as a few similar questions on SO
WPF-Math, a WPF library for rendering math-related TeX markup.
gNumerator is a WinForms control that renders MathML. It is native C#, but appears to be quite old.
Math Expressions, a commercial WinForms control for displaying and editing math equations. Note: Not free
There's an unofficial port of JMathTex to a C# WPF control
The Windows version of the LaTex editor Lyx uses a native library called MikTex you could take a look at. I saw mention somewhere that the tex4ht package renders math equations to images
MimeTex/MathTex, as you already mentioned
You could also use a WebBrowser control, and just locally include one of many javascript libraries for rendering LaTex.
You could pawn off the work onto Microsoft Word (Example - requires users to have MS Word installed!)
Perhaps you can use the Wolfram Alpha API to retrieve the images.
If you want something beyond a RichTextBox abilities to render pie, divisions and sqr roots and etc, you could just use WebBrowserControl(s) as textbox's. Then to render formula's you could leverage techniques shown in this webpage, save it to your desktop and open the html file:
http://www.wjagray.co.uk/maths/ASCIIMathTutorial.html
Obviously you'll need a special syntax (or special calculator buttons) to enter the formula's and I'm guessing from looking at the customisations.js file driving that webpage that you could make your own list of operators and functions too.
Here's what I'd do if none of the .NET specific solutions work for you:
It's a bit hacky, but it'll work and your users won't know the difference. Download the Mathjax library. When your user enters in the equation, you could convert the equation to LaTex or MathML. You would then take the LaTex or MathML and generate an HTML file that references Mathjax and display the file in your tiny WebBrowser window (valid for both WinForms and WPF). This shouldn't require an internet connection.
Like I said, your users won't be any the wiser.

C# - Winforms - Animated Slideshow

Well i am developing an application whose interface requires an animated slide show
and by animated slide show i means UI components placed together change their positions after regular intervals in a sliding (animated) fashion. Let me illustrate my idea with the following image,
(source: deviantart.com)
in the image above there are three columns of UI components that i want to slide, what i could do is simply write a module to change x,y coordinates of the components that would give the animated slide effect but that does not work fine, because it is heave takes time in processing and all plus the coding will be complex and layer adjustment and all.
is there any slide show component on which instead of image i can place UI components
What are the other options i have or what is the right way to do it. Please need help.
Sounds like are looking for a carousel feature for you component. Winforms were not intended to be animated. Fortunately some companies have worked on products that support animaiton in this area but most are moving to the Silverlight and WPF platforms for those updated features. As a reader of MSDN Magazine I often come accross some interesting advertisements of Winform components that are quite interesting. Please take a look at this link. The cost of the product is quite high.
Telerik Sample Applications using Carousel feature in Win Forms
Also check out the following link to MSDN. It explains how you can reference the silverlight component as a COM object.
Using Silverlight in a Windows based application using COM
In this scenerio it could also be possible to embed a flash player with a flash animation, using one of the many (commercial and free) xml-based slideshows avaible for flash. This one for example http://www.flshow.net/.

Categories