I usually C++ applications. The only web-application development I've done is writing Java Applets. There it's all pretty simple stuff. Just write the entire applet in Java, and embed it into an html page with the:
<applet></applet> or <object></object>
tag.
Now, I am trying to find my way to Silverlight. Now Visual Web-Developer Express or Visual Studio is awesome. It eases all problems, creating a new Silverlight project automatically generates an aspx website and does all the embedding & deployment.
However, I don't want to depend on the IDE. Though I use IDEs quite often, what I hate is depending on it. So my questions are,
Is it possible to write a silverlight app with a simple programmer's editor?
How do I embed my silverlight XAML code and C-Sharp compiled *.dlls in an HTML file?
Some basic tutorial or documentation for people like me who know absolutely nothing about Silverlight?
How do I embed my silverlight XAML code and C-Sharp compiled *.dlls in an HTML file?
You can add a silverlight app to a html file simply by using the <object> tag (here is an example taken from MSDN):
<object width="300" height="300"
data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" >
<param name="source" value="SilverlightApplication1.xap"/>
</object>
Is it possible to write a silverlight app with a simple programmer's editor?
It is possible to write all of your code for a silverlight app using nothing but notepad, but because of the somewhat verbose nature of XAML, i think this would be a fairly tedious task. If anything, i would suggest you go in the other direction and use Expression Blend to craft your XAML and then Visual Studio for your C# needs - the two IDE's work together very effectively and allow you to easily switch from one to the other with ease.
Some basic tutorial or documentation for people like me who know absolutely nothing about Silverlight?
If your looking for good tutorials, head over to the official silverlight site where you will find lots of tutorials, videos and hands on labs to help you through the learning process.
Here are some other good resources:
There were lots of good presentations on Silverlight at MIX10
Channel9 in general has lots of good vids. This is their Silverlight section
A list of great Silverlight resources from SmashingApps
Tekpub do a free video course on Silverlight 4
The *.xap file generated from compiling a Silverlight application is simply a zip file with a different extension. You can check out the contents of a XAP file by renaming it with a ZIP extension, then browsing through it.
Related
I'm trying to visit the webpage http://converter.telerik.com/ using a WebBrowser control in a WinForms application but the page contains script errors.
After ScriptErrorsSuppressed to True the main controls of the webpage are unable to load at this point i'm lost about using the WebBrowser control to this task so I've search other alternatives.
I've tried with the latest build of GeckoFX (29.0.X) from here: https://bitbucket.org/geckofx/
With the GeckoWebBrowser control the Telerik page loads perfectly but after pressing the "Convert" button from my GeckoWebBrowser the second "Textbox" gets crazy and is not properly displayed, so again I'm lost but I don't know what more alternatives I have.
In the past i've tried to use some builds of chrome for .Net but I was unable to compile them.
What I need to do to use the Telerik converter service using any kind of webbrowser from my app?
PS: Dependencies are not a problem for me, I just want to develop a personal application for my only usage to load/save snippets that I converted using the Telerik service accessing to its converter webpage from my app.
Personally I would take a look at SharpDevelop's NRefactory Library and see if I could utilize this in my application instead of using someone else's webservice which more than likely uses NRefactory as it's underlying engine.
The online version of the code converter is available at http://codeconverter.sharpdevelop.net/.
https://github.com/icsharpcode/SharpDevelop/wiki/Code-Converter
https://github.com/icsharpcode/SharpDevelop/wiki/NRefactory
About NRefactory:
ICSharpCode.NRefactory is freely available as a part of SharpDevelop IDE.
It is parser library for C# and VB.
It consists of a single Abstract Syntax Tree (AST) that can represent all constructs that are available in C# or VB (unlike System.CodeDom, which only represents constructs common to C# and VB).
By using the C# parser and a VB output visitor (or vice versa), you can do a code converter.
After parsing to AST, you can analyze and/or transform the AST and re-create source code from the (modified) AST, then re-insert the comments we saved from the parser into the output
For more info about NRefactory please see: sharpdevelop.net and NRefactory wiki.
You may try samples\NRefactoryDemo in the SharpDevelop source code to take a look how the AST parse source code.
Source: http://www.codeproject.com/Articles/262950/CodeConverter
I'm trying to embed/display a PDF in a WPF application. So far, I've tried those solutions, without success:
Display the PDF in a WindowsFormsHost hosting an AxAcroPdf
control, similarly to what's shown here. The problem is that my application sets AllowsTransparency
= True to create a style similar to Modern UI, but
that doesn't blend well with a WindowsFormsHost (the control
becomes invisible).
Display the PDF in a WebBrowser control. The problem is the same.
Set AllowsTransparency = False, but this causes a sluggish feeling in the application. Since I use WPF purposedly to enhance the look and feel of our business applications to the benefit of our end-users, this can't be a solution.
Use a second window with AllowsTransparency = False to display the WindowsFormsHost, and hack it to make it look like a child control of the main window, as it's described here. However, I don't like the code-behind approach since I'm using MVVM.
Find a native PDF control for WPF. However, I only found a couple of commercial ones and that's not an option right now.
What I need is to be able to:
Display a PDF or its representation (i.e. an image or a conversion to another format) in a WPF application.
Keep my style visually intact and fluid (AllowsTransparency must stay True).
Use an approach respecting the principles of MVVM (preferably no code-behind).
Include it in my application for free (for commercial usage).
I'm totally open to hand-made solutions, open-source libraries and even completely different approaches.
I have two solution for this:
Open your .pdf file and then print as an .xps (also you must be able for doint this in code), then this file you can embded this file in your app, and show it as a xps document. See this: Documents in WPF - MSDN - Microsoft (XPS)
To use a free library, I'm not very sure if this allows show pdf, but it generate them, you can take a look at EO-Pdf.
Hope this tips helps to solve the problem.
If you're opened to Open-Source solutions, I would recommend GhostScript. You can convert the PDF (with decent quality, for the most part) to individual image files of most any format you might want to work with.
The other option is to convert the PDF to HTML using pdf2htmlEX, but it will currently only compile for Linux.
I use both of the above solutions in several applications on both Linux and Windows. The advantage to the HTML way is that the text can be copied and pasted. The advantage of the GhostScript way is that the images might be more portable (smaller).
As with any open-source solution, you need to be aware of the terms of the license under which each product is released, and how that may impact your final result.
There is a good solution that I used before is to use CefSharp. It's the Chrome browser engine that supports previewing PDF documents.
Visit quick start page.
It is recommended to visit Troubleshooting page to set appropriate settings if you have problems.
If you want to show PDF files on your local drives you should also use these settings for the browser and then use file:/// protocol:
CefSharp.BrowserSettings browserSettings = new CefSharp.BrowserSettings();
browserSettings.FileAccessFromFileUrls = CefSharp.CefState.Enabled;
browserSettings.UniversalAccessFromFileUrls = CefSharp.CefState.Enabled;
browserSettings.TextAreaResize = CefSharp.CefState.Enabled;
my_bowser.BrowserSettings = browserSettings;
I need to create a simple application that would generate reports based on database data and some user input. I have vast C/C++ experience, but for this project we had to choose C#.
I want to avoid using 3rd-party components that would require installation on a client machine as much as possible. Thus, I would like to avoid using even the features provided by MS Office (I could have used an XLS template, just like my predecessor did, but it doesn't look like a way to go; anyways, my predecessor's sources are long lost, which is probably good, since it is a roughly 10-years-old VB monstrosity that crashes every now and then). The same goes for crystal reports and whatnot.
My current idea is to build HTML tables (using an HtmlDocument) on the fly, to present them to the user (using a WebBrowser) and to print them. Is it a right way to go? Are there any simpler/more robust/better approaches? What are the possible pitfalls?
Building tables on the fly would work. I use that technique every so often, but it seems like a hack to me. I only use it because quite often, the business need requires "good enough" and quick turnaround as opposed to "beautiful".
I'm going to preference what I'm about to suggest bysaying that I have a strong bias against 3rd-party components myself.
I flat out refuse to use them in most cases and will go out of my way to come up with another solution, because I've been burned on upgrades/licensing too often.
That said...
Fortunately, with .NET not all 3rd party components need to be installed to your clients PCs. With XCOPY deployment, often you can just reference a .DLL or a project in the solution ans specify the "Copy Always" or "Copy if newer" option to just include the dll (or resulting dll if you're referencing a class library project) and as long as the .dll is present in the same directory as the executable, the 3rd party component works.
With all of that in mind, there's a project that I've used to print a DataGridView from Windows Forms at CodeProject. This is one that you can get the source for, reference it, and use it without having to actually install anything at the client. I've used it in more than one app, and it's one of my favorite tools.
It will print ONLY the DataGridView, but it prints it exactly as it appears on screen, so if that's what you want, I'd recommend at least checking it out.
As a third option, you could consider using ASP.NET. If you're going to be generating HTML, it's just as easy (easier actually) to do it using ASP.NET than in a WinForms app. Using ASP.NET you get Repeaters, ListViews, etc, all of which make the reports easy to create.
I've got more than one real-world app that is primarily a WinForms app but has an associated reporting site.
For example, I have a WinForms app used for scanning coupons accepted at our retail locaitons. It's a WInForms app because I need to interact directly with the scanner on a COM port. However, for the reporting portion, I set up an ASP.NET website. In the WinForms app it's very simple to create a reporting menu option and point to the pages. Our users generally don't even think about the fact that this is two distinct applicaitons. They see it as one - their Coupon Scanning app.
The point of all that is that it's usually possible to do things with any given tool, but it's far easier to use the tool that is meant for the job. If you're going to be generating HTML reports, ASP.NET is a better tool than building the reports manually, and if you need to have a WinForms app for most of the UI, you can still do that and use the website for the reports - using the best tool for each task.
Maybe you would like to check RazorEngine, to create your HTML templates.
I recommend you Razor engine to render html, it is more flexible than working with HtmlDocument objects.
You can create a file with your report template, and then parse it sending a Collection of your report rows objects.
i'm trying to do a download manager just for learning cos i'm new in windows programming,
could someone tell me how to monitor most common web browsers,
i'd like to implement something like:
http://www.iwisoft.com/videodownloader/video-downloader-features.php
everytime you visit a web page in common browsers detects all video files in the web page and allow you to download or not the file, any idea how to do that without building an app for every browser, which is the best language to do it c#/vc++/managed/unmanaged,
i'm learning and using a mix of all to do other parts like download files, add rules to firewall or modify the registry
thanks a lot
I don't really know a neat way of doing this, but you could try the following :
Enumerate the name of the current window using GetForegroundWindow.
Check if the name you get using GetWindowText matches the usual name of the browser.
If it is a browser, moniter the clipboard and check for hyperlinks
then do your download stuff.
I program in C++ and assembly, but I wouldn't be able to advice you on the programming language since I don't have any experience with C#. But since you are new, I would suggest starting out with basic stuff. As pointed out in your comment, this is not something that can be achieved easily.
I'm using the fantastic project Script# (http://projects.nikhilk.net/ScriptSharp)
I can't seem to get the autocomplete feature in VisualStudio 2008 working
the .scriptlet files appear as plain text with no code formatting at all
the version of Script# I am using is 0.5.6
I am opening the samples project and looking at HelloWorld.scriptlet
Cheers
Sam
Yes, currently .scriptlet files don't have a custom editor, and as such are treated as regular text files.
In the next version of script#, the Scriptlet server control is going to work slightly differently. Two changes:
Its not going to support inline code. All code must be in a .scriptlet file if you want script code-behind.
The scriptlet server control will look for a .scriptlet file instead, and open it up when you choose to Edit Code from the script in design-view. At that point you'll get intellisense.
Of course over the long-term I actually want an editor experience for these. That is the desired implementation...