Posts

Showing posts from August, 2016

Getting started with EasyTree - a jquery tree menu builder

Image
EasyTree is a JavaScript Menu handling mechanism that is concise but easy to configure. It has a comprehensive set of options that can be tweaked according to the complexity of the requirement: anything from a basic tree menu to being able to handle the firing of events to the dragging and dropping of tree elements. You can download the set of EasyTree themes and core JavaScript files from here: http://www.easyjstree.com/EasyTree.zip However in my simple example I just link to the EasyTree web site when setting the href attributes, scripts etc. Example html showing a basic tree menu as shown: easyjstree.html [code language="html"] <doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>EasyTree - Free jquery tree menu</title> <meta name="keywords" content="EasyTree free jqu...

Applying reset stylesheets to HTML using CSS

Image
As John Meyer states: "The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on." I am using this pretty much as is. The only difference is that I have also deined my own style for “h1” styles heading, using 40px font size and red colouring: reset-css.css [code language="css"] /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, vid...

Creating a web server in C#

Image
This basically replicates the “Simple C# Web Server” that is done over at "David’s" Blog: https://codehosting.net/blog/BlogEngine/post/Simple-C-Web-Server I use pretty much the same code – I have given the code the once-over using Re-Sharper. Other than that, the only real difference is that this post actually tells you how to get started and how to demonstrate the thing – useful info for complete newbies, I think. In Visual Studio create a new Console Application: In Program.cs we update the code to include the WebServer class which initializes the HttpListener prefixes – these represent the collection of prefix(s) used to store Uniform Resource Identifier (URI) values for the HttpListener object. The WebServer class also implements methods to run and stop the web service. The main program thread creates an instance of the web server, and runs it as a background thread, and which is stopped whenever the user presses any key. The thread runs the while loo...

Using the Gecko Web Browser in a C# Winforms Project

Image
Some particularly useful links: http://stackoverflow.com/questions/8778320/how-to-use-gecko-in-c-sharp https://xinyustudio.wordpress.com/2015/07/04/embedding-web-browsers-in-winform-applications/#more-3695 See this link if you're interested in using Gecko in a WPF project: https://www.technical-recipes.com/2017/using-the-gecko-web-browser-in-wpf/ Installing and using the latest GeckoFX-45.0 1. Create a new WinForms application: 2. Install the GeckoFX package via NuGet Select Tools > NuGet Package Manager > Package Manager Console At the Package Manager Console type 'install-package geckofx45': 3. Insert the Gecko control into your form. Select View > ToolBox and the new control should now be available: If this tool does not appear then right click on the 'General' tab of the Toolbox and select 'Choose items...'. The go to the COM Components tab and select the Browse button and locate and select the Geck winforms-r...

Binding data to ListView controls in WPF using MVVM

Image
Some few tips and instructions on how to bind data items contained in a List to a WPF ListView. Create a new empty WPF Application: Then create a new ViewModel class for out MainWindow.xaml which will be used to create and access the data items that are bound to the ListView: Our MainWindowViewModel class has a getter for obtaining the list of data items we wish to present in the ListView control: MainWindowViewModel.cs [code language="csharp"] using System.Collections.Generic; namespace ListViewWpf { public class Item { public Item(string name, string matches) { Name = name; Matches = matches; } public string Name { get; set; } public string Matches { get; set; } } public class ItemHandler { public ItemHandler() { Items = new List<Item>(); } public List<Item> Items { get; private set; } public void Add(Item item) { Items.Ad...

Switching between WPF XAML views using MVVM DataTemplate

Image
UPDATE: There is an improved version of this technique, one which does not need to create Views, which can be found at the following link: https://www.technical-recipes.com/2018/navigating-between-views-in-wpf-mvvm/ This technique has been already discussed on a number of blog / website forums including the following: https://rachel53461.wordpress.com/2011/05/28/switching-between-viewsusercontrols-using-mvvm/ http://stackoverflow.com/questions/19654295/wpf-mvvm-navigate-views http://stackoverflow.com/questions/10993385/changing-view-on-buttonclick I thought it would be useful to share an implemention of a working version of this technique. The complete Visual Studio project can be downloaded from here: https://www.technical-recipes.com/Downloads/MvvmSwitchViews.zip To summarise, your application should at least implement the following: A ViewModel that contains a property which defines your current view, so that to change the view you switch your ViewModel’s pr...