Re: Updated EdSharp

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: Øyvind Lode <oyvind.lode@xxxxxxxx>
  • Date: Tue, 01 Jun 2010 09:23:53 -0400

Thanks. AStyle seems to work better than Uncrustify, and is certainly better documented, so I have now made it the code beautifier invoked with the Control+4 command in EdSharp. If one has \t as the IndentUnit setting, then a tab will be used for each indentation level. Otherwise, 4 spaces will be used.


Jamal

On 5/31/2010 10:57 AM, Øyvind Lode wrote:
Hi Jamal:

It's called Artistic Style and you can find it here:
http://astyle.sourceforge.net/

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
Sent: 30. mai 2010 22:44
To: programmingblind@xxxxxxxxxxxxx
Cc: Øyvind Lode
Subject: Re: Updated EdSharp

The code is available in

http://EmpowermentZone.com/cs3_fruit.zip

There were no significant changes in this fruit basket program between
C# 3.0 and 4.0

By the way, would you remind me of the free code formatter you mentioned
on another list?

Jamal


On 5/30/2010 4:10 PM, Øyvind Lode wrote:
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

__________
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: