RE: Updated EdSharp

  • From: Øyvind Lode <oyvind.lode@xxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 30 May 2010 22:10:11 +0200

Jamal:
Please make the C# 4.0 fruit basket source code available on
www.empowermentzone.com.
I tried:
http://www.empowermentzone.com/cs4_fruit.zip

But it did not work.

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
Sent: 30. mai 2010 19:01
To: programmingblind@xxxxxxxxxxxxx
Subject: Updated EdSharp

I just posted an update at the usual URL

http://EmpowermentZone.com/edsetup.exe

(Or use F11 to elevate)

The optional JAWS scripts for EdSharp have also been updated, so you may 
wish to check that option at the end of installation if you are using JAWS.

Please let me know if you encounter problems with the following 
enhancements.

EdSharp now uses the latest version of the .NET Framework available, 
trying version 4, 3.5, 3.0, and then 2.0.

If you choose the C# or VB.NET compiler with Control+Shift+F5, then 
compiling with Control+F5 uses the latest command-line compiler 
available.  So, you can use C# 4.0 syntax, for example, as in the fruit 
basket example below.

A new command is called Format Code, Control+4.  It arranges indentation 
and other stylistic conventions of C-like languages, using the 
Uncrustify utility from

http://uncrustify.sourceforge.net/

Jamal
/*
    content of cs4_fruit.cs
    Fruit Basket program in C# 4.0
    Public domain by Jamal Mazrui
    May 30, 2010
  */

// Import namespaces
using System;
using System.Windows.Forms;

// Define class
class FruitBasket {

// Define entry point of program
        static void Main() {
// Create controls;
                var tlp = new TableLayoutPanel {ColumnCount = 3, RowCount =
2};
                var lblFruit = new Label {Text = "&Fruit:"};
                var txtFruit = new TextBox();
                var btnAdd = new Button {Text = "&Add"};
                var lblBasket = new Label {Text = "&Basket:"};
                var lstBasket = new ListBox();
                var btnDelete = new Button {Text = "&Delete"};

// Define Add event handler;
                btnAdd.Click += (o, e) => {
                        var sFruit = txtFruit.Text.Trim();
                        if (sFruit == "") MessageBox.Show("No fruit to
add!", "Alert");
                        else {
                                lstBasket.Items.Add(sFruit);
                                txtFruit.Clear();
                                lstBasket.SelectedIndex =
lstBasket.Items.Count - 1;
                        }
                };

// Define Delete event handler;
                btnDelete.Click += (o,e) => {
                        var iFruit = lstBasket.SelectedIndex;
                        if (iFruit == -1) MessageBox.Show("No fruit to
delete!", "Alert");
                        else {
                                lstBasket.Items.RemoveAt(iFruit);
                                if (iFruit == lstBasket.Items.Count)
iFruit--;
                                lstBasket.SelectedIndex = iFruit;
                        }
                };

// Finalize dialog;
                tlp.Controls.AddRange(new Control[] {lblFruit, txtFruit,
btnAdd, 
lblBasket, lstBasket, btnDelete});
                var dlg = new Form {Text = "Fruit Basket", AcceptButton =
btnAdd, 
StartPosition = FormStartPosition.CenterScreen, AutoSize = true, 
AutoSizeMode = AutoSizeMode.GrowAndShrink};
                dlg.Controls.Add(tlp);

// Define closing event handler
                dlg.Closing += (o, e) => e.Cancel = (MessageBox.Show("Close
program?", 
"Confirm", MessageBoxButtons.YesNo) == DialogResult.No);
                dlg.ShowDialog();
        } // Main method
} // FruitBasket class

// End of cs4_fruit.cs
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: