-
Starting the Control Spy [Telerik Spy Controls]
To start the Control Spy, create and display a new instance of the RadControlSpyForm contained in the Control Spy library:
using Telerik.WinControls.RadControlSpy;
[C#] Showing the Control Spy
using Telerik.WinControls.RadControlSpy;
namespace RadControlSpyDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void radButton1_Click(object sender, EventArgs e)
{
RadControlSpyForm spyForm = new RadControlSpyForm();
spyForm.Show();
}
}
}
[VB] Showing the Control Spy Copy Code
Source of Information : 2002-2010 Telerik Help
Imports Telerik.WinControls.RadControlSpy
Namespace RadControlSpyDemo
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub radButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim spyForm As New RadControlSpyForm()
spyForm.Show()
End Sub
End Class
End Namespace
-
Adding a Command to the RibbonStatusBar control [Janus UI and Ribbon Controls v3.5 for .NET]
Create and add a StatusBarPanel to a RibbonStatusBar control.
The RibbonStatusBar control has two collections were you can add commands, the LeftPanelCommands that represents the commands aligned to the left side of control (painted with a light background) and the RightPanelCommands that has a darker background and are aligned to the right edge of the StatusBar.
The following code shows how to create and add a SatusBarPanel to the left side of the RibbonStatusBar.
In C#
//Create the RibbonStatusBar control
Janus.Windows.Ribbon.RibbonStatusBar statusBar = new Janus.Windows.Ribbon.RibbonStatusBar();
statusBar.Height = 22;
this.Controls.Add(statusBar);
Janus.Windows.Ribbon.StatusBarPanel panel = new Janus.Windows.Ribbon.StatusBarPanel();
//Specify that the panel should act as label and cannot be clicked
panel.PanelBehavior = PanelBehavior.Label;
panel.Text = "Panel text";
//Specify that the panel should be resized to fill the empty space in the left side of the StatusBar control.
panel.AutoSize = StatusBarPanelAutoSize.Spring;
//Add the panel to the LeftPanelCommands collection of the StatusBar
statusBar.LeftPanelCommands.Add(panel);
In VB
'Create the RibbonStatusBar control
Dim statusBar As New Janus.Windows.Ribbon.RibbonStatusBar()
statusBar.Height = 22
Me.Controls.Add(statusBar)
Dim panel As New Janus.Windows.Ribbon.StatusBarPanel()
'Specify that the panel should act as label and cannot be clicked
panel.PanelBehavior = PanelBehavior.Label
panel.Text = "Panel text"
'Specify that the panel should be resized to fill the empty space in the left side of the StatusBar control.
panel.AutoSize = StatusBarPanelAutoSize.Spring
'Add the panel to the LeftPanelCommands collection of the StatusBar
statusBar.LeftPanelCommands.Add(panel)
The following list shows the types of commands that can be added to a RibbonStatusBar
ButtonCommand : Represents a button that can be clicked. Use the SizeStyle property of the button to specify if the button should be presented as a large button that occupies the full height of the ribbon or as a small button.
DropDownCommand : Inherits from ButtonCommand and it also has a Commands collection that is displayed on a menu window after clicking on the button.
LabelCommand : Represents a label in the ribbon with text and image that cannot be clicked or highlighted
MdiListCommand : Inherits from DropDownCommand and a command is added to its Commands collection for every MDI child form open in the application.
CheckBoxCommand : Represents a UICheckBox control in the Ribbon.
ComboBoxCommand : Represents a UIComboBox control in the Ribbon
TextBoxCommand : Represents a TextBox control.
ContainerControlCommand : Use this command type to add a custom Control to the Ribbon. Set the custom control to the Control property of the command and use the ControlWidth property to specify its width.
ButtonGroup : Represents a group of commands with a border around them
SeparatorCommand : Represents a separator line in its parent object. When you add a SeparatorCommand to a DropDown use the Title property if you want the command to be represents as a title in the menu window.
StatusBarPanel : Represent a panel in a panel in RibbonStatusBar. Use the PanelBehavior property to specify whether the panel should act as a button or a label and use the AutoSize property to specify how the panel will be sized.
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Creating and displaying a RibbonContextMenu [Janus UI and Ribbon Controls v3.5 for .NET]
Create and display a context menu in code.
In VB:
Dim ctMenu As RibbonContextMenu = New RibbonContextMenu()
'Create the commands that will be added to the context menu
Dim cutCommand As DropDownCommand = New DropDownCommand("Cut", "Cu&t")
Dim copyCommand As DropDownCommand = New DropDownCommand("Copy", "Cop&y")
Dim pasteCommand As DropDownCommand = New DropDownCommand("Paste", "&Paste")
'Add the commands to the Commands collection of the context menu
ctMenu.Commands.Add(cutCommand)
ctMenu.Commands.Add(copyCommand)
ctMenu.Commands.Add(pasteCommand)
'Call the Show method to display the context menu.
ctMenu.Show()
In C#:
Source Of Information : Janus v3.5 Help Files for VS 2008
RibbonContextMenu ctMenu = new RibbonContextMenu();
//Create the commands that will be added to the context menu
DropDownCommand cutCommand = new DropDownCommand("Cut", "Cu&t");
DropDownCommand copyCommand = new DropDownCommand("Copy", "Cop&y");
DropDownCommand pasteCommand = new DropDownCommand("Paste", "&Paste");
//Add the commands to the Commands collection of the context menu
ctMenu.Commands.Add(cutCommand);
ctMenu.Commands.Add(copyCommand);
ctMenu.Commands.Add(pasteCommand);
//Call the Show method to display the context menu.
ctMenu.Show();
-
Microsoft Team Development Environment
Microsoft’s website provides “guidance and recommendations to enable you to set up a team development environment and work successfully within it” found at this link:
http://msdn.microsoft.com/library/en-us/dnbda/html/tdlg_rm.asp
The following diagram outlines what the Microsoft article discusses as “In Scope” for their “Team Development Environment” setup.
The VSS Server
This is a central server that hosts one or more Microsoft Visual SourceSafe (VSS) databases used to provide versioned controlled access to project source files. Developers interact with it on a daily basis to check project files in and out through the Microsoft Visual Studio.NET Integrated Development Environment (IDE). It is also accessed by the build script to obtain the latest source code required for the current system build.
The Build Server
The Build Server is an automated build script server used to compile and build entire projects. The build scripts are critical elements for all software development projects. These allow generation of successive versions of the system in an automated and consistent, repeatable fashion. The output assemblies generated by the build process are maintained in folders on this server.
Database Server
This server hosts instances of Microsoft SQL Server and provides a central location where developers can connect to databases whose schemas match the current system database design. In some scenarios, local SQL Server databases are needed on development workstations to perform isolated unit testing. For example, local servers allow the developer to manipulate a set of test data, remaining isolated and guarantee zero impact on other team members.
Web Services Server
The primary function of the Web Services Server in the team development environment is to host Extensible Markup Language (XML) Web Services that are currently under development. The central Web Server allows the services to be published for other developers or development teams such as testing, QA or the end user to reference these projects outside of a developer’s local machine.
Source of Information : Enterprise Solution Providers, Inc. 2005 – v1.0
-
Using a layout file to preserve user changes in the PanelManager [Janus UI and Ribbon Controls v3.5 for .NET]
Using a layout file you could be able to preserve the changes to the layout made by the user.
Follow these steps to use a layout file at run time:
1 Define the layout at design time and then save it clicking in the "Save Layout File" button that is found in the "Layout Manager" tab of the UIPanelManager designer.
2 In the Load event of the form, load the layout from a file calling a procedure similar to the following:
In VB:
Private Sub LoadLayout()
Dim LayoutDir As String = "C:\PanelsLayout.xml"
Dim LayoutStream As FileStream
LayoutStream = New FileStream(LayoutDir, FileMode.Open)
PanelManager1.LoadLayoutFile(LayoutStream)
LayoutStream.Close()
End Sub
In C#:
private void LoadLayout()
{
string layoutDir = @"C:\PanelsLayout.xml";
FileStream layoutStream;
layoutStream = new FileStream(layoutDir, FileMode.Open);
panelManager1.LoadLayoutFile(layoutStream);
layoutStream.Close();
}
3 (Optional) To preserve user changes to the layout, update each layout before it is changed in the CurrentLayoutChanging event.
In VB:
Private Sub PanelManager1_CurrentLayoutChanging(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles _
PanelManager1.CurrentLayoutChanging
'To persist user changes in the current layout,
'call the Update method explicitly before changing the layout
If Not PanelManager1.CurrentLayout Is Nothing Then
PanelManager1.CurrentLayout.Update()
End If
End Sub
In C#:
private void panelManager1_CurrentLayoutChanging(object sender,
System.ComponentModel.CancelEventArgs e)
{
//To persist user changes in the current layout,
//call the Update method explicitly before changing the layout
if (panelManager1.CurrentLayout != null)
{
panelManager1.CurrentLayout.Update();
}
}
4 In the FormClosing event of the form, save the layout file again to be able to preserve the changes the user did-
In VB:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Dim Result As DialogResult
Dim LayoutDir As String
Dim LayoutStream As FileStream
Result = MessageBox.Show("Do you want to preserve the changes in the " & _
"PanelManager layout?", "Preserve changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If Result = Windows.Forms.DialogResult.Cancel Then
e.Cancel = True
ElseIf Result = Windows.Forms.DialogResult.Yes Then
LayoutDir = "C:\UIBarsLayout.xml"
LayoutStream = New FileStream(LayoutDir, FileMode.Create)
PanelManager1.SaveLayoutFile(LayoutStream)
LayoutStream.Close()
End If
End Sub
In C#:
Source Of Information : Janus v3.5 Help Files for VS 2008
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result;
string layoutDir;
FileStream layoutStream;
result = MessageBox.Show("Do you want to preserve the changes in the PanelManager layout?", "Preserve changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == DialogResult.Cancel)
{
e.Cancel = true;
}
else if (result == DialogResult.Yes)
{
layoutDir = @"C:\PanelsLayout.xml";
layoutStream = new FileStream(layoutDir, FileMode.Create);
panelManager1.SaveLayoutFile(layoutStream);
layoutStream.Close();
}
}
-
Using the UIPanelManager as a TabbedMdi control [Janus UI and Ribbon Controls v3.5 for .NET]
To give your MDI Container Form a TabbedMdi layout you just need to place a UIPanelManager component on the Form and set its TabbedMdi property as true.
Setting properties for individual tab pages
You can use the MdiTabInitialize event to assign the text, tooltip text or the format style for the tab items.
In C#:
private void uiPanelManager1_MdiTabInitialize(object sender, Janus.Windows.UI.Dock.MdiTabInitializeEventArgs e)
{
e.Tab.ToolTipText = "ToolTipText for the TabPage";
e.Tab.StateStyles.FormatStyle.BackColor = Color.Red;
//Use the CustomProperties class to add custom information for the tab page.
e.Tab.CustomProperties.Add("FormType", e.Tab.Form.GetType().Name);
}
In VB:
Private Sub UiPanelManager1_MdiTabInitialize(ByVal sender As Object, ByVal e As Janus.Windows.UI.Dock.MdiTabInitializeEventArgs) Handles UiPanelManager1.MdiTabInitialize
e.Tab.ToolTipText = "ToolTipText for the TabPage"
e.Tab.StateStyles.FormatStyle.BackColor = Color.Red
'Use the CustomProperties class to add custom information for the tab page
e.Tab.CustomProperties.Add("FormType", e.Tab.Form.GetType().Name)
End Sub
Using a layout file to preserve the tabbed Mdi layout
The following code shows how to save the tabbed Mdi layout into a file
In VB:
Private Sub SaveLayout()
Dim LayoutDir As String = "C:\UIBarsLayout.xml"
Dim LayoutStream As FileStream
LayoutStream = New FileStream(LayoutDir, FileMode.Create)
UiPanelManager1.SaveLayoutFile(LayoutStream, Janus.Windows.UI.Dock.PersistMode.TabbedMdiLayout)
LayoutStream.Close()
End Sub
In C#:
private void SaveLayout()
{
string layoutDir = @"C:\UIBarsLayout.xml";
FileStream layoutStream;
layoutStream = new FileStream(layoutDir, FileMode.Create);
uiPanelManager1.SaveLayoutFile(layoutStream, Janus.Windows.UI.Dock.PersistMode.TabbedMdiLayout);
layoutStream.Close();
}
The following code shows how to load the tabbed Mdi layout from a file
In VB:
Private Sub LoadLayout()
Dim LayoutDir As String = "C:\UIBarsLayout.xml"
Dim LayoutStream As FileStream
LayoutStream = New FileStream(LayoutDir, FileMode.Open)
UiPanelManager1.LoadLayoutFile(LayoutStream)
LayoutStream.Close()
End Sub
In C#:
private void LoadLayout()
{
string layoutDir = @"C:\UIBarsLayout.xml";
FileStream layoutStream;
layoutStream = new FileStream(layoutDir, FileMode.Open);
uiPanelManager1.LoadLayoutFile(layoutStream);
layoutStream.Close();
}
Use the RestoreMdiChildForm event to load the forms that were open when the layout was saved.
In C#:
private void uiPanelManager1_RestoreMdiChildForm(object sender, Janus.Windows.UI.Dock.RestoreMdiChildFormEventArgs e)
{
//Get the type of the form that was stored in the MDITabInitialize event
string formType = (string)e.Tab.CustomProperties["FormType"].Value;
if (formType == "Form2")
{
Form2 frm = new Form2();
frm.MdiParent = this;
//Set the new Form as the Form for the tab.
e.Form = frm;
frm.Show();
}
}
In VB:
Private Sub UiPanelManager1_RestoreMdiChildForm(ByVal sender As Object, ByVal e As Janus.Windows.UI.Dock.RestoreMdiChildFormEventArgs) Handles UiPanelManager1.RestoreMdiChildForm
'Get the type of the form that was stored in the MDITabInitializeEvent
Dim formType As String = e.Tab.CustomProperties("FormType").Value
If formType = "Form2" Then
Dim frm As Form2 = New Form2()
frm.MdiParent = Me
'Set the new Form as the Form for the tab.
e.Form = frm
frm.Show()
End If
End Sub
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Definitions of Continuous Integration components.
The bottom of certain sections contains a line to additional information on the particular CI component. ESP believes it is important to be familiar with some of the terminology before spending a good amount of time reading about it.
Continuous Integration (CI)
Continuous Integration (CI) is the strategy of making sure that changes to the project’s code base are built, tested, reported on, and rapidly made available to all parties after they are introduced. This framework frees up developers from having to constantly create new builds for the Test and QA groups. Each subsequent build is established and promoted, then downloaded automatically for testing.
Ref: http://www.theserverside.net/articles/showarticle.tss?id=ContinuousIntegration
Visual Source Safe (VSS)
Microsoft’s Visual Source Safe (VSS) helps to manage projects regardless of the file type - (e.g. text files, graphics files, binary files, sound files, or video files) by saving them to a database. When a file is added to VSS, the file is backed up on the database, made available to other people, and changes that have been made to the file are saved so old versions can be recovered an at any time. Members of the team can see the latest version of any file, make changes, and save a new version in the database.
Source Off Site (SOS)
Source Off Site (SOS) provides a collaboration environment for users of Microsoft Visual SourceSafe 6.0 (VSS). SOS Collab combines source code control and bug tracking tool together with collaboration tools such as chat, discussion groups, and notifications.
The SOS Collab Servers directory does not contain any project data. All information is stored in the SQL database, located in the SQL installation folder.
SOS servers need to have VSS database on same machine or same LAN as the SOS Collab Server and VSS 6.0 APIs (installed with VSS 6.0 Client) on the same machine.
Successful Build
An aggressive goal for a successful build would include:
- All the latest sources are checked out of the configuration management system.
- Every file is compiled from scratch.
- The resulting object files are linked and deployed for execution.
- The system is started and a suite of tests is run against the system.
- If all of the above execute without error or human intervention and every test passes, that is a successful build.
Ref: http://www.martinfowler.com/articles/continuousIntegration.html
Build Promotion
Promoting a build means copying it to the target server. The build must not be rebuilt but rather moved. Therefore there is the need to identify and archive builds in a build promotion process (Section 6.0 Build Promotion Process) as builds are created.
Ref: http://www.15seconds.com/issue/040810.htm
Web Development Models (under VSS)
This defines Microsoft’s suggested approach Web Application development in a team environment. It is strongly advised to adopt the “Isolated” development model shown in Figure 1 for team developments because it offers a number of significant advantages, for instance, each individual can continue working on a Web Application without the worry of another developer making a change conflicting with their own.
With the Isolated model, development (edit, debug and run) is in complete isolation on the developer’s workstation using a local Web server (http://localhost). Access to the master source files is controlled via a Microsoft Visual SourceSafe (VSS) database located on a network file share.
Ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/tdlg_ch2.asp
NAnt
NAnt is an open source .NET build tool used to compile .NET applications.
NAntContrib
NAntContrib is the Project application for tasks and tools for NAnt. It provides extra tasks and tools that are not present in NAnt.
Draco.NET
Draco.NET is a Windows Service Application designed to facilitate Continuous Integration. Draco.NET monitors the source code repository, automatically rebuilds a project when changes are detected and then emails the build result along with a list of changes since the last build.
Draco.NET version 1.5 supports builds using NAnt build tool or via Visual Studio .NET 2002/2003 solution files.
NDoc
NDoc generates class library documentation from .NET assemblies and the XML doc files generated by the C# compiler (or with an add-on tool for VB.NET). It is used by NAnt build tool to automatically generate library documentation.
NUnit
A Unit-testing framework for all .NET languages. NUnit is built within NAnt and exposed as a NAnt task.
NUnitForms
NUnitForms is a tool extended from NUnit for automatically testing Windows Forms applications written on .NET.
FxCop
FxCop is a code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines. It uses reflection, MSIL parsing, and calls graph analysis to inspect assemblies for more than 200 defects in the following areas: Library design, Localization, Naming conventions, Performance, and Security.
FxCop includes both GUI and command line versions of the tool, as well as a SDK to create custom rules.
CruiseControl.NET
CruiseControl.NET is similar to Draco.NET that can monitor the source code repository and automatically rebuilds a project when changes are detected. It has several extra features when compared to Draco.NET.
Ref: http://confluence.public.thoughtworks.org/display/CCNET/What+is+CruiseControl.NET
Source of Information : Enterprise Solution Providers, Inc. 2005 – v1.0
-
Continuous Integration Best Practices
Understanding
That Continuous Integration itself is a software development Best Practice – central source file location, fully automated build, test and partly-automated distribution process that allows teams to build and test their software many times a day.
Buy In
This process starts with buy in for CI with Executives, which leads to Development Manager’s understanding; the end result being CI execution from Developers.
Continued Learning
Development Managers and Developers commit to learning and following the CI practices that best fit their environment.
Back Up
Environment and Source File back-up and recovery procedures are properly followed.
Quick Deployment
One of the main goals with CI is the speedy development from concept to user; ensure that frequent builds are consistently helping this process from start to finish.
No Broken Builds
The developer’s top priority is fixing breaks as new builds are created. Since CI involves a high amount of accountability, broken builds potentially affect every team member as well as the entire process. Team members must be able to rapidly trouble shoot and roll back changes to a successful build if needed.
Tight Build Promotion Process
Build promotion is how changes are taken from concept to development to the end user. The more consistent this process is, the more quickly ideas become a reality.
-
Overview on Guidelines for Windows 7 and Windows server 2008 R2
The Windows API has many new calls that expose new functionality available with Windows 7 and Windows Server 2008 R2; however, as of the .NET 4 release many of these calls are not available from the .NET Framework. The Windows API Code Pack helps here as it contains .NET classes that wrap native API calls to make them available from a .NET library. You can use this library within your .NET applications. You can download the Windows API Code Pack from http://code.msdn.microsoft.com/WindowsAPICodePack. This toolkit is used with most samples in this appendix. You can either use the libraries that come with this toolkit or copy the source code to your application. Typically, the classes from this toolkit are a thin wrapper around the Windows API.
Another toolkit you can use to target applications for the Windows platform is the Windows Software Logo Kit. On the Microsoft downloads page, you can find the Windows 7 Client Software Logo program documentation and toolkit that contains information about what’s necessary for an application to get the Windows 7 software logo. Even if you’re not interested in receiving a logo for your application, this documentation and toolkit is still interesting, as it explains what is required for an application to be considered well-behaved on the Windows operating system.
What are the requirements to receive a logo for an application? Here’s a short list of the requirements; you can get many more details in the Windows 7 Client Software Logo document. The application may not contain spyware or malware. Of course, that’s a requirement that should be fulfilled with every application. Interestingly, this is verified for logo compliance.
• Windows resource protected files may not be replaced.
• Errors must be reported with Windows Error Reporting (WER).
• The application must cleanly install and uninstall. The application should not force a reboot with the installation.
• The application should install to the correct folders. User data should not be written to the application folders.
• Files and drivers must be digitally signed.
• 64-bit systems must be supported. This means that 16-bit code is not allowed. It’s okay to run 32-bit applications on 64-bit. With .NET applications, you can set the platform configuration to Any CPU, x86, x64, or Itanium. Any CPU lets your application run with 32 bits on a 32-bit platform and with 64 bits on a 64-bit platform. When you set the configuration to Any CPU, you may not directly wrap native code with platform invoke in the assembly. Using native code restricts you to the nativecode native API calls that are used, and thus Any CPU will not work on both versions.
• Version check with the installation must be done to check if the operating system has a minimum version required, but it’s not allowed to check for a specific version.
• User account control guidelines must be followed.
• The applications may not block shutdown. You can use the Restart Manager to return the application to a working state after a reboot or failure.
• Multiuser sessions must be supported. Different users on one system should be able to use the application. This requirement is because of the fast user switching facility of Windows.
Source of Information : Wrox Professional C Sharp 4.0 and dot NET 4
-
What is Continuous Integration (CI)
Continuous Integration (CI) is the strategy and practice of making sure that changes to a software project’s code base are successfully built, tested, reported on, and rapidly made available to all parties after they are introduced.
This section is simply a brief and high level explanation of Continuous Integration. Please refer to Section 8.0 References and Suggested Readings for more information. There are several basic requisites in setting up CI environment:
- Source code should be maintained in a central location, preferably a source code control product like Visual SourceSafe or CVS.
- Each project has build scripts to create a build.
- All code bases include an auto update framework.
In a Continuous Integration Environment source code is maintained in a central location where an application monitors the repository and springs into action when it notices changes (commits) to the code.
The objective involves using a full version of a given projects code base whenever any part of it changes, automatically run a build file (or manually), run automated tests, report on the results for quick problem resolution, and quickly make all changes available to teams involved.
Advantages of Continuous Integration
- Dramatically increase ROI through full cycle efficiencies.
- Guarantees successfully compiled software.
- Visible progress reporting and problem tracking.
- Low TCO (Total Cost of Ownership).
- Relatively easy to build or integrate into an existing development environment.
- High impact environment upgrade with low maintenance.
- Improve development standards, consistencies and accountability.
- Increase amount of quality code.
- Rapidly identify bugs, who created them, and where it is.
- Quickly push high quality change updates to testing.
- Reduce development integration effort.
Disadvantages of Continuous Integration
- Migration of large volumes of internal development projects into a CI environment that are spread across various development environments require tight planning and coordination to successfully migrate.
- Requires understanding of CI and discretion when setting up projects.
-
Creating a UIPanelGroup [Janus UI and Ribbon Controls v3.5 for .NET]
The following code shows how to create a UIPanelGroup containing two panels in code and placed on the Form.
In C#
Janus.Windows.UI.Dock.UIPanelManager panelManager = new UIPanelManager();
//Assign the form as the control in which the panels will be placed
panelManager.ContainerControl = this;
Janus.Windows.UI.Dock.UIPanelGroup group = new UIPanelGroup();
//Specify the group style.
group.GroupStyle = Janus.Windows.UI.Dock.PanelGroupStyle.Tab;
//Create the two panels that will be added to the group.
Janus.Windows.UI.Dock.UIPanel panel1 = new Janus.Windows.UI.Dock.UIPanel("Panel 1");
Janus.Windows.UI.Dock.UIPanel panel2 = new Janus.Windows.UI.Dock.UIPanel("Panel 2");
//Add the panels to the group created.
group.Panels.Add(panel1);
group.Panels.Add(panel2);
//Add the group to the Panels collection the UIPanelManager
panelManager.Panels.Add(group);
//NOTE: A UIPanelGroup must have at least two panels assigned to it or it will be
//removed from the Controls collection of the container control if its StaticGroup
//property is False.
In VB:
Dim PanelManager As New Janus.Windows.UI.Dock.UIPanelManager()
'Assign the form as the control in which the panels will be placed
PanelManager.ContainerControl = Me
Dim group As New Janus.Windows.UI.Dock.UIPanelGroup()
'Specify the group style
group.GroupStyle = Janus.Windows.UI.Dock.PanelGroupStyle.Tab
'Create the two panels that will be added to the group.
Dim panel1 As New Janus.Windows.UI.Dock.UIPanel("Panel 1")
Dim panel2 As New Janus.Windows.UI.Dock.UIPanel("Panel 2")
'Add the panels to the group created.
group.Panels.Add(panel1)
group.Panels.Add(panel2)
'Add the group to the Panels collection the UIPanelManager
PanelManager.Panels.Add(group)
'NOTE: A UIPanelGroup must have at least two panels assigned to it or it will be
'removed from the Controls 'collection of the container control if its StaticGroup
'Property is False.
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Using a layout file to preserve user changes in the CommandManager [Janus UI and Ribbon Controls v3.5 for .NET]
Use a layout file to preserve UICommandManager component settings. Using a layout file you could be able to preserve even the changes to the layout made by the user.
In VB:
Private Sub LoadLayout()
Dim LayoutDir As String = "C:\UIBarsLayout.xml"
Dim LayoutStream As FileStream
LayoutStream = New FileStream(LayoutDir, FileMode.Open)
CommandManager1.LoadLayoutFile(LayoutStream)
LayoutStream.Close()
End Sub
Private Sub CommandManager1_CurrentLayoutChanging(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles _
CommandManager1.CurrentLayoutChanging
'tTo persist user changes in the current layout,
'call the Update method explicitly before changing the layout
If Not CommandManager1.CurrentLayout Is Nothing Then
CommandManager1.CurrentLayout.Update()
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Dim Result As DialogResult
Dim LayoutDir As String
Dim LayoutStream As FileStream
Result = MessageBox.Show("Do you want to preserve the changes in the" & _
"CommandManager layout?", "Preserve changes", _
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If Result = Windows.Forms.DialogResult.Cancel Then
e.Cancel = True
ElseIf Result = Windows.Forms.DialogResult.Yes Then
LayoutDir = "C:\UIBarsLayout.xml"
LayoutStream = New FileStream(LayoutDir, FileMode.Create)
CommandManager1.SaveLayoutFile(LayoutStream)
LayoutStream.Close()
End If
End Sub
In C#:
private void LoadLayout()
{
string layoutDir = @"C:\UIBarsLayout.xml";
FileStream layoutStream;
layoutStream = new FileStream(layoutDir, FileMode.Open);
CommandManager1.LoadLayoutFile(layoutStream);
layoutStream.Close();
}
private void commandManager1_CurrentLayoutChanging(object sender,
System.ComponentModel.CancelEventArgs e)
{
//To persist user changes in the current layout,
//call the Update method explicitly before changing the layout
if (commandManager1.CurrentLayout != null)
{
commandManager1.CurrentLayout.Update();
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result;
string layoutDir;
FileStream layoutStream;
result = MessageBox.Show("Do you want to preserve the changes in the CommandManager layout?",
"Preserve changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == DialogResult.Cancel)
{
e.Cancel = true;
}
else if (result == DialogResult.Yes)
{
layoutDir = @"C:\UIBarsLayout.xml";
layoutStream = new FileStream(layoutDir, FileMode.Create);
commandManager1.SaveLayoutFile(layoutStream);
layoutStream.Close();
}
}
Source Of Information : Janus v3.5 Help Files for VS 2008
-
DevExpress .NET XtraGrid Overview
The following is a summary of the features available to you in the XtraGrid Suite:
Data Specifics
• Full ADO+ Support - The XtraGrid takes full advantage of ADO+. Using this data access architecture and the separation of internal data modules from data presentation, the XtraGrid does not use any extra buffers in any of its modes. Even when grouping columns, the XtraGrid will use a minimum of memory and perform the operation as fast as the data source can supply the data.
• Support for Data Lists - The XtraGrid works with any source which supports the IList, ITypedList or IBindingList interface plus all inherited interfaces.
• Unbound Columns - It's possible to combine bound and unbound data modes. Just add unbound columns and supply data via an event. End-users can edit the values within unbound columns and the changes can then be saved to a custom data source.
• True Master-Detail Support - The XtraGrid allows you to establish and present master-detail information in either bound or unbound mode. You can even use the drill down mode to zoom into each detail level, allowing even the most complicated sets of relationships to be manipulated easily.
• Server-side Data Management - The GridControl and GridLookUpEdit controls support a new data-binding mode, called Server Mode, which has been specifically designed to support large data sets (consisting of 50,000 records and even more). Loading data from a data store in small portions, when required, and performing all data-aware operations on the server side are the key features of this data binding that ensure quick access to data, even if the sorting, grouping, filtering and summary features are used. See Server Mode for more details.
Data Representation Specifics
• View Based Architecture - Every level in the XtraGrid can be represented by a different View. The XtraGrid comes with five Views: Grid View that displays data using the standard row and column layout, Layout View that displays records as cards supporting multiple layouts, Card View that displays data records as cards using a simple layout, and Banded Grid View and Advanced Banded Grid View, that are similar to the Grid View, but support arranging columns into bands. Views can even be changed on the fly.
• View Repository - You can create Views, and then assign them to particular levels as your needs dictate (at design time or runtime).
• Multiple detail Views for Each Level - You can incorporate as many details Views into each level as you require. If more then one View is available at a level, users can select the desired View via selectable tool tips or tab controls.
• Automatic Creation of detail Views for Properties Implementing the IList Interface - If a specific property in the grid's data source implements the IList interface, a detail View will be created automatically to display the contents of the list referenced by this property.
• Displaying Only Predefined Master-Detail Relationships - It's possible to display all or only specific master-detail relationships from the data source.
In-place Editing
• 25+ Data Editors, which can be used as standalone or in-place within the XtraGrid.
• Editor Repository - You can setup a single in-place editor, for instance a pick image edit, as an editor for a payment type field, and use it for as many grids as you wish. When you use the repository and you have to add a different credit card payment type, you need only change one in-place editor.
• Multiple Editors per Column - The XtraGrid's flexibility is demonstrated by its ability to use different individual editors for the same column.
Views Specifics
• Automatic Column Sorting for Any Datasource - With the XtraGrid, you can sort against an unlimited number of columns, without writing a single line of code.
• Automatic Data Filtering for Any Datasource (Including IList) - Via its Excel(R) Style Filtering feature, you can filter data based upon the contents of a column. The filter expression is even displayed at the bottom, keeping your users informed of exactly what they are looking at. You can even create your own custom filter dialog to adapt the filtering feature to meet the needs of your end-users.
• Sorting by Values and Display Text - For each column you can specify how the column's data should be sorted - by the edit values or displayed values. Moreover, the columns that use LookupEdit and ImageComboBox in-place editors are sorted by default by the displayed values, while other columns are sorted by edit values.
• Custom Sorting - You can implement a custom sorting algorithm by handling a specific event.
• Row's Visibility - Use an event to hide records or make them visible regardless of a View's filter.
• Filter History - Views and columns support Filter History which allows end-users to apply the most recently used filter criteria to the values displayed within the grid.
• Filter Editor - This embedded control provides advanced capabilities to create complex filter criteria for the grid control. Also, if you apply a filter to the grid in some other way, the Filter Editor will parse the criteria and present them in a well-structured form - as individual filter conditions combined by logical operators.
• Custom Text for Cells via Events - You can provide custom display text for any column, and this will be used when printing or exporting the grid or when sorting by display text is applied against a column.
• Single and Multiple Record Selection
• Zooming Detail Views in Master-Detail Mode.
Grid View (and Descendants) Specifics
• Automatic Data Grouping for Any Datasource - Allow your users to group the data stored in the XtraGrid against an unlimited number of columns, giving them an unprecedented ability to analyze and edit information.
• Grouping by Intervals - When grouping against a column that stores date/time values the rows can be grouped by the date, month, or year part of the column's values, or in a more comprehensive manner (Today, Tomorrow, Sunday, Monday, Tuesday, Next Week, Next Month, Last Week, Last Month, ...).
• Custom Grouping - The XtraGrid provides an event to implement custom grouping logic.
• Full Data Summaries - Summaries allow you to present statistical information such as MIN, MAX, AVG, SUM, and COUNT directly in the grid itself, without having to resort to the age-old ugly work around of using an individual edit control. Even better: You can handle summary specific events to implement complex functions with ease. Standard deviation, and all sorts of other statistical formulas are now available.
• Sorting Group Rows by Summary Values.
• Fixed Column and Band Support - Designed to help data entry, this feature allows you to freeze columns and bands on the left or right side of the XtraGrid
• Intelligent Column Resizing - With the AutoWidth and BestFit options, your end-users can manage and control the widths of columns as their needs dictate.
• Cell Merging - With this feature enabled, cells with matching values in adjacent rows will be merged.
• Custom Cell Merging - Just handle the event to control how cells are merged.
• Preview Pane - With the preview pane, you can let your end-users View large text or memo fields directly in the Grid, without the need to open an external editor or drop-down window.
• New Item Row - Using the New-Item row, you can provide consistent insert functionality for end-users. This row can be displayed at the top or bottom of a View.
• Auto Filter Row - This allows end-users to filter data on the fly - by typing values directly within this row.
• Row Separators - This feature allows you to fully control indentation between individual rows with a single property setting.
• Custom Row Height and Runtime Row Resizing
• Multiple Cell Selection Mode - Use the CTRL and SHIFT keys.
• Incremental Searching - This allows end-users to locate information within the XtraGrid on the fly.
• Runtime Column Customization - With the XtraGrid, your end-users can control the appearance of the grid as they wish, by adding and removing columns using drag and drop.
• Multiple Data Scrolling Modes.
• Joined Group Panel - With this feature, your end-users can group against any detail View without having to display the data grouping pane within the detail View itself.
Layout View Specifics
• Multiple Card Layouts - One or multiple columns, one or multiple rows, carousel mode, etc.
• Customizable Card Field Layouts
• Support for Automatic Filtering and Sorting
• Support for Multiple Card Selection.
• Card Collapsing/Expanding
Card View Specifics
• Support of Automatic Filtering and Sorting - End-users can apply filtering and sort order settings for Card Views via the Customize button.
• Support of Multiple Selection of Cards.
• Cards Can Be Expanded/Collapsed.
• Card Field Visibility - End-users are able to specify the visibility of specific card fields via the Customize button.
Painting Specifics
• Extended Look and Feel Support. Built-in XP Theme Support.
• Various Paint Styles in Views (Office2003, Web, Flat, WindowsXP, Style3D, etc).
• Skins Support - Skins will bring a striking look and feel to your applications, far beyond the normal painting standards.
• Office 2003 Style for Group Rows.
• Appearances - A powerful mechanism to control the entire look and feel of the grid. You can customize the appearance of almost any visual element of the XtraGrid, and even apply them conditionally to reflect certain states, such as errors. The XtraGrid ships with an easy to use Appearance editor.
• Extended Gradient and AlphaBlending Support - With the XtraGrid, you can apply gradient and alpha blending to any grid element via the design time property settings.
• Custom Draw - allows you to paint almost any of the XtraGrid's elements, as your needs dictate.
Design-Time
• Advanced Design-Time Support - The XtraGrid provides an advanced design time editor and Level Designer that allow you to control virtually every aspect of the XtraGrid, without having to write a single line of code. Instead of writing code to manage the appearance, you can instead, concentrate on writing code to handle the really "interesting" tasks. Using Advanced design time support, you can manage such advanced features as levels, styles, columns, and summaries.
• Assign Views from the Repository to Levels - In the Level Designer you can assign a specific View from the repository to a level. The View currently assigned to the level is not disposed of.
• Feature Browser - This design-time facility provides a quick and intuitive interface to modify options which correspond to a specific feature. Use this browser to locate only those settings that affect a specific feature.
• Advanced Appearance Designer - It's very easy to customize appearance settings for the grid with this designer. If you need to set the appearance of a specific element, simply click the required element in the Preview window, and the associated appearance objects will be displayed.
• Design-time column/band selection - Not only can you select a column/band in the properties grid, but you can also select it directly in the XtraGrid at design time.
• Design-Time Card Field Selection in Card Views.
Miscellaneous
• Built-in Menus - Grid control menus let you put the power and flexibility of the XtraGrid at your user's finger tips by using a set of standard popup menus that you can enable or disable at will. With these popup menus, your end-users can invoke column customizations, apply sorting, grouping, and even create summaries.
• Column Header and Cell Hint Support.
• Embedded Data Navigator - The XtraGrid Suite allows you to include a built-in data navigator similar to the Microsoft(R) Access(R) data grid.
• Custom Buttons in the Embedded Navigator - You can add custom buttons to the embedded navigator to implement custom functionality.
• ErrorInfo Support - The XtraGrid supports the standard IDataErrorInfo interface.
• Save and Load View Layouts - The XtraGrid allows you to save and load View layouts at both runtime and design time.
• Export to TXT, HTML, XML and MS Excel (R) formats.
• Printing (via the XtraPrinting Library).
• Localization of Every Interface Element.
Source of Information : DevExpress Documentation
-
Changing the Texts in the Customize Dialogs Form of Janus CommandManager [Janus UI and Ribbon Controls v3.5 for .NET]
Change the default texts used in the customize dialog of the Janus CommandManager.
In the ShowingCustomizeDialog event of the UICommandManager assign the dialog to the inherited form
In VB:
Private Sub UICommandManager1_ShowingCustomizeDialog(ByVal sender As Object, ByVal e As Janus.Windows.UI.CommandBars.CancelDialogEventArgs) Handles UICommandManager1.ShowingCustomizeDialog
Select Case e.DialogType
Case Janus.Windows.UI.CommandBars.DialogType.Customize
Dim form As CustomizeForm = New CustomizeForm()
e.Dialog = form
End Select
End Sub
In C#:
private void uiCommandManager1_ShowingCustomizeDialog(object sender, Janus.Windows.UI.CommandBars.CancelDialogEventArgs e)
{
switch (e.DialogType)
{
case Janus.Windows.UI.CommandBars.DialogType.Customize:
CustomizeForm customizeForm = new CustomizeForm();
e.Dialog = customizeForm;
break;
}
}
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Creating and Displaying an UIContextMenu [Janus UI and Ribbon Controls v3.5 for .NET]
The following code shows how to create and display a context menu in code.
In VB:
Dim ctMenu As UIContextMenu = New UIContextMenu()
'Create the commands that will be added to the context menu
Dim cutCommand As UICommand = New UICommand("Cut", "Cu&t")
Dim copyCommand As UICommand = New UICommand("Copy", "Cop&y")
Dim pasteCommand As UICommand = New UICommand("Paste", "&Paste")
'Add the commands to the Commands collection of the context menu
ctMenu.Commands.Add(cutCommand)
ctMenu.Commands.Add(copyCommand)
ctMenu.Commands.Add(pasteCommand)
'Call the Show method to display the context menu.
ctMenu.Show()
In C#:
UIContextMenu ctMenu = new UIContextMenu();
//Create the commands that will be added to the context menu
UICommand cutCommand = new UICommand("Cut", "Cu&t");
UICommand copyCommand = new UICommand("Copy", "Cop&y");
UICommand pasteCommand = new UICommand("Paste", "&Paste");
//Add the commands to the Commands collection of the context menu
ctMenu.Commands.Add(cutCommand);
ctMenu.Commands.Add(copyCommand);
ctMenu.Commands.Add(pasteCommand);
//Call the Show method to display the context menu.
ctMenu.Show();
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Adding Commands to the UICommandBar [Janus UI and Ribbon Controls v3.5 for .NET]
The following code shows how to add a UICommand into a command bar at run time.
In VB:
Dim CommandManager As UICommandManager = New UICommandManager()
'Assign the control in which the rebar containing the command bars will be placed
CommandManager.ContainerControl = Me
Dim CommandBar As Janus.Windows.UI.CommandBars.UICommandBar = New Janus.Windows.UI.CommandBars.UICommandBar("Menu")
'Assign the UICommandManager that will hold the structure of the command bar.
CommandBar.CommandManager = CommandManager
'Specify that the command bar should behave and look as a Menu
CommandBar.CommandBarType = Janus.Windows.UI.CommandBars.CommandBarType.Menu
'Create the file command and add it to the Commands collection of the UICommandManager
Dim baseCommand As UICommand = New UICommand("File", "&File")
CommandManager.Commands.Add(baseCommand)
'Create the command that will be placed on the command bar based on the file command
Dim toolBarCommand As UICommand = New UICommand(baseCommand)
CommandBar.Commands.Add(toolBarCommand)
In C#
Janus.Windows.UI.CommandBars.UICommandManager commandManager = new UICommandManager();
//Assign the control in which the rebar containing the command bars will be placed
commandManager.ContainerControl = this;
UICommandBar commandBar = new Janus.Windows.UI.CommandBars.UICommandBar("Menu");
//Assign the UICommandManager that will hold the structure of the command bar.
commandBar.CommandManager = commandManager;
//Specify that the command bar should behave and look as a Menu
commandBar.CommandBarType = Janus.Windows.UI.CommandBars.CommandBarType.Menu;
//Create the file command and add it to the Commands collection of the UICommandManager
UICommand baseCommand = new UICommand("File", "&File");
commandManager.Commands.Add(baseCommand);
//Create the command that will be placed on the command bar based on the file command
UICommand toolBarCommand = new UICommand(baseCommand);
commandBar.Commands.Add(toolBarCommand);
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Creating an UICommandBar [Janus UI and Ribbon Controls v3.5 for .NET]
The following code shows how to create a UICommandBar in code and placed on the Form.
In C#Janus.Windows.UI.CommandBars.UICommandManager commandManager = new UICommandManager();
//Assign the control in which the rebar containing the command bars will be placed
commandManager.ContainerControl = this;
UICommandBar commandBar = new Janus.Windows.UI.CommandBars.UICommandBar("Menu");
//Assign the UICommandManager that will hold the structure of the command bar.
commandBar.CommandManager = commandManager;
//Specify that the command bar should behave and look as a Menu
commandBar.CommandBarType = Janus.Windows.UI.CommandBars.CommandBarType.Menu;
In VB:Dim CommandManager As Janus.Windows.UI.CommandBars.UICommandManager = New UICommandManager()
'Assign the control in which the rebar containing the command bars will be placed
CommandManager.ContainerControl = Me
Dim CommandBar As UICommandBar = New UICommandBar("Menu")
'Assign the UICommandManager that will hold the structure of the command bar.
CommandBar.CommandManager = CommandManager
'Specify that the command bar should behave and look as a Menu
CommandBar.CommandBarType = Janus.Windows.UI.CommandBars.CommandBarType.Menu
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Using MultipleValues columns [Janus GridEX WinForms Control v3.5 for .NET]
Use MultipleValues column to display a list of values in a cell sample C# code
private void FillContactCategoriesValueList()
{
GridEXColumn column;
column = gridEX1.RootTable.Columns["ContactsContacts_ContactCategories"];
column.HasValueList = true;
//Set EditType to Combo or DropDownList.
//In a MultipleValues Column, the dropdown will appear with a CheckBox
//at the left of each item to let the user select multiple items
column.EditType = EditType.DropDownList;
column.ValueList.PopulateValueList(
gridEXTutorialsDataDataSet1.ContactCategories.DefaultView,
"ContactCategoryID", "CategoryName");
column.CompareTarget = ColumnCompareTarget.Text;
column.DefaultGroupInterval = GroupInterval.Text;
}
Source Of Information : Janus v3.5 Help Files for VS 2008
-
Starting Threads
Creating a thread is very simple. Take a look at the following example:
using System;
using System.Threading;
public class EntryPoint
{
private static void ThreadFunc()
{
Console.WriteLine("Hello from new thread {0}!",
Thread.CurrentThread.GetHashCode());
}
static void Main()
{
// Create the new thread.
Thread newThread =
new Thread(new ThreadStart(EntryPoint.ThreadFunc));
Console.WriteLine("Main Thread is {0}",
Thread.CurrentThread.ManagedThreadId);
Console.WriteLine("Starting new thread...");
// Start the new thread.
newThread.Start();
// Wait for new thread to finish.
newThread.Join();
Console.WriteLine("New thread has finished");
}
}
All you have to do is create a new System.Thread object and pass an instance of the ThreadStart delegate as the parameter to the constructor. The ThreadStart delegate references a method that takes no parameters and returns no parameters. In the previous example, I chose to use the static ThreadFunc method as the start of execution for the new thread. I could have just as easily chosen to use any other method visible to the code creating the thread, as long as it neither accepted nor returned parameters. Notice that the code also outputs the managed thread identifier in two different ways to demonstrate how you can identify threads in the managed world. In the unmanaged C++ world, you would use the thread ID obtained via the Win32 API. In the managed world of .NET 1.1, you instead use the value returned by GetHashCode. As long as this thread is alive, it is guaranteed never to collide with any other thread in any application domain of this process. The thread hash code is not globally unique on the entire system. Starting with .NET 2.0, you can get the managed thread id by accessing the
Thread.ManagedThreadId property. Also, you can see how you can get a reference to the current thread by accessing the static property Thread.CurrentThread. Finally, notice the call to the Join method on the newThread object. In native Win32 code, you normally wait for a thread to finish by waiting on its handle. When the thread finishes running, the operating system signals its handle and the wait completes. The Thread.Join method encapsulates this functionality. In this case, the code waits forever for the thread to finish. Thread.Join also provides a few overloads that allow you to specify a timeout period on the wait.
When you create a separate thread, it is subject to the rules of the thread scheduler on the system, just like any other thread. However, sometimes you need to create threads that carry a little more or a little less weight when the scheduler algorithm is deciding which thread to execute next. You can control the priority of a managed thread via the Thread.Priority property. You can adjust this value as necessary during execution of the thread. It’s actually a rare occurrence that you’ll need to adjust this value. All threads start out with the priority of Normal from the ThreadPriority enumeration.
There is some confusion in the MSDN documentation regarding whether one should call Thread.GetHashCode or access the Thread.ManagedThreadId property. If you read the MSDN documentation carefully, the summary page for System.Thread indicates that GetHashCode is what you should use to obtain the unique managed thread identifier during the duration the thread is alive. But if you look at the documentation for Thread.GetHashCode, it states that you should use the ManagedThreadId property instead. By debugging into the example application above using windbg in the Debugging Tools for Windows package in concert with the sos.dll debugger extension, I was able to determine that the results of GetHashCode and the ManagedThreadId property accessor both harvest the value from the same location within an internal structure of the Thread object instance. Arguably, ManagedThreadId makes the code easier to read because it’s more obvious what it is. Additionally, ManagedThreadId was introduced in .NET 2.0 and if you are targeting .NET 1.1, then you must use GetHashCode. I expect this confusion in the MSDN documentation to go away at some point soon, as it is a documentation bug. You should always rely upon ManagedThreadId even though GetHashCode returns the same value for the purposes of backwards compatibility. Throughout the rest of this chapter, I will be using ManagedThreadId rather than GetHashCode.
Subscribe to:
Posts (Atom)