Archive for gennaio 2015

Controlli di Syncfusion Essentials Studio per Windows Phone e WinRT

Posted on 5 gennaio 2015. Filed under: Senza categoria |

Concludiamo la serie di articoli su questo meraviglioso strumento della Syncfusion, parlando dei controlli per dispositivi mobile, quindi Windows Phone, WinRT e Universal App.

Iniziamo da quelli per Windows Phone.

Dalla Dashboard, accediamo alla sezione Windows Phone.

image

 

La versione 12.1 include controlli per Windows Phone 7 e Windows Phone 8, mentre la 12.3 non ha più quella per Windows Phone 7 ma oltre a quella per Windows Phone 8 include le due versioni per Windows Phone 8.1 (la 8.1 e la 8.1 Silverlight).

Vediamole entrambe.

Una cosa importante: se dovete ancora creare un’ App per Windows Phone 7, suggerisco prima di cliccare sugli esempi, di impostare Visual Studio 2012 come versione di default all’apertura di un file .SLN, altrimenti si aprirà Visual Studio 2013 chiedendo di fare l’aggiornamento.

Gli esempi li posiamo anche vedere online qua http://help.syncfusion.com/wp7

image

image

 

image

 

Vediamo qualche controllo per Windows Phone 8.0 (questa volta da Visual Studio)

image

image

image

image

image

image

image

image

image

image

image

image

image

image

Vi ricordate la prenotazione aerea che abbiamo trovato sui controlli ASP NET?

Eccola in chiave Windows Phone:

image

image

image

image

 

Come potete vedere anche per Windows Phone 7 e 8, Syncfusion Essential Studio soddisfa tutte le esigenze degli sviluppatori.

 

Vediamo ora quelle per Windows Phone 8.1 e 8.1 Silverlight. Mettiamo prima come apertura di default Visual Studio 2013, in quanto solo Visual Studio 2013 (con i vari Update) potrà aprire e gestire le applicazioni Windows Phone 8.1

 

image

image

image

 

 

Più molte altre, tra le quali quelle viste in precedenza, compresa la ormai famosa prenotazione aerea.

image

image

image

 

E queste per Windows Phone 8.1 Silverlight

image

image

image

E così via gli altri.

 

Vediamo ora alcuni esempi per WinRT e Universal App.

image

image

 

Abbiamo anche i Ribbon (riveduta in versione Modern UI):

image

image

image

image

image

 

Infine vediamo quelle per le Universal App.

image

image

image

image

 

image

image

image

 

Abbiamo finito questa carrellata visiva di controlli (è solo una parte, quella che abbiamo visto) che Syncfusion Essential Studio mette a disposizione degli sviluppatori. Non potete farne a meno.

Cosa altro dire su questo tool della Syncfusion che non abbiamo detto? Che il sito di riferimento è http://www.syncfusion.com/ e il supporto tecnico lo trovate qua: http://www.syncfusion.com/support/kb

 

Il prezzo? Diciamo i prezzi, in base alla versione e ai moduli che vi interessano, li trovate qua: http://www.syncfusion.com/sales/products

 

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Pubblicità
Leggi l'articolo intero | Make a Comment ( None so far )

I controlli di Syncfusion Essential Studio per applicazioni Desktop

Posted on 4 gennaio 2015. Filed under: Senza categoria |

Abbiamo visto nei precedenti articoli gli strumenti che mette a disposizione dello sviluppatore questa meravigliosa suite.

Quello che ci serve e per ciascun ambito: non dobbiamo neanche far fatica a implementare questi controlli nei nostri progetti Visual Studio.

Vediamo ora le due tecnologie per applicazioni in ambiente Desktop: Windows Forms e WPF.

Apriamo la Dashboard e poi clicchiamo su Windows Forms.

image

 

Clicchiamo quindi su “RUN LOCAL SAMPLES”. Si apre una nuova finestra con i controlli in stile Windows 8, come abbiamo visto per Silverlight.

image

 

Proviamo un semplice menù:

image

 

E questo è il codice:

#region Copyright Syncfusion Inc. 2001 – 2014
//
//  Copyright Syncfusion Inc. 2001 – 2014. All rights reserved.
//
//  Use of this code is subject to the terms of our license.
//  A copy of the current license can be obtained at any time by e-mailing
//  licensing@syncfusion.com. Any infringement will be prosecuted under
//  applicable laws.
//
#endregion

namespace XPMenusMDI
{
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using Microsoft.Win32;
    using System.Threading;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;

    using Syncfusion.Windows.Forms.Tools;
    using Syncfusion.Windows.Forms.Tools.XPMenus;
    using Syncfusion.Win32;
    using Syncfusion.Runtime.Serialization;
    using Syncfusion.Windows.Forms;

    /// <summary>
    /// Summary description for MainForm.
    /// </summary>
    public class MainForm : MetroForm
    {
        private Syncfusion.Windows.Forms.Tools.XPMenus.PopupMenu popupMenu2;
        private System.Windows.Forms.ImageList imageList1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager barManager1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem barItem8;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem barItem9;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem barItem10;
        private Syncfusion.Windows.Forms.Tools.XPMenus.DropDownBarItem dropDownBarItem1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem barItem11;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem barItem12;
        private System.Windows.Forms.MdiClient mdiClient1;
        private Syncfusion.Windows.Forms.PopupControlContainer popupControlContainer1;
        private System.Windows.Forms.ListBox listBox1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem parentBarItem1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem barItem13;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem parentBarItem2;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem openBarItem;
        private System.Windows.Forms.OpenFileDialog openFileDialog1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem closeBarItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem WindowsMenu;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem exitBarItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem cascadeBarItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem tileHBarItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem tileVBarItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ListBarItem mruFilesListItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.MdiListBarItem mdiListBarItem1;
        private System.Windows.Forms.ImageList largeImageList;
        private Syncfusion.Windows.Forms.Tools.XPMenus.Bar bar1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.Bar bar2;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem themesItem;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem parentBarItem4;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ToolbarListBarItem toolbarListBarItem1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.Bar bar3;
        public Syncfusion.Windows.Forms.Tools.XPMenus.StaticBarItem staticBarItem1;
        private Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem parentBarItem3;
        private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem Office2003Item;
        private Syncfusion.Windows.Forms.Tools.XPMenus.Bar bar4;
        private BarItem VS2005Item;
        private BarItem Outlook2007Item;
        private ParentBarItem parentBarItem5;
        private BarItem barItem2;
        private BarItem barItem3;
        private BarItem barItem1;
        private BarItem barItem4;
        private PopupControlContainer popupControlContainer2;
        private ColorPickerUIAdv colorPickerUIAdv1;
        private DropDownBarItem dropDownBarItem2;
        private System.ComponentModel.IContainer components;

        public MainForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.MinimumSize = this.Size;
            try
            {
                System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid.ico"));
                this.Icon = ico;
            }
            catch { }

            // Choosing to show a merged menu/toolbar structure, all the time.
            // Hence registering the Child Form Types that will be instantiated during the course of
            // the application.
            // (You can choose not to invoke a merge explicitly, in which case, the framework
            // will automatically merge the menus/toolbars from the child Forms when instances
            // of those types get created).
            this.staticBarItem1.Text = "Ready";
            this.dropDownBarItem2.UpdateUIOnAppIdle = true;
            this.dropDownBarItem2.UpdateUI += new EventHandler(dropDownBarItem2_UpdateUI);
            this.barManager1.RegisterMdiChildTypes(new Type[]
                            {
                                typeof(TextEditorForm),
                                typeof(ImageEditorForm)
                            });

        }
        private string GetIconFile(string bitmapName)
        {
            for (int n = 0; n < 10; n++)
            {
                if (System.IO.File.Exists(bitmapName))
                    return bitmapName;

                bitmapName = @"..\" + bitmapName;
            }

            return bitmapName;
        }

        void dropDownBarItem2_UpdateUI(object sender, EventArgs e)
        {
            this.colorPickerUIAdv1.RecentGroup.Visible = false;
        }

        private void ListItemClicked(object sender, EventArgs e)
        {
            ListBarItemClickedEventArgs args = e as ListBarItemClickedEventArgs;
            ListBarItem listItem = sender as ListBarItem;

            listItem.CheckedIndices.Clear();
            listItem.CheckedIndices.Add(args.IndexClicked);
            // Refresh, in case this item is put in a ParentBarItem with CloseOnClick = false
            listItem.UpdateCheckedStates();

            MessageBox.Show("ListItem: " + listItem.ChildCaptions[args.IndexClicked]);
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support – do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            this.barItem8 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.barItem9 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.popupControlContainer1 = new Syncfusion.Windows.Forms.PopupControlContainer();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.barManager1 = new Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager(this);
            this.bar1 = new Syncfusion.Windows.Forms.Tools.XPMenus.Bar(this.barManager1, "MainMenu");
            this.parentBarItem1 = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();
            this.openBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.closeBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.parentBarItem3 = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();
            this.mruFilesListItem = new Syncfusion.Windows.Forms.Tools.XPMenus.ListBarItem();
            this.exitBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.parentBarItem4 = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();
            this.toolbarListBarItem1 = new Syncfusion.Windows.Forms.Tools.XPMenus.ToolbarListBarItem();
            this.WindowsMenu = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();
            this.cascadeBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.tileHBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.tileVBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.mdiListBarItem1 = new Syncfusion.Windows.Forms.Tools.XPMenus.MdiListBarItem();
            this.parentBarItem2 = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();
            this.barItem13 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.bar2 = new Syncfusion.Windows.Forms.Tools.XPMenus.Bar(this.barManager1, "Standard");
            this.bar3 = new Syncfusion.Windows.Forms.Tools.XPMenus.Bar(this.barManager1, "StatusBar");
            this.staticBarItem1 = new Syncfusion.Windows.Forms.Tools.XPMenus.StaticBarItem();
            this.bar4 = new Syncfusion.Windows.Forms.Tools.XPMenus.Bar(this.barManager1, "Color");
            this.Office2003Item = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.VS2005Item = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.Outlook2007Item = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.parentBarItem5 = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();
            this.barItem2 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.barItem3 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.barItem1 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.dropDownBarItem2 = new Syncfusion.Windows.Forms.Tools.XPMenus.DropDownBarItem();
            this.popupControlContainer2 = new Syncfusion.Windows.Forms.PopupControlContainer();
            this.colorPickerUIAdv1 = new Syncfusion.Windows.Forms.Tools.ColorPickerUIAdv();
            this.themesItem = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.largeImageList = new System.Windows.Forms.ImageList(this.components);
            this.mdiClient1 = new System.Windows.Forms.MdiClient();
            this.barItem12 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.barItem11 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.barItem10 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            this.dropDownBarItem1 = new Syncfusion.Windows.Forms.Tools.XPMenus.DropDownBarItem();
            this.popupMenu2 = new Syncfusion.Windows.Forms.Tools.XPMenus.PopupMenu(this.components);
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.barItem4 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();
            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
            this.popupControlContainer2.SuspendLayout();
            this.SuspendLayout();
            //
            // barItem8
            //
            this.barItem8.BarName = "barItem8";
            this.barItem8.CategoryIndex = 0;
            this.barItem8.ID = "Test4";
            this.barItem8.ShowToolTipInPopUp = false;
            this.barItem8.SizeToFit = true;
            this.barItem8.Text = "Test4";
            //
            // barItem9
            //
            this.barItem9.BarName = "barItem9";
            this.barItem9.CategoryIndex = 0;
            this.barItem9.ID = "Test5";
            this.barItem9.ShowToolTipInPopUp = false;
            this.barItem9.SizeToFit = true;
            this.barItem9.Text = "Test5";
            //
            // imageList1
            //
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "");
            this.imageList1.Images.SetKeyName(1, "");
            this.imageList1.Images.SetKeyName(2, "");
            this.imageList1.Images.SetKeyName(3, "");
            this.imageList1.Images.SetKeyName(4, "");
            this.imageList1.Images.SetKeyName(5, "");
            this.imageList1.Images.SetKeyName(6, "");
            this.imageList1.Images.SetKeyName(7, "");
            this.imageList1.Images.SetKeyName(8, "");
            this.imageList1.Images.SetKeyName(9, "");
            this.imageList1.Images.SetKeyName(10, "");
            this.imageList1.Images.SetKeyName(11, "");
            this.imageList1.Images.SetKeyName(12, "");
            this.imageList1.Images.SetKeyName(13, "");
            this.imageList1.Images.SetKeyName(14, "");
            this.imageList1.Images.SetKeyName(15, "architecture_info_16.png");
            this.imageList1.Images.SetKeyName(16, "ballon_fav_16.png");
            //
            // popupControlContainer1
            //
            this.popupControlContainer1.Location = new System.Drawing.Point(384, 80);
            this.popupControlContainer1.Name = "popupControlContainer1";
            this.popupControlContainer1.Size = new System.Drawing.Size(96, 96);
            this.popupControlContainer1.TabIndex = 5;
            this.popupControlContainer1.Visible = false;
            //
            // listBox1
            //
            this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listBox1.Location = new System.Drawing.Point(0, 0);
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size(96, 95);
            this.listBox1.TabIndex = 0;
            //
            // barManager1
            //
            this.barManager1.BarPositionInfo = ((System.IO.MemoryStream)(resources.GetObject("barManager1.BarPositionInfo")));
            this.barManager1.Bars.Add(this.bar1);
            this.barManager1.Bars.Add(this.bar2);
            this.barManager1.Bars.Add(this.bar3);
            this.barManager1.Bars.Add(this.bar4);
            this.barManager1.Categories.Add("File");
            this.barManager1.Categories.Add("View");
            this.barManager1.Categories.Add("Window");
            this.barManager1.Categories.Add("&Help");
            this.barManager1.Categories.Add("StatusBar");
            this.barManager1.CurrentBaseFormType = "Syncfusion.Windows.Forms.MetroForm";
            this.barManager1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.barManager1.Form = this;
            this.barManager1.ImageList = this.imageList1;
            this.barManager1.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.parentBarItem1,
            this.openBarItem,
            this.closeBarItem,
            this.parentBarItem4,
            this.mruFilesListItem,
            this.WindowsMenu,
            this.exitBarItem,
            this.themesItem,
            this.parentBarItem2,
            this.parentBarItem3,
            this.Office2003Item,
            this.VS2005Item,
            this.cascadeBarItem,
            this.Outlook2007Item,
            this.tileHBarItem,
            this.parentBarItem5,
            this.tileVBarItem,
            this.barItem1,
            this.barItem13,
            this.barItem2,
            this.mdiListBarItem1,
            this.barItem3,
            this.toolbarListBarItem1,
            this.staticBarItem1,
            this.dropDownBarItem2});
            this.barManager1.LargeImageList = this.largeImageList;
            this.barManager1.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.barManager1.ResetCustomization = false;
            this.barManager1.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            //
            // bar1
            //
            this.bar1.BarName = "MainMenu";
            this.bar1.BarStyle = ((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle)((((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.AllowQuickCustomizing | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.IsMainMenu)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.RotateWhenVertical)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.Visible)));
            this.bar1.Caption = "MainMenu";
            this.bar1.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.parentBarItem1,
            this.parentBarItem4,
            this.WindowsMenu,
            this.parentBarItem2});
            this.bar1.Manager = this.barManager1;
            //
            // parentBarItem1
            //
            this.parentBarItem1.BarName = "parentBarItem1";
            this.parentBarItem1.CategoryIndex = 0;
            this.parentBarItem1.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.parentBarItem1.ID = "&File";
            this.parentBarItem1.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.openBarItem,
            this.closeBarItem,
            this.parentBarItem3,
            this.exitBarItem});
            this.parentBarItem1.MergeOrder = 1;
            this.parentBarItem1.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.parentBarItem1.SeparatorIndices.AddRange(new int[] {
            2,
            3});
            this.parentBarItem1.ShowToolTipInPopUp = false;
            this.parentBarItem1.SizeToFit = true;
            this.parentBarItem1.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            this.parentBarItem1.Text = "&File";
            this.parentBarItem1.Selected += new System.EventHandler(this.Item_Selected);
            //
            // openBarItem
            //
            this.openBarItem.BarName = "openBarItem";
            this.openBarItem.CategoryIndex = 0;
            this.openBarItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.openBarItem.ID = "&Open";
            this.openBarItem.ImageIndex = 0;
            this.openBarItem.MergeOrder = 1;
            this.openBarItem.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
            this.openBarItem.ShowToolTipInPopUp = false;
            this.openBarItem.SizeToFit = true;
            this.openBarItem.Text = "&Open";
            this.openBarItem.Click += new System.EventHandler(this.openBarItem_Click);
            this.openBarItem.Selected += new System.EventHandler(this.Item_Selected);
            //
            // closeBarItem
            //
            this.closeBarItem.BarName = "closeBarItem";
            this.closeBarItem.CategoryIndex = 0;
            this.closeBarItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.closeBarItem.ID = "&Close";
            this.closeBarItem.ImageIndex = 4;
            this.closeBarItem.MergeOrder = 3;
            this.closeBarItem.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftO;
            this.closeBarItem.ShowToolTipInPopUp = false;
            this.closeBarItem.SizeToFit = true;
            this.closeBarItem.Text = "&Close";
            this.closeBarItem.Click += new System.EventHandler(this.closeBarItem_Click);
            this.closeBarItem.Selected += new System.EventHandler(this.Item_Selected);
            //
            // parentBarItem3
            //
            this.parentBarItem3.BarName = "parentBarItem3";
            this.parentBarItem3.CategoryIndex = 0;
            this.parentBarItem3.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.parentBarItem3.ID = "Most Rec&ently Used Files";
            this.parentBarItem3.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.mruFilesListItem});
            this.parentBarItem3.MergeOrder = 8;
            this.parentBarItem3.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.parentBarItem3.ShowToolTipInPopUp = false;
            this.parentBarItem3.SizeToFit = true;
            this.parentBarItem3.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            this.parentBarItem3.Text = "Most Recently Used Files";
            //
            // mruFilesListItem
            //
            this.mruFilesListItem.BarName = "mruFilesListItem";
            this.mruFilesListItem.CategoryIndex = 0;
            this.mruFilesListItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.mruFilesListItem.ID = "Most Recently Used Files List";
            this.mruFilesListItem.MergeOrder = 10;
            this.mruFilesListItem.ShowToolTipInPopUp = false;
            this.mruFilesListItem.SizeToFit = true;
            this.mruFilesListItem.Text = "MRU List";
            this.mruFilesListItem.Click += new System.EventHandler(this.ListItemClicked);
            //
            // exitBarItem
            //
            this.exitBarItem.BarName = "exitBarItem";
            this.exitBarItem.CategoryIndex = 0;
            this.exitBarItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.exitBarItem.ID = "E&xit";
            this.exitBarItem.ImageIndex = 8;
            this.exitBarItem.MergeOrder = 20;
            this.exitBarItem.ShowToolTipInPopUp = false;
            this.exitBarItem.SizeToFit = true;
            this.exitBarItem.Text = "E&xit";
            this.exitBarItem.Click += new System.EventHandler(this.exitBarItem_Click);
            this.exitBarItem.Selected += new System.EventHandler(this.Item_Selected);
            //
            // parentBarItem4
            //
            this.parentBarItem4.BarName = "parentBarItem4";
            this.parentBarItem4.CategoryIndex = 1;
            this.parentBarItem4.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.parentBarItem4.ID = "&View";
            this.parentBarItem4.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.toolbarListBarItem1});
            this.parentBarItem4.MergeOrder = 5;
            this.parentBarItem4.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.parentBarItem4.ShowToolTipInPopUp = false;
            this.parentBarItem4.SizeToFit = true;
            this.parentBarItem4.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            this.parentBarItem4.Text = "&View";
            this.parentBarItem4.Selected += new System.EventHandler(this.Item_Selected);
            //
            // toolbarListBarItem1
            //
            this.toolbarListBarItem1.BarName = "toolbarListBarItem1";
            this.toolbarListBarItem1.CategoryIndex = 1;
            this.toolbarListBarItem1.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.toolbarListBarItem1.ID = "&Toolbars";
            this.toolbarListBarItem1.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.toolbarListBarItem1.ShowToolTipInPopUp = false;
            this.toolbarListBarItem1.SizeToFit = true;
            this.toolbarListBarItem1.Text = "&Toolbars";
            //
            // WindowsMenu
            //
            this.WindowsMenu.BarName = "WindowsMenu";
            this.WindowsMenu.CategoryIndex = 2;
            this.WindowsMenu.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.WindowsMenu.ID = "&Window";
            this.WindowsMenu.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.cascadeBarItem,
            this.tileHBarItem,
            this.tileVBarItem,
            this.mdiListBarItem1});
            this.WindowsMenu.MergeOrder = 19;
            this.WindowsMenu.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.WindowsMenu.SeparatorIndices.AddRange(new int[] {
            3});
            this.WindowsMenu.ShowToolTipInPopUp = false;
            this.WindowsMenu.SizeToFit = true;
            this.WindowsMenu.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            this.WindowsMenu.Text = "&Window";
            this.WindowsMenu.Selected += new System.EventHandler(this.Item_Selected);
            //
            // cascadeBarItem
            //
            this.cascadeBarItem.BarName = "cascadeBarItem";
            this.cascadeBarItem.CategoryIndex = 2;
            this.cascadeBarItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cascadeBarItem.ID = "&Cascade";
            this.cascadeBarItem.ImageIndex = 1;
            this.cascadeBarItem.ShowToolTipInPopUp = false;
            this.cascadeBarItem.SizeToFit = true;
            this.cascadeBarItem.Text = "&Cascade";
            this.cascadeBarItem.Click += new System.EventHandler(this.cascadeBarItem_Click);
            this.cascadeBarItem.Selected += new System.EventHandler(this.Item_Selected);
            //
            // tileHBarItem
            //
            this.tileHBarItem.BarName = "tileHBarItem";
            this.tileHBarItem.CategoryIndex = 2;
            this.tileHBarItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tileHBarItem.ID = "Tile &Horizontal";
            this.tileHBarItem.ImageIndex = 2;
            this.tileHBarItem.ShowToolTipInPopUp = false;
            this.tileHBarItem.SizeToFit = true;
            this.tileHBarItem.Text = "Tile &Horizontal";
            this.tileHBarItem.Click += new System.EventHandler(this.tileHBarItem_Click);
            this.tileHBarItem.Selected += new System.EventHandler(this.Item_Selected);
            //
            // tileVBarItem
            //
            this.tileVBarItem.BarName = "tileVBarItem";
            this.tileVBarItem.CategoryIndex = 2;
            this.tileVBarItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tileVBarItem.ID = "Tile &Vertical";
            this.tileVBarItem.ImageIndex = 3;
            this.tileVBarItem.ShowToolTipInPopUp = false;
            this.tileVBarItem.SizeToFit = true;
            this.tileVBarItem.Text = "Tile &Vertical";
            this.tileVBarItem.Click += new System.EventHandler(this.tileVBarItem_Click);
            this.tileVBarItem.Selected += new System.EventHandler(this.Item_Selected);
            //
            // mdiListBarItem1
            //
            this.mdiListBarItem1.BarName = "mdiListBarItem1";
            this.mdiListBarItem1.CategoryIndex = 2;
            this.mdiListBarItem1.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.mdiListBarItem1.ID = "Window List";
            this.mdiListBarItem1.ShowToolTipInPopUp = false;
            this.mdiListBarItem1.SizeToFit = true;
            //
            // parentBarItem2
            //
            this.parentBarItem2.BarName = "parentBarItem2";
            this.parentBarItem2.CategoryIndex = 3;
            this.parentBarItem2.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.parentBarItem2.ID = "&Help";
            this.parentBarItem2.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.barItem13});
            this.parentBarItem2.MergeOrder = 20;
            this.parentBarItem2.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.parentBarItem2.ShowToolTipInPopUp = false;
            this.parentBarItem2.SizeToFit = true;
            this.parentBarItem2.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            this.parentBarItem2.Text = "&Help";
            this.parentBarItem2.Selected += new System.EventHandler(this.Item_Selected);
            //
            // barItem13
            //
            this.barItem13.BarName = "barItem13";
            this.barItem13.CategoryIndex = 3;
            this.barItem13.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.barItem13.ID = "Syncfusion on the Web";
            this.barItem13.ImageIndex = 11;
            this.barItem13.ShowToolTipInPopUp = false;
            this.barItem13.SizeToFit = true;
            this.barItem13.Text = "Syncfusion on the Web";
            this.barItem13.Click += new System.EventHandler(this.barItem13_Click);
            this.barItem13.Selected += new System.EventHandler(this.Item_Selected);
            //
            // bar2
            //
            this.bar2.BarName = "Standard";
            this.bar2.BarStyle = ((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle)((((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.AllowQuickCustomizing | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.RotateWhenVertical)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.Visible)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.DrawDragBorder)));
            this.bar2.Caption = "Standard";
            this.bar2.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.openBarItem,
            this.closeBarItem});
            this.bar2.Manager = this.barManager1;
            //
            // bar3
            //
            this.bar3.BarName = "StatusBar";
            this.bar3.BarStyle = ((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle)(((((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.AllowQuickCustomizing | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.RotateWhenVertical)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.Visible)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.DrawDragBorder)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.IsStatusBar)));
            this.bar3.Caption = "StatusBar";
            this.bar3.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.staticBarItem1});
            this.bar3.Manager = this.barManager1;
            //
            // staticBarItem1
            //
            this.staticBarItem1.BarName = "staticBarItem1";
            this.staticBarItem1.CategoryIndex = 4;
            this.staticBarItem1.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.staticBarItem1.FlatBorderColor = System.Drawing.SystemColors.GrayText;
            this.staticBarItem1.ID = "Stutus1";
            this.staticBarItem1.ShowToolTipInPopUp = false;
            this.staticBarItem1.SizeToFit = true;
            this.staticBarItem1.Text = "Status1";
            //
            // bar4
            //
            this.bar4.BarName = "Color";
            this.bar4.BarStyle = ((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle)((((Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.AllowQuickCustomizing | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.RotateWhenVertical)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.Visible)
                        | Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.DrawDragBorder)));
            this.bar4.Caption = "Color";
            this.bar4.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.Office2003Item,
            this.VS2005Item,
            this.Outlook2007Item,
            this.parentBarItem5,
            this.themesItem});
            this.bar4.Manager = this.barManager1;
            this.bar4.SeparatorIndices.AddRange(new int[] {
            0,
            1,
            2,
            3});
            //
            // Office2003Item
            //
            this.Office2003Item.BarName = "Office2003Item";
            this.Office2003Item.CategoryIndex = 0;
            this.Office2003Item.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Office2003Item.ID = "Office2003";
            this.Office2003Item.ImageIndex = 6;
            this.Office2003Item.PaintStyle = Syncfusion.Windows.Forms.Tools.XPMenus.PaintStyle.ImageAndText;
            this.Office2003Item.ShowToolTipInPopUp = false;
            this.Office2003Item.SizeToFit = true;
            this.Office2003Item.Text = "Office 2003";
            this.Office2003Item.Tooltip = "Enable Office 2003 Style";
            this.Office2003Item.Click += new System.EventHandler(this.barItem1_Click);
            //
            // VS2005Item
            //
            this.VS2005Item.BarName = "VS2005Item";
            this.VS2005Item.CategoryIndex = 0;
            this.VS2005Item.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.VS2005Item.ID = "VS2005";
            this.VS2005Item.ImageIndex = 15;
            this.VS2005Item.PaintStyle = Syncfusion.Windows.Forms.Tools.XPMenus.PaintStyle.ImageAndText;
            this.VS2005Item.ShowToolTipInPopUp = false;
            this.VS2005Item.SizeToFit = true;
            this.VS2005Item.Text = "VS 2005";
            this.VS2005Item.Click += new System.EventHandler(this.VS2005Item_Click);
            //
            // Outlook2007Item
            //
            this.Outlook2007Item.BarName = "Outlook2007Item";
            this.Outlook2007Item.CategoryIndex = 0;
            this.Outlook2007Item.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Outlook2007Item.ID = "Outlook2007";
            this.Outlook2007Item.ImageIndex = 16;
            this.Outlook2007Item.PaintStyle = Syncfusion.Windows.Forms.Tools.XPMenus.PaintStyle.ImageAndText;
            this.Outlook2007Item.ShowToolTipInPopUp = false;
            this.Outlook2007Item.SizeToFit = true;
            this.Outlook2007Item.Text = "Outlook2007";
            this.Outlook2007Item.Click += new System.EventHandler(this.Outlook2007Item_Click);
            //
            // parentBarItem5
            //
            this.parentBarItem5.BarName = "parentBarItem5";
            this.parentBarItem5.CategoryIndex = 0;
            this.parentBarItem5.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.parentBarItem5.ID = "Color Scheme";
            this.parentBarItem5.ImageIndex = 7;
            this.parentBarItem5.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {
            this.barItem2,
            this.barItem3,
            this.barItem1,
            this.dropDownBarItem2});
            this.parentBarItem5.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.parentBarItem5.PaintStyle = Syncfusion.Windows.Forms.Tools.XPMenus.PaintStyle.ImageAndText;
            this.parentBarItem5.ShowToolTipInPopUp = false;
            this.parentBarItem5.SizeToFit = true;
            this.parentBarItem5.Style = Syncfusion.Windows.Forms.VisualStyle.Metro;
            this.parentBarItem5.Text = "Color Scheme";
            //
            // barItem2
            //
            this.barItem2.BarName = "barItem2";
            this.barItem2.CategoryIndex = 0;
            this.barItem2.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.barItem2.ID = "Blue";
            this.barItem2.ShowToolTipInPopUp = false;
            this.barItem2.SizeToFit = true;
            this.barItem2.Text = "Blue";
            this.barItem2.Click += new System.EventHandler(this.barItem2_Click);
            //
            // barItem3
            //
            this.barItem3.BarName = "barItem3";
            this.barItem3.CategoryIndex = 0;
            this.barItem3.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.barItem3.ID = "Silver";
            this.barItem3.ShowToolTipInPopUp = false;
            this.barItem3.SizeToFit = true;
            this.barItem3.Text = "Silver";
            this.barItem3.Click += new System.EventHandler(this.barItem3_Click);
            //
            // barItem1
            //
            this.barItem1.BarName = "barItem1";
            this.barItem1.CategoryIndex = 0;
            this.barItem1.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.barItem1.ID = "Black";
            this.barItem1.ShowToolTipInPopUp = false;
            this.barItem1.SizeToFit = true;
            this.barItem1.Text = "Black";
            this.barItem1.Click += new System.EventHandler(this.barItem1_Click_1);
            //
            // dropDownBarItem2
            //
            this.dropDownBarItem2.BarName = "dropDownBarItem2";
            this.dropDownBarItem2.CategoryIndex = 0;
            this.dropDownBarItem2.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.dropDownBarItem2.ID = "Custom Colors";
            this.dropDownBarItem2.PopupControlContainer = this.popupControlContainer2;
            this.dropDownBarItem2.ShowToolTipInPopUp = false;
            this.dropDownBarItem2.SizeToFit = true;
            this.dropDownBarItem2.Text = "Custom Colors";
            //
            // popupControlContainer2
            //
            this.popupControlContainer2.Controls.Add(this.colorPickerUIAdv1);
            this.popupControlContainer2.Location = new System.Drawing.Point(173, 164);
            this.popupControlContainer2.Name = "popupControlContainer2";
            this.popupControlContainer2.Size = new System.Drawing.Size(172, 201);
            this.popupControlContainer2.TabIndex = 10002;
            this.popupControlContainer2.Visible = false;
            //
            // colorPickerUIAdv1.RecentGroup
            //
            this.colorPickerUIAdv1.RecentGroup.Name = "Recent Colors";
            this.colorPickerUIAdv1.RecentGroup.Visible = false;
            //
            // colorPickerUIAdv1.StandardGroup
            //
            this.colorPickerUIAdv1.StandardGroup.Name = "Standard Colors";
            //
            // colorPickerUIAdv1.ThemeGroup
            //
            this.colorPickerUIAdv1.ThemeGroup.IsSubItemsVisible = true;
            this.colorPickerUIAdv1.ThemeGroup.Name = "Theme Colors";
            //
            // colorPickerUIAdv1
            //
            this.colorPickerUIAdv1.ColorItemSize = new System.Drawing.Size(13, 13);
            this.colorPickerUIAdv1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.colorPickerUIAdv1.Location = new System.Drawing.Point(0, 0);
            this.colorPickerUIAdv1.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(110)))), ((int)(((byte)(218)))));
            this.colorPickerUIAdv1.MinimumSize = new System.Drawing.Size(136, 195);
            this.colorPickerUIAdv1.Name = "colorPickerUIAdv1";
            this.colorPickerUIAdv1.SelectedColor = System.Drawing.Color.Empty;
            this.colorPickerUIAdv1.Size = new System.Drawing.Size(172, 201);
            this.colorPickerUIAdv1.Style = Syncfusion.Windows.Forms.Tools.ColorPickerUIAdv.visualstyle.Metro;
            this.colorPickerUIAdv1.TabIndex = 10003;
            this.colorPickerUIAdv1.Text = "colorPickerUIAdv1";
            this.colorPickerUIAdv1.UseOffice2007Style = false;
            this.colorPickerUIAdv1.VerticalItemsSpacing = 1;
            this.colorPickerUIAdv1.Picked += new Syncfusion.Windows.Forms.Tools.ColorPickerUIAdv.ColorPickedEventHandler(this.colorPickerUIAdv1_Picked);
            //
            // themesItem
            //
            this.themesItem.BarName = "themesItem";
            this.themesItem.CategoryIndex = 0;
            this.themesItem.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.themesItem.ID = "ThemesEnabled";
            this.themesItem.ImageIndex = 5;
            this.themesItem.MergeOrder = 21;
            this.themesItem.PaintStyle = Syncfusion.Windows.Forms.Tools.XPMenus.PaintStyle.ImageAndText;
            this.themesItem.ShowToolTipInPopUp = false;
            this.themesItem.SizeToFit = true;
            this.themesItem.Text = "Themes Enabled";
            this.themesItem.Tooltip = "Enable Themes";
            this.themesItem.Click += new System.EventHandler(this.themesItem_Click);
            //
            // largeImageList
            //
            this.largeImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("largeImageList.ImageStream")));
            this.largeImageList.TransparentColor = System.Drawing.Color.Transparent;
            this.largeImageList.Images.SetKeyName(0, "");
            this.largeImageList.Images.SetKeyName(1, "");
            this.largeImageList.Images.SetKeyName(2, "");
            this.largeImageList.Images.SetKeyName(3, "");
            this.largeImageList.Images.SetKeyName(4, "");
            this.largeImageList.Images.SetKeyName(5, "");
            this.largeImageList.Images.SetKeyName(6, "");
            //
            // mdiClient1
            //
            this.mdiClient1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.mdiClient1.Location = new System.Drawing.Point(0, 50);
            this.mdiClient1.Name = "mdiClient1";
            this.mdiClient1.Size = new System.Drawing.Size(0, 0);
            this.mdiClient1.TabIndex = 4;
            //
            // barItem12
            //
            this.barItem12.BarName = "barItem12";
            this.barItem12.CategoryIndex = 0;
            this.barItem12.ID = "dummy";
            this.barItem12.ShowToolTipInPopUp = false;
            this.barItem12.SizeToFit = true;
            this.barItem12.Text = "dummy";
            //
            // barItem11
            //
            this.barItem11.BarName = "barItem11";
            this.barItem11.CategoryIndex = 2;
            this.barItem11.ID = "Tseting";
            this.barItem11.ShowToolTipInPopUp = false;
            this.barItem11.SizeToFit = true;
            this.barItem11.Text = "Tseting";
            //
            // barItem10
            //
            this.barItem10.BarName = "barItem10";
            this.barItem10.CategoryIndex = 0;
            this.barItem10.ID = "Test";
            this.barItem10.ShowToolTipInPopUp = false;
            this.barItem10.SizeToFit = true;
            this.barItem10.Text = "Test";
            //
            // dropDownBarItem1
            //
            this.dropDownBarItem1.BarName = "dropDownBarItem1";
            this.dropDownBarItem1.CategoryIndex = 1;
            this.dropDownBarItem1.ID = "DropDown";
            this.dropDownBarItem1.ShowToolTipInPopUp = false;
            this.dropDownBarItem1.SizeToFit = true;
            this.dropDownBarItem1.Text = "DropDown";
            //
            // popupMenu2
            //
            this.popupMenu2.ParentBarItem = this.parentBarItem1;
            //
            // openFileDialog1
            //
            this.openFileDialog1.Filter = "txt files (*.txt)|*.txt|Image Files (*.bmp; *.ico)|*.bmp;*.ico";
            this.openFileDialog1.FilterIndex = 0;
            this.openFileDialog1.Title = "Text or Image File Selection Dialog";
            //
            // barItem4
            //
            this.barItem4.BarName = "barItem4";
            this.barItem4.CategoryIndex = 0;
            this.barItem4.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.barItem4.ID = "Custom Colors";
            this.barItem4.ShowToolTipInPopUp = false;
            this.barItem4.SizeToFit = true;
            this.barItem4.Text = "Custom Colors";
            //
            // MainForm
            //
            this.AccessibleName = "";
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
            this.CaptionAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.ClientSize = new System.Drawing.Size(709, 495);
            this.Controls.Add(this.popupControlContainer2);
            this.DropShadow = true;
            this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.IconAlign = System.Windows.Forms.HorizontalAlignment.Left;
            this.IconTextRelation = System.Windows.Forms.LeftRightAlignment.Left;
            this.IsMdiContainer = true;
            this.MetroColor = System.Drawing.Color.White;
            this.Name = "MainForm";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "MDI Demo";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.MdiChildActivate += new System.EventHandler(this.MainForm_MdiChildActivate);
            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
            this.popupControlContainer2.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        #endregion

        #region DLL Imports
        [DllImport("user32.dll", CharSet=CharSet.Auto)]
        extern public static bool SetForegroundWindow(IntPtr hwnd);
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        public static void Main()
        {
            // Safe mode check
            // Uncomment this to include support for running this app in "Safe Mode" (when persisted data will not be loaded).
            // SafeModeCheck();

            // Modify this version, whenever changes are made such that the persisted state cannot be loaded anymore.
            string curVersion = "1.0";
            ValidatePersistedStateVersion(curVersion);
            StoreVersionInfo(curVersion);

            MainForm mainForm = new MainForm();

            bool bRunning = false;
            foreach ( Process p in Process.GetProcesses(System.Environment.MachineName) )
            {
                if( p.MainWindowHandle != IntPtr.Zero)
                {
                    // Process name gets truncated!
                    if(p.ProcessName == "XPMenus")
                    {
                        bRunning = true;
                        MessageBox.Show("Activating the already open instance of XPMenus.exe.");
                        SetForegroundWindow(p.MainWindowHandle);
                        break;
                    }
                }
            }
            if(!bRunning)
            {
                Application.Run(mainForm);
                OnAppShutDown();
            }       
        }

        #region VERSIONING
        private static bool safeModeOn = false;
        static void SafeModeCheck()
        {
            object value;
            RegistryKey regKey = Registry.CurrentUser;
            regKey = regKey.CreateSubKey("Software\\Syncfusion\\XPMenus");
            AppStateSerializer ass = new AppStateSerializer(SerializeMode.WindowsRegistry, regKey);
            value = ass.DeserializeObject("SafeModeFlag");

            if(value != null)
                safeModeOn = (bool)value;

            if(safeModeOn)
            {
                MessageBox.Show("Previous instantiation of this application did not shut down properly. Running in safe mode. User specific persisted information will not be loaded. You can turn off safe mode when the application exits.", "Safe Mode Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AppStateSerializer.GetSingleton().Enabled = false;
            }
            else
            {
                RegistryKey key = Registry.CurrentUser;
                key = key.CreateSubKey("Software\\Syncfusion\\XPMenus");
                // turn on safe mode (will be reset if app closed safely)
                ass.SerializeObject("SafeModeFlag", (object)true);
            }
        }

        static void OnAppShutDown()
        {
            RegistryKey regKey = Registry.CurrentUser;
            regKey = regKey.CreateSubKey("Software\\Syncfusion\\XPMenus");

            bool resetFlag = false;
            if(safeModeOn)
            {
                DialogResult dlgResult = MessageBox.Show("Would you like to turn off Safe Mode?", "Safe Mode information", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if(dlgResult == DialogResult.Yes)
                    resetFlag = true;
            }
            else
                resetFlag = true;

            AppStateSerializer.GetSingleton().Enabled = true;

            if(resetFlag)
            {
                AppStateSerializer ass = new AppStateSerializer(SerializeMode.WindowsRegistry, regKey);
                ass.SerializeObject("SafeModeFlag", (object)false);
            }
        }

        static string VersionTag = "AppVersion";
        static void ValidatePersistedStateVersion(string curVersion)
        {
            // Versioning
            AppStateSerializer serializer = AppStateSerializer.GetSingleton();
            object objectOut = serializer.DeserializeObject(VersionTag);
            if(objectOut != null)
            {
                string version = (string)objectOut;
                version = version.ToLower();

                curVersion = curVersion.ToLower();

                // Persisted info is not the current version, lets lose it.
                if(version != curVersion)
                    serializer.FlushSerializer();
            }
        }
        // Store the current version, so that we can validate it the next time.
        static void StoreVersionInfo(string curVersion)
        {
            AppStateSerializer serializer = AppStateSerializer.GetSingleton();
            serializer.SerializeObject(VersionTag, curVersion, true);
        }
        #endregion VERSIONING

        #region XPMenusInitialization

        private void Form1_Load(object sender, System.EventArgs e)
        {
            bool found = true;
            try
            {
                string filename1 = "..\\..\\logo.jpg";
                string filename2 = "..\\..\\Description.txt";
                this.AddDocument(new ImageEditorForm("..\\..\\logo.jpg"));
                this.AddDocument(new TextEditorForm("..\\..\\Description.txt"));
                this.mruFilesListItem.ChildCaptions.Add(filename1);
                this.mruFilesListItem.ChildCaptions.Add(filename2);
            }
            catch{found = false;}
            if(!found)
            {
                try
                {
                    this.AddDocument(new ImageEditorForm("suite.gif"));
                    this.AddDocument(new TextEditorForm("csharp.ini"));
                   
                }
                catch{}
            }
            // Application specific initialization
            this.UpdateMenuItems();
        }

        #endregion XPMenusInitialization

        #region SampleAppLogic
        private void AddDocument(Form newForm)
        {
            newForm.MdiParent = this;
            newForm.Show();
        }

        private void openBarItem_Click(object sender, System.EventArgs e)
        {
            DocumentTypeSelectionDialog dlg = new DocumentTypeSelectionDialog();
            if(dlg.ShowDialog() != DialogResult.OK)
                return;

            int docType = dlg.SelectedType;

            this.openFileDialog1.FileName = String.Empty;
            if(docType == 0)
                this.openFileDialog1.Filter = "txt files (*.txt)|*.txt|All Files (*.*)|*.*";
            else if(docType == 1)
                this.openFileDialog1.Filter = "Image Files (*.bmp; *.ico; *.jpg)|*.bmp;*.ico;*.jpg|All Files (*.*)|*.*";

            if(this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string filename = this.openFileDialog1.FileName;
                filename = filename.ToLower();
                //if(filename.IndexOf(".txt") != -1)
                this.mruFilesListItem.ChildCaptions.Add(filename);

                if(docType == 0)
                {
                    // Text file opened
                    TextEditorForm childForm = new TextEditorForm(filename);
                    this.AddDocument(childForm);
                }
                else if(docType == 1)
                {
                    try
                    {
                        ImageEditorForm imageEditor = new ImageEditorForm(filename);
                        this.AddDocument(imageEditor);
                    }
                    catch{};
                }
            }
        }
       
        private void closeBarItem_Click(object sender, System.EventArgs e)
        {
            Form activeChild = this.ActiveMdiChild;
            if(activeChild != null)
                activeChild.Close();
        }

        private void MainForm_MdiChildActivate(object sender, System.EventArgs e)
        {
            this.UpdateMenuItems();
        }

        private void UpdateMenuItems()
        {
            if(this.ActiveMdiChild != null)
            {
                this.closeBarItem.Enabled = true;
                this.WindowsMenu.Enabled = true;
            }
            else
            {
                this.closeBarItem.Enabled = false;
                this.WindowsMenu.Enabled = false;
            }
        }

        private void exitBarItem_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }

       
        private void cascadeBarItem_Click(object sender, System.EventArgs e)
        {
            this.LayoutMdi(MdiLayout.Cascade);
        }

        private void tileHBarItem_Click(object sender, System.EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void tileVBarItem_Click(object sender, System.EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileVertical);
        }
        #endregion SampleAppLogic
   
        #region AboutForm_Logic
        DemoCommon.AboutForm aboutForm = null;
        private void barItem13_Click(object sender, System.EventArgs e)
        {
            aboutForm = new DemoCommon.AboutForm(AppDomain.CurrentDomain.GetAssemblies());
            aboutForm.ShowDialog();
        }
        private void AboutFormCloseBtnClicked(object sender, EventArgs e)
        {
            aboutForm.Close();
        }
        #endregion AboutForm_Logic

        internal void HideToolBar()
        {
            this.barManager1.GetCommandBarManager().SetBarVisibility(this.bar2, false);
        }

        private void Item_Selected(object sender, System.EventArgs e)
        {
            BarItem item = sender as BarItem;
            this.staticBarItem1.Text = item.Text;
        }

        private void themesItem_Click(object sender, System.EventArgs e)
        {
            this.Office2003Item.Checked = false;
            this.VS2005Item.Checked = false;
            this.Outlook2007Item.Checked = false;

            this.themesItem.Checked = !this.themesItem.Checked;
            this.barManager1.Style = VisualStyle.Default;
            if (this.themesItem.Checked)
                this.barManager1.ThemesEnabled = true;
            else
                this.barManager1.ThemesEnabled = false;
        }

        // Office 2003 Item
        private void barItem1_Click(object sender, System.EventArgs e)
        {
            this.themesItem.Checked = false;
            this.VS2005Item.Checked = false;
            this.Outlook2007Item.Checked = false;
            this.barManager1.ThemesEnabled = false;

            this.Office2003Item.Checked =!this.Office2003Item.Checked;
            this.barManager1.Style = VisualStyle.Default;
            if(this.Office2003Item.Checked)
            {
                this.barManager1.Style = VisualStyle.Office2003;
            }
            else
            {
                this.barManager1.Style = VisualStyle.OfficeXP;
            }
        }

      

        private void VS2005Item_Click(object sender, EventArgs e)
        {
            this.Office2003Item.Checked = false;
            this.themesItem.Checked = false;
            this.barManager1.ThemesEnabled = false;
            this.Outlook2007Item.Checked = false;

            this.VS2005Item.Checked = !this.VS2005Item.Checked;
            if (this.VS2005Item.Checked)
            {
                this.barManager1.Style = VisualStyle.VS2005;
            }
            else
            {
                this.barManager1.Style = VisualStyle.OfficeXP;
            }
        }

        private void Outlook2007Item_Click(object sender, EventArgs e)
        {
            this.Office2003Item.Checked = false;
            this.themesItem.Checked = false;
            //this.barManager1.ThemesEnabled = false;
            this.VS2005Item.Checked = false;

            this.Outlook2007Item.Checked = !this.Outlook2007Item.Checked;
            if (this.Outlook2007Item.Checked)
            {
                this.barManager1.Style = VisualStyle.Office2007Outlook;
            }
            else
            {
                this.barManager1.Style = VisualStyle.OfficeXP;
            }
        }

        private void barItem2_Click(object sender, EventArgs e)
        {
            this.Office2003Item.Checked = false;
            this.VS2005Item.Checked = false;
            this.Outlook2007Item.Checked = false;
            this.themesItem.Checked = false;

            this.barManager1.Style = VisualStyle.Office2007;
            this.barManager1.Office2007Theme = Office2007Theme.Blue;
        }

        private void barItem3_Click(object sender, EventArgs e)
        {
            this.Office2003Item.Checked = false;
            this.VS2005Item.Checked = false;
            this.Outlook2007Item.Checked = false;
            this.themesItem.Checked = false;

            this.barManager1.Style = VisualStyle.Office2007;
            this.barManager1.Office2007Theme = Office2007Theme.Silver;
        }

        private void barItem1_Click_1(object sender, EventArgs e)
        {
            this.Office2003Item.Checked = false;
            this.VS2005Item.Checked = false;
            this.Outlook2007Item.Checked = false;
            this.themesItem.Checked = false;

            this.barManager1.Style = VisualStyle.Office2007;
            this.barManager1.Office2007Theme = Office2007Theme.Black;
        }

        private void colorPickerUIAdv1_Picked(object sender, ColorPickerUIAdv.ColorPickedEventArgs args)
        {
            this.Office2003Item.Checked = false;
            this.VS2005Item.Checked = false;
            this.Outlook2007Item.Checked = false;
            this.themesItem.Checked = false;

            this.barManager1.Style = VisualStyle.Office2007;
            this.barManager1.Office2007Theme = Office2007Theme.Managed;
            Office2007Colors.ApplyManagedColors(this, args.Color);
            this.dropDownBarItem2.Checked = true;
            this.dropDownBarItem2.PopupControlContainer.HidePopup(PopupCloseType.Done);

        }

    }
}

 

Questa è una Datagrid:

image

 

 

#region Copyright Syncfusion Inc. 2001 – 2014
// Copyright Syncfusion Inc. 2001 – 2014. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
# region Directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using Syncfusion.Windows.Forms;
using System.Threading;
using Queries = PortfolioManager.LINQqueries;
#endregion

namespace PortfolioManager
{
    /// <summary>
    /// Portfolio Manager Form
    /// </summary>
    public partial class PortfolioManager : MetroForm
    {
        # region Variable Declaration
        DashBoard dashBoard;
        Analyzer.Contribution contributionAnalyzer;
        Analyzer.Performance performanceAnalyzer;       
        SynchronizationContext context;
        #endregion

        # region Event Handler
        public PortfolioManager()
        {
            //Start a back ground thread to get Chart data
            context = new SynchronizationContext();
            BackgroundWorker loadChartDataWorker = new BackgroundWorker();
            loadChartDataWorker.DoWork += new DoWorkEventHandler(loadChartDataWorker_DoWork);
            loadChartDataWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(loadChartDataWorker_RunWorkerCompleted);
            loadChartDataWorker.RunWorkerAsync();          

            InitializeComponent();
            try
            {
                System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid.ico"));
                this.Icon = ico;
            }
            catch { }

            InitializeDashBoard();
           // SkinManager.SetVisualStyle(this, "Office2007Blue");
        }
       
        /// <summary>
        /// Creates and initialized a new DashBoard
        /// </summary>
        void InitializeDashBoard()
        {
            dashBoard = new DashBoard();
            dashBoard.Dock = DockStyle.Fill;
            this.dashboardTabPage.Controls.Add(dashBoard);
            this.PortfolioTabControl.SelectedIndexChanged += new EventHandler(PortfolioTabControl_SelectedIndexChanged);           
        }

        void InitializeAnalyzer()
        {
            performanceAnalyzer = new Analyzer.Performance();
            performanceAnalyzer.Dock = DockStyle.Fill;           
            performanceAnalyzerTabPage.Controls.Add(performanceAnalyzer);                       
        }
           
        /// <summary>
        /// Handle TabPage changed and create ContributionAnalyzer on demand
        /// </summary>       
        void PortfolioTabControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.PortfolioTabControl.SelectedTab == this.contributionAnalyzerTabPage)
            {
                if (!this.contributionAnalyzerTabPage.Controls.Contains(this.contributionAnalyzer))
                {
                    this.contributionAnalyzer = new Analyzer.Contribution();
                    this.contributionAnalyzer.Dock = DockStyle.Fill;
                    this.contributionAnalyzerTabPage.Controls.Add(this.contributionAnalyzer);
                }
            }
        }

        //Worker thread loads Chart data on background
        void loadChartDataWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            context.Send(new SendOrPostCallback(Analyzer.PerformanceChart.LoadData), null);
            if (this.InvokeRequired)
                this.BeginInvoke(new Action(delegate() { this.loadingProgressBar.Show(); }));
        }

        //Initialize Analyzer when the WorkerThread is completed
        void loadChartDataWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.BeginInvoke(new Action(delegate()
            {
                this.loadingProgressBar.Hide();
                InitializeAnalyzer();
            }));
        }
        #endregion
    }
       
}

 

Come vedete, anche qui abbiamo infinite possibilità per creare ad esempio gestionali Windows Forms con interfacce accattivanti e senza le limitazioni del Windows Forms classico.

 

Andiamo adesso a vedere quelli WPF:

image

 

La schermata che troviamo è più o meno identica a quella di Windows Forms.

image

 

Vediamone qualcuno.

DateTime:

image

<syncfusion:ChromelessWindow x:Class="DateTimeEditDemo.Window2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:DateTimeEditDemo"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
     xmlns:sblayout="clr-namespace:SampleLayout.WPF;assembly=Syncfusion.SampleLayout.WPF" UseNativeChrome="True"
    Title="DateTimeEdit Demo" Width="750"  Icon="App.ico" WindowStartupLocation="CenterScreen"
    Height="640" FontFamily="Calibri" FontSize="13" >
    <syncfusion:ChromelessWindow.Resources>
        <sblayout:StringToCultureConverter x:Key="cultureconverter"/>
    </syncfusion:ChromelessWindow.Resources>
    <Grid>
        <Grid >
            <Grid.DataContext>
                <local:ViewModel />
            </Grid.DataContext>

            <sblayout:SampleLayoutControl  Header="DateTimeEdit Demo" x:Name="Sblayout" EventLogs="{Binding EventLogsCollection}"
                                          Description="DateTimeEdit is a control that allows you to select and edit the date with support for data binding, Null Value, Watermark, maximum and minimum value, and culture.">
                <sblayout:SampleLayoutControl.PropertyViewContent>
                    <sblayout:GroupBoxAdv Header="User Options">
                        <ScrollViewer>
                            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>

                                <!– Validation–>
                                <TextBlock Grid.ColumnSpan="2" Margin="3" Text="Validation" FontWeight="Bold"  HorizontalAlignment="Left"  VerticalAlignment="Center"/>
                                <TextBlock Grid.Column="0" Margin="3" FontWeight="Normal"  Grid.Row="1" Text="Min DateTime"   VerticalAlignment="Center" HorizontalAlignment="Left" />
                                <syncfusion:DateTimeEdit   HorizontalAlignment="Left" Width="120"   Grid.Column="1" Grid.Row="1"
                                                       DateTime="{Binding MinimumValue,Mode=TwoWay}" TextAlignment="Left"  Margin="3"  FontSize="12"  VerticalAlignment="Center"  x:Name="mindatetime" />
                                <TextBlock Text="Max DateTime" Margin="3" FontWeight="Normal" Grid.Column="0"  Grid.Row="2"  VerticalAlignment="Center" />
                                <syncfusion:DateTimeEdit  HorizontalAlignment="Left" Width="120"   DateTime="{Binding MaximumValue,Mode=TwoWay}" Grid.Column="1"  Grid.Row="2"  FontSize="12" Margin="3" 
                                                      VerticalAlignment="Center" x:Name="maxdatetime"/>

                                <!– Pattern–>
                                <TextBlock Grid.ColumnSpan="2" Grid.Row="3" Margin="3" Text="Pattern" FontWeight="Bold"  HorizontalAlignment="Left"  VerticalAlignment="Center"/>
                                <TextBlock Grid.Column="0" FontWeight="Normal" Grid.Row="4" Text="Pattern" Margin="3"
                                       VerticalAlignment="Center"/>
                                <ComboBox Width="120"  Name="cmbopattern" Grid.Row="4"  Margin="3" SelectedItem="{Binding Pattern,Mode=TwoWay}"
                                      SelectedIndex="2"  HorizontalAlignment="Left" VerticalAlignment="Center"  Grid.Column="1">

                                    <syncfusion:DateTimePattern >FullDateTime</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >ShortDate</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >LongDate</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >ShortTime</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >LongTime</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >MonthDay</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >RFC1123</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >YearMonth</syncfusion:DateTimePattern>
                                    <syncfusion:DateTimePattern >SortableDateTime</syncfusion:DateTimePattern>
                                </ComboBox>
                                <TextBlock Grid.Column="0" FontWeight="Normal" Grid.Row="5" Text="Culture" Margin="3"   VerticalAlignment="Center"/>
                                <ComboBox Width="120"  Name="MyComboBox" Grid.Row="5" Margin="3"  HorizontalAlignment="Left"    VerticalAlignment="Center" Grid.Column="1">
                                    <ComboBoxItem Tag="0" Content="uk-UA" />
                                    <ComboBoxItem Tag="1" Content="vi-VN"/>
                                    <ComboBoxItem Tag="2" Content="sq-AL"/>
                                    <ComboBoxItem Tag="3" Content="en-US" IsSelected="True"/>
                                    <ComboBoxItem Tag="4" Content="mn-MN"/>
                                    <ComboBoxItem Tag="5" Content="is-IS"/>
                                    <ComboBoxItem Tag="6" Content="ar-SA"/>
                                    <ComboBoxItem Tag="7" Content="he-IL"/>
                                </ComboBox>

                                <!– Others–>
                                <TextBlock Grid.ColumnSpan="2" Grid.Row="6" Margin="3" Text="Others" FontWeight="Bold"  HorizontalAlignment="Left"  VerticalAlignment="Center"/>
                                <TextBlock Grid.Row="7" Margin="3" FontWeight="Normal" Grid.Column="0" Text="None Date Text"   VerticalAlignment="Center"></TextBlock>
                                <TextBox Width="120"   HorizontalAlignment="Left"  Grid.Row="7"  Margin="3" Grid.Column="1"
                                      x:Name="TxtNoneDate" Text="Select Date Here.." VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="8" FontWeight="Normal" Text="Scrolling On Circle" Margin="3"/>
                                <CheckBox Name="chkscrolling" Grid.Row="8" IsChecked="True"
                                      Margin="3"   HorizontalAlignment="Left"   Grid.Column="1" VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="9" FontWeight="Normal" Text="Show DropDownButton" Margin="3"/>
                                <CheckBox Name="chkpopup" Grid.Row="9" IsChecked="True"
                                      Margin="3"   HorizontalAlignment="Left"   Grid.Column="1" VerticalAlignment="Center"/>
                               
                                <TextBlock Grid.Column="0" Grid.Row="10" FontWeight="Normal" Text="Can Edit" Margin="3"/>
                                <CheckBox Name="canEdit" Grid.Row="10"
                                      Margin="3"   HorizontalAlignment="Left"  Grid.Column="1" VerticalAlignment="Center"/>
                            
                                <TextBlock Grid.Column="0" Grid.Row="11" FontWeight="Normal" Text="Show Calendar" Margin="3"/>
                                <CheckBox Name="chkcalendarenable" Grid.Row="11" IsChecked="True"
                                      Margin="3"   HorizontalAlignment="Left"  Grid.Column="1" VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="12" FontWeight="Normal" Text="Show Repeat Buttons" Margin="3"/>
                                <CheckBox Name="chkrepeatbtnvisible" Grid.Row="12" IsChecked="False" 
                                      Margin="3"  HorizontalAlignment="Left"   Grid.Column="1" VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="13" FontWeight="Normal" Text="Enable Classic Style" Margin="3"/>
                                <CheckBox Name="chkenableclassiccstyle" Grid.Row="13" IsChecked="False" 
                                      Margin="3"  HorizontalAlignment="Left"   Grid.Column="1" VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="14" FontWeight="Normal" Text="Enable  EmptyDate " Margin="3"/>
                                <CheckBox Name="chkemptydate" Grid.Row="14" IsChecked="True"
                                      Margin="3"   HorizontalAlignment="Left"  Grid.Column="1" VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="15" FontWeight="Normal" Text="Disable DateSelection" Margin="3"/>
                                <CheckBox Name="chkdateselection" Grid.Row="15"
                                      Margin="3"   HorizontalAlignment="Left"  Grid.Column="1" VerticalAlignment="Center"/>

                                <TextBlock Grid.Column="0" Grid.Row="16" FontWeight="Normal" Text="Show Clock" Margin="3"/>
                                <CheckBox Name="chkwatchenable" Grid.Row="16" IsChecked="True"
                                      Margin="3"  HorizontalAlignment="Left"   Grid.Column="1" VerticalAlignment="Center"/>

                            </Grid>
                        </ScrollViewer>
                    </sblayout:GroupBoxAdv>
                </sblayout:SampleLayoutControl.PropertyViewContent>

                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <syncfusion:DateTimeEdit  Grid.Row="0" Width="250" Height="23" Margin="0,-40,0,0" Name="myDateTimeEdit" HorizontalAlignment="Center" VerticalAlignment="Center"
                                              IsButtonPopUpEnabled="{Binding ElementName=chkpopup,Path=IsChecked,Mode=TwoWay}"
                                              Pattern="{Binding Pattern}"
                                              CanEdit="{Binding ElementName=canEdit,Path=IsChecked}"
                                              NoneDateText="{Binding ElementName=TxtNoneDate,Path=Text}"
                                              IsWatchEnabled="{Binding ElementName=chkwatchenable,Path=IsChecked,Mode=TwoWay}" 
                                              CultureInfo="{Binding ElementName=MyComboBox, Path=SelectedItem, Converter={StaticResource cultureconverter}}"
                                              IsScrollingOnCircle="{Binding ElementName=chkscrolling,Path=IsChecked,Mode=TwoWay}"
                                                      DateTime="{Binding Value,Mode=TwoWay}"
                                              MinDateTime="{Binding MinimumValue}"
                                              MaxDateTime="{Binding MaximumValue}"
                                              IsReadOnly="{Binding ElementName=readonly, Path=IsChecked}"
                                               IsVisibleRepeatButton="{Binding ElementName=chkrepeatbtnvisible,Path=IsChecked,Mode=TwoWay}"
                                              IsCalendarEnabled="{Binding ElementName=chkcalendarenable,Path=IsChecked,Mode=TwoWay}"
                                              EnableClassicStyle="{Binding ElementName=chkenableclassiccstyle,Path=IsChecked,Mode=TwoWay}"
                                              IsEmptyDateEnabled="{Binding ElementName=chkemptydate,Path=IsChecked,Mode=TwoWay}"
                                              DisableDateSelection="{Binding ElementName=chkdateselection,Path=IsChecked,Mode=TwoWay}"
                                              syncfusion:DateTimeBaseIsDropDownOpenChangedCommand.Command="{Binding IsDropDownOpenChangedCommand}"
                                                syncfusion:DateTimeBaseIsDropDownOpenChangedCommand.CommandParameter="{Binding Path=IsPopupEnabled,RelativeSource={RelativeSource Self}}"
                                              syncfusion:DateTimeEditClockPopupOpenedEventCommand.Command="{Binding IsClockPopupOpenedCommand}"
                                              syncfusion:DateTimeEditCalendarPopupOpenedCommand.Command="{Binding IsCalendarPopupOpenedCommand}"
                                              syncfusion:DateTimeEditDateTimeChangedCommand.Command="{Binding DateTimeChangedCommand}"
                                                syncfusion:DateTimeEditMinDateTimeChangedCommand.Command="{Binding MinValueChangedCommand}"
                                                syncfusion:DateTimeEditMaxDateTimeChangedCommand.Command="{Binding MaxValueChangedCommand}"                                                 syncfusion:DateTimeBasePatternChangedCommand.Command="{Binding PatternChangedCommand}"
                                              
                                     
                                            
                                             
                                             
                                             
                                            >
                    </syncfusion:DateTimeEdit>

                    <ToggleButton Grid.Column="1" Height="20" Width="20" Margin="0,-40,0,0" Style="{StaticResource ToggleButtonStyle1}"
                                  ToolTip="Read only" x:Name="readonly">

                    </ToggleButton>

                </Grid>

            </sblayout:SampleLayoutControl>
        </Grid>

    </Grid>
</syncfusion:ChromelessWindow>

 

MasketTextBox:

image

<!–Window for applying custom skins–>
<syncfusion:ChromelessWindow  x:Class="MaskedTextBoxDemo.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" UseNativeChrome="True" 
    xmlns:syncfusion="http://schemas.syncfusion.com/wpf" xmlns:sblayout="clr-namespace:SampleLayout.WPF;assembly=Syncfusion.SampleLayout.WPF"
    Icon="App.ico"  x:Name="window1" WindowStartupLocation="CenterScreen"
    Title="Masked Text Box Demo"   Width="710"
    Height="510" FontFamily="Calibri" FontSize="13" xmlns:local="clr-namespace:MaskedTextBoxDemo" >

    <Grid>
        <Grid.DataContext>
            <local:ViewModel />
        </Grid.DataContext>
        <Grid >
            <sblayout:SampleLayoutControl Header="Masked TextBox" x:Name="Sblayout" EventLogs="{Binding EventLogsCollection}"
                                          Description="A masked text box lets you to restrict the user input to specific formats specified by a mask. You can use it to allow end users to enter proper telephone numbers, e-mails, etc. Regular expression-based masks can also be specified. There are also several built-in skins that can be used.">
                <sblayout:SampleLayoutControl.PropertyViewContent>
                    <sblayout:GroupBoxAdv Header="User Options">
                        <Grid Margin="5">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="170"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Text="Mask" FontWeight="Bold" Margin="2"/>

                            <TextBlock Text="WaterMark Text" Grid.Row="2" Margin="3" VerticalAlignment="Center" />
                            <TextBox Name="TxtWaterMarkText" Grid.Row="2" Margin="2" Grid.Column="1" Text="Please type here.." VerticalAlignment="Center"/>

                            <TextBlock Text="Text Mask Format" Grid.Row="4" Margin="2" VerticalAlignment="Center"/>
                            <ComboBox Grid.Row="4" Margin="2" Grid.Column="1" VerticalAlignment="Center" x:Name="maskformat" SelectedIndex="2">
                                <syncfusion:MaskFormat>ExcludePromptAndLiterals</syncfusion:MaskFormat>
                                <syncfusion:MaskFormat>IncludeLiterals</syncfusion:MaskFormat>
                                <syncfusion:MaskFormat>IncludePrompt</syncfusion:MaskFormat>
                                <syncfusion:MaskFormat>IncludePromptAndLiterals</syncfusion:MaskFormat>
                            </ComboBox>

                            <TextBlock Grid.Row="5" Text="Enable Watermark" Margin="3" VerticalAlignment="Center"/>
                            <CheckBox Name="chkWaterMarkTextVisibile" Grid.Row="5" Margin="3" Grid.Column="1"
                                      IsChecked="False" HorizontalAlignment="Left" VerticalAlignment="Center" />

                            <TextBlock Text="Others" Grid.Row="6" Margin="2" FontWeight="Bold"/>

                            <TextBlock Grid.Row="7" Text="Selection On Focus" Margin="3" VerticalAlignment="Center"/>
                            <CheckBox Name="chkTextSelectionOnFocus" Grid.Row="7" Margin="3" Grid.Column="1"
                                      IsChecked="True" VerticalAlignment="Center" />
                           

                        </Grid>
                    </sblayout:GroupBoxAdv>
                </sblayout:SampleLayoutControl.PropertyViewContent>

                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <TextBlock Text="Date of Birth" Margin="3" VerticalAlignment="Center" Width="88"/>

                        <syncfusion:MaskedTextBox TextSelectionOnFocus="{Binding ElementName=chkTextSelectionOnFocus,Path=IsChecked}" Width="180" Margin="3" Grid.Column="1" VerticalAlignment="Center"  Height="23" x:Name="DOB" IsReadOnly="{Binding ElementName=readonly, Path=IsChecked}"
                                                  WatermarkTextIsVisible="{Binding ElementName=chkWaterMarkTextVisibile, Path=IsChecked}" TextMaskFormat="{Binding ElementName=maskformat, Path=SelectedItem}"
                                                  VerticalContentAlignment="Center" Mask="99/99/9999" syncfusion:MaskedTextBoxValueChangedCommand.Command="{Binding DateValueChangedCommand}" 
                                                 Value="{Binding DateValue}"
                                                  WatermarkText="{Binding ElementName=TxtWaterMarkText, Path=Text}">

                        </syncfusion:MaskedTextBox>

                        <ToggleButton Grid.Column="2" Height="20" Width="20" Margin="0 3" Style="{StaticResource ToggleButtonStyle1}"
                                  ToolTip="Read only" x:Name="readonly">
                        </ToggleButton>
                        <TextBlock Text="[ MM / DD / YYYY ]" Grid.Row="1" Grid.Column="1" Margin="3 2" FontStyle="Italic" Opacity="0.5"/>

                    </Grid>
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Text="Phone Number" Margin="3" VerticalAlignment="Center" Width="88"/>
                        <syncfusion:MaskedTextBox Width="180" Margin="3" Grid.Column="1" VerticalAlignment="Center" Height="23" IsReadOnly="{Binding ElementName=readonly1, Path=IsChecked}" TextSelectionOnFocus="{Binding ElementName=chkTextSelectionOnFocus,Path=IsChecked}"
                                                  WatermarkTextIsVisible="{Binding ElementName=chkWaterMarkTextVisibile, Path=IsChecked}" x:Name="phone" WatermarkText="{Binding ElementName=TxtWaterMarkText, Path=Text}"
                                                  VerticalContentAlignment="Center" Mask="(000) 000-0000"  syncfusion:MaskedTextBoxValueChangedCommand.Command="{Binding PhoneValueChangedCommand}" 
                                                 Value="{Binding PhoneValue}">
                        </syncfusion:MaskedTextBox>
                        <ToggleButton Grid.Column="2" Height="20" Width="20" Margin="0 3" Style="{StaticResource ToggleButtonStyle1}"
                                  ToolTip="Read only" x:Name="readonly1">

                        </ToggleButton>
                        <TextBlock Text="[ (000) – (000) – (0000) ]" Grid.Row="1" Grid.Column="1" Margin="3 2" FontStyle="Italic" Opacity="0.5"/>
                    </Grid>
                    <Grid Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <TextBlock Text="Email Address" Margin="3" VerticalAlignment="Center" Width="88" />

                        <Border Width="182" Height="25" Grid.Column="1" x:Name="validation" BorderBrush="{Binding ValidationBorderBrush}" BorderThickness="1" Margin="3" VerticalAlignment="Center"/>
                        <syncfusion:MaskedTextBox Width="180" Margin="3" Grid.Column="1" VerticalAlignment="Center"  Height="23" IsReadOnly="{Binding ElementName=readonly2, Path=IsChecked}"
                                                  WatermarkTextIsVisible="{Binding ElementName=chkWaterMarkTextVisibile, Path=IsChecked}" x:Name="email" StringValidation="OnKeyPress" TextSelectionOnFocus="{Binding ElementName=chkTextSelectionOnFocus,Path=IsChecked}"
                                                  VerticalContentAlignment="Center"
                                                  Value="{Binding EmailValue}"
                                                  syncfusion:MaskedTextBoxValueChangedCommand.Command="{Binding EmailValueChangedCommand}" 
                                                  syncfusion:MaskedTextBoxStringValidationCompletedCommand.Command="{Binding StringValidationCompletedCommand}"
                                                  ValidationString="{Binding EmailValidationString}" WatermarkText="{Binding ElementName=TxtWaterMarkText, Path=Text}" >

                        </syncfusion:MaskedTextBox>

                        <ToggleButton Grid.Column="2" Height="20" Width="20" Margin="0 3" Style="{StaticResource ToggleButtonStyle1}"
                                  ToolTip="Read only" x:Name="readonly2">

                        </ToggleButton>
                        <TextBlock Text="[ someone@syncfusion.com ]" Grid.Row="1" Grid.Column="1" Margin="3 2" FontStyle="Italic" Opacity="0.5"/>

                    </Grid>
                </Grid>

            </sblayout:SampleLayoutControl>
        </Grid>
    </Grid>
</syncfusion:ChromelessWindow>

 

E così via.

Man mano che esploro questo strumento resto sempre più meravigliato dal perché non l’ho scoperto prima. Devo dire che è indispensabile per ogni sviluppatore.

 

Nel prossimo articolo vedremo i controlli per creare applicazioni per dispositivi mobile: WinRT, Windows Phone e Universal.

 

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

I controlli Javascript e Silverlight di Syncfusion Essential Studio

Posted on 4 gennaio 2015. Filed under: Senza categoria |

Nuovo articolo dedicato a Syncfusion Essential Studio, il favoloso tool che non può mancare nella cassetta degli attrezzi dello sviluppatore.

Vedremo ora i controlli per applicazioni web Javascript e Silverlight.

Vediamo prima quelli Javascript.

Sempre dalla Dashboard, clicchiamo su Javascript e ci appare questo.

 

image

Vediamo che qua abbiamo anche gli esempi OLAP e REPORT. Li vedremo dopo nell’articolo.

Iniziamo a vedere quelli  normali.

image

Come potete vedere i controlli sono più o meno gli stessi. Cambierà ovviamente il codice da essere implementato nelle vostre applicazioni.

image

image

 

Vediamo ora gli esempi OLAP.

Cliccando su “RUN OLAP SAMPLES” si aprirà Visual Studio con un progetto web già caricato.

Guardiamo cosa contiene:

image

image

Premendo F5, si aprirà Internet Explorer con questa pagina:

image

 

Vedete che ci sono degli esempi dei vari controlli OLAP. Il bello è che abbiamo già tutta la struttura che ci serve in Visual Studio.

Per esempio vediamo OLAP Client. C’è l’esempio di un browser.

image

Questo è il codice da implementare nella pagina HTML.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../themes/bootstrap.min.css" rel="stylesheet" />
    <link href="../themes/default-theme/ej.widgets.all.min.css" rel="stylesheet" />
    <link href="../themes/default.css" rel="stylesheet" />
    <script src="../scripts/jquery.globalize.min.js"></script>
    <script src="../scripts/jquery.globalize.cultures.min.js"></script>
    <link href="../themes/default-responsive.css" rel="stylesheet" />
    <script src="../scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="../scripts/jquery.easing.1.3.min.js" type="text/javascript"></script>
    <script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
    <script src="../scripts/properties.js" type="text/javascript"></script>
    <style>
        .samplecontent
        {
            padding: 4px;
        }
    </style>
</head>
<body>
    <div class="content-container-fluid">
        <div class="row">
            <div class="cols-sample-area">
                <div class="control" style="margin-left: -16px;">
                    <div id="OlapClient" style="min-height: 275px; min-width: 525px;" />
                    <script type="text/javascript">
                        $(function () {
                            $("#OlapClient").ejOlapClient({ url: "../wcf/OlapClientService.svc", title: "OLAP Browser", chartLoad: "setChartProperties" });
                        });
                        function setChartProperties(args) {
                            this.model.load = "loadTheme";
                            this.model.legend.rowCount = 2;
                            this.model.primaryXAxis = { title: { text: "Fiscal Year" }, labelRotation: 270 };
                            this.model.primaryYAxis = { title: { text: "Customer Count" } };
                        }
                    </script>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

 

Molto molto semplice.

Vediamo ora il Report Samples. Clicchiamo sul relativo pulsante e si apre Visual Studio.

Premiamo F5 ed ecco cosa ci sarà mostrato.

image

 

Clicchiamo su ReportViewer ed ecco un esempio di report.

image

 

Anche qua abbiamo tanti esempi con codici già pronti per l’uso, in base alle nostre esigenze.

image

A titolo di esempio vediamo una fattura:

image

E questo che segue è il codice:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%; width: 100%;">
<head>
    <title></title>
    <meta charset="utf-8" />
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <link href="../themes/bootstrap.min.css" rel="stylesheet" />
    <link href="../themes/default-theme/ej.widgets.all.min.css" rel="stylesheet" type="text/css" />
    <link href="../themes/default.css" rel="stylesheet" />
    <link href="../themes/default-responsive.css" rel="stylesheet" />
    <script src="../scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="../scripts/jquery.easing.1.3.min.js" type="text/javascript"></script>
    <script src="../scripts/jquery.globalize.min.js" type="text/javascript"></script>
    <script src="../scripts/jquery.globalize.cultures.min.js" type="text/javascript"></script>
    <script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
 
</head>
<body style="overflow: hidden; position: static; margin: 0; padding: 0; height: 100%; width: 100%;">

    <div id="container" style="position: absolute; height: 100%; width: 100%;"></div>
    <script type="text/javascript">
        $(function () {
            $("#container").ejReportViewer(
                {
                    reportServiceUrl: "/api/SSRSReport",
                    processingMode: ej.ReportViewer.ProcessingMode.Remote,
                    reportPath: "/Report Project1/InvoiceTemplate",
                    reportServerUrl: "http://76.74.153.81/ReportServer",
                    reportLoaded:"onReportLoaded"
                });
        });

        function onReportLoaded(senderobj) {
            var reportObj = $(‘#container’).data("ejReportViewer");
            var reportParam = [];
            reportParam.push({ name: ‘InvoiceID’, labels: [‘InvoiceID’], values: [10250], nullable: false });
            reportObj.model.parameters = reportParam;
        }
    </script>
</body>
</html>

 

Ovviamente poi voi dovrete cambiare il server o comunque il servizio WCF che metterà a disposizione i dati.

 

Passiamo ora ai controlli Silverlight.

Sono visualizzati in stile Windows 8, con le Live Tile.

image

 

image

 

image

 

image

 

Vediamone qualcuno:

Questo è un Ribbon:

image

 

e questo il relativo codice:

<syncfusion:RibbonWindow x:Class="RibbonCustomizationDemo.RibbonWindowDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  BorderThickness="3 0 3 3"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="800" Width="800" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Tools.Controls;assembly=Syncfusion.Ribbon.Silverlight"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" OnWindowStateChanged="RibbonWindow_OnWindowStateChanged"  
    mc:Ignorable="d"  VisualStyle="Office2010Blue">
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <syncfusion:Ribbon IsInRibbonWindow="True" Name="myRibbon" Title="Ribbon Window Demo" >
            <syncfusion:Ribbon.QuickAccessToolBar>
                <syncfusion:QuickAccessToolBar>
                    <syncfusion:QuickAccessToolBar.Items>
                        <syncfusion:RibbonButton Label="Save" SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Save16.png" />
                        <syncfusion:RibbonButton Label="Undo" IsEnabled="False" SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Undo16.png" />
                        <syncfusion:RibbonButton Label="Redo" SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Redo16.png"/>
                    </syncfusion:QuickAccessToolBar.Items>
                </syncfusion:QuickAccessToolBar>
            </syncfusion:Ribbon.QuickAccessToolBar>

            <syncfusion:Ribbon.ApplicationMenu>
                <syncfusion:ApplicationMenu ToolTipService.Placement="Bottom" ApplicationButtonImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/syncfusion.png">
                    <ToolTipService.ToolTip>
                        <syncfusion:ScreenTip Width="300" Content="Click here to open, save or print and to see everything else you can do with your document" IconSize="85,105"
                                                      Description="Office Button" ImageSource="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/AppMenuImage.png" HelpText="Press F1 for more help"/>
                    </ToolTipService.ToolTip>
                    <syncfusion:ApplicationMenu.ItemsPane>
                        <syncfusion:RibbonItemsControl>
                            <syncfusion:SimpleMenuButton Command="{Binding New}" Label="New" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/New32.png" />
                            <syncfusion:SimpleMenuButton Command="{Binding Open}" Label="Open" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Open32.png" />
                            <syncfusion:SimpleMenuButton Command="{Binding Save}" Label="Save" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Save32.png" />
                            <syncfusion:SplitMenuButton Header="Save As" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/SaveAs32.png">
                                <syncfusion:RibbonMenuGroup Header="Save as Different Types" IconBarEnabled="False">
                                    <syncfusion:SimpleMenuButton  Label="Save As" Description="Save a copy of the item." DescriptionWidth="250" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/SaveAs32.png"/>
                                </syncfusion:RibbonMenuGroup>
                            </syncfusion:SplitMenuButton>
                            <syncfusion:SimpleMenuButton Label="Properties" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Properties32.png" />
                            <syncfusion:SplitMenuButton Header="Print" IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Print32.png" >
                                <syncfusion:RibbonMenuGroup Header="Print Options" IconBarEnabled="False">
                                    <syncfusion:SimpleMenuButton Label="Print Preview" Description="as Print Preview"  Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Print32.png"/>
                                    <syncfusion:SimpleMenuButton Label="Print Page" Description="as Print Page"  Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Print32.png"/>
                                    <syncfusion:SimpleMenuButton Label="Print Properties" Description="as Properties"  Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Print32.png"/>
                                </syncfusion:RibbonMenuGroup>
                            </syncfusion:SplitMenuButton>
                            <syncfusion:SimpleMenuButton Label="Close" Command="{Binding Close}"  IconSize="30,30" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Close32.png" />
                        </syncfusion:RibbonItemsControl>
                    </syncfusion:ApplicationMenu.ItemsPane>
                    <syncfusion:ApplicationMenu.MenuItemsPane>
                        <syncfusion:RibbonItemsControl Margin="10">
                            <TextBlock Text="Create a New Item" Margin="5"/>
                            <syncfusion:RibbonSeparator Margin="3"/>
                            <TextBlock Text="1. RibbonSilverlightControl.docx" Margin="4"/>
                            <TextBlock Text="2. SyncfusionSupport.docx" Margin="4"/>
                            <TextBlock Text="3. Syncfusion_Controls.docx" Margin="4"/>
                            <TextBlock Text="4. RibbonWPF.docx" Margin="4"/>
                            <TextBlock Text="5. Profile.docx" Margin="4" Foreground="Gray"/>
                        </syncfusion:RibbonItemsControl>
                    </syncfusion:ApplicationMenu.MenuItemsPane>
                    <syncfusion:ApplicationMenu.SystemItemsPane>
                        <syncfusion:RibbonItemsControl>
                            <syncfusion:RibbonButton Label="Edit Options" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="3" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/options.png" BorderThickness="1" Background="#FFD2E3FA" BorderBrush="#FF5B81B3"/>
                        </syncfusion:RibbonItemsControl>
                    </syncfusion:ApplicationMenu.SystemItemsPane>
                </syncfusion:ApplicationMenu>
            </syncfusion:Ribbon.ApplicationMenu>

            <!– Ribbon BackStage –>
            <syncfusion:Ribbon.BackStage>
                <syncfusion:Backstage Name="RibbonBackStage" >
                    <syncfusion:BackStageCommandButton Header="Save" Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/Save.png"  IsEnabled="False" />
                    <syncfusion:BackStageCommandButton Header="Save As"   Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/saveas16.gif"/>

                    <syncfusion:BackstageTabItem Header="New">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="5*"/>
                            </Grid.ColumnDefinitions>
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/New1.png" Margin="0,8"  VerticalAlignment="Top" />
                            <Border BorderThickness="0.4" BorderBrush="#FFBCBCBC" Margin="0,15,0,15" Grid.Column="1" HorizontalAlignment="Left" />
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/New2.png" Margin="2,0,0,0" VerticalAlignment="Top"  Grid.Column="1"/>
                        </Grid>

                    </syncfusion:BackstageTabItem>

                    <syncfusion:BackstageTabItem Header="Info">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="5*"/>
                            </Grid.ColumnDefinitions>
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/info.png" Margin="0,8"  VerticalAlignment="Top" />
                            <Border BorderThickness="0.4" BorderBrush="#FFBCBCBC" Margin="0,15,0,15" Grid.Column="1" HorizontalAlignment="Left" />
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/info1.png" Margin="2,0,0,0" VerticalAlignment="Top"  Grid.Column="1"/>
                        </Grid>
                    </syncfusion:BackstageTabItem>

                    <syncfusion:BackstageTabItem Header="Print">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="5*"/>
                            </Grid.ColumnDefinitions>
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/print.png" Margin="0,8"  VerticalAlignment="Top" />
                        </Grid>
                    </syncfusion:BackstageTabItem>

                    <syncfusion:BackstageTabItem Header="Save and Send">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="5*"/>
                            </Grid.ColumnDefinitions>
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/save1.png" Margin="0,8"  VerticalAlignment="Top" />
                            <Border BorderThickness="0.4" BorderBrush="#FFBCBCBC" Margin="0,15,0,15" Grid.Column="1" HorizontalAlignment="Left" />
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/send.png" Margin="2,0,0,0" VerticalAlignment="Top"  Grid.Column="1"/>
                        </Grid>
                    </syncfusion:BackstageTabItem>

                    <syncfusion:BackstageTabItem Header="Help">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="5*"/>
                            </Grid.ColumnDefinitions>
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/help.png" Margin="0,8"  VerticalAlignment="Top" />
                            <Border BorderThickness="0.4" BorderBrush="#FFBCBCBC" Margin="0,15,0,15" Grid.Column="1" HorizontalAlignment="Left" />
                            <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/help1.png" Margin="2,0,0,0" VerticalAlignment="Top"  Grid.Column="1"/>
                        </Grid>
                    </syncfusion:BackstageTabItem>

                    <syncfusion:BackStageCommandButton Header="Options"  Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/Options16.png" />
                    <syncfusion:BackStageCommandButton Header="Exit"  Icon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BackStageImages/Exit.png" />
                </syncfusion:Backstage>
            </syncfusion:Ribbon.BackStage>

            <syncfusion:RibbonTab Caption="Insert">

                <syncfusion:RibbonBar Header="Pages" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/CoverPage32.png">
                    <syncfusion:RibbonDropDownButton IsAutoSizeFormEnabled="True" Label="Cover page" SizeMode="Large" IsMultiLine="True" 
                                                        LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/CoverPage32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/CoverPage16.png">
                        <syncfusion:RibbonMenuGroup >
                            <syncfusion:RibbonMenuItem Header="Alphapet"/>
                            <syncfusion:RibbonMenuItem Header="Annual"/>
                            <syncfusion:RibbonMenuItem Header="Contrast"/>
                            <syncfusion:RibbonMenuItem Header="Motion"/>
                            <syncfusion:RibbonMenuGroup.MoreItems>
                                <syncfusion:RibbonMenuItem Header="Remove current cover Page"/>
                                <syncfusion:RibbonMenuItem Header="Save Selection to Cover PAge Gallery"/>
                            </syncfusion:RibbonMenuGroup.MoreItems>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonDropDownButton>
                    <syncfusion:RibbonButton Command="{Binding BlankPage}" IsAutoSizeFormEnabled="True" SizeMode="Large" Label="Blank Page" IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BlankPage32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BlankPage16.png"/>
                    <syncfusion:RibbonButton Command="{Binding PageBreak}" IsAutoSizeFormEnabled="True" SizeMode="Large" Label="Page Break"  IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/PageBreak16.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/PageBreak32.png"/>
                </syncfusion:RibbonBar>

                <syncfusion:RibbonBar Header="Tables" IsLauncherButtonVisible="False" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Table32.png">
                    <syncfusion:RibbonBar.ItemsPanel>
                        <ItemsPanelTemplate>
                            <Grid />
                        </ItemsPanelTemplate>
                    </syncfusion:RibbonBar.ItemsPanel>
                    <syncfusion:RibbonDropDownButton HorizontalAlignment="Stretch" Label="Table" SizeMode="Large"
                                                        LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Table32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Table16.png">
                        <syncfusion:RibbonMenuGroup >
                            <syncfusion:RibbonMenuItem Header="Insert Table"/>
                            <syncfusion:RibbonMenuItem Header="Draw Table"/>
                            <syncfusion:RibbonMenuItem Header="Quick Tables"/>
                            <syncfusion:RibbonMenuItem Header="Excel spreedsheet"/>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonDropDownButton>
                </syncfusion:RibbonBar>

                <syncfusion:RibbonBar Header="Illustration" IsLauncherButtonVisible="False" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Picture32.png">
                    <syncfusion:RibbonButton Command="{Binding ShowPicture}" SizeMode="Large" Label="Picture" IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Picture32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Picture16.png"/>
                    <syncfusion:RibbonButton SizeMode="Large" Label="Clip Art"  IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/ClipArt32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/ClipArt16.png"/>
                    <syncfusion:RibbonDropDownButton HorizontalAlignment="Stretch" Label="Shapes" SizeMode="Large"
                                                        LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Shapes32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Shapes16.png">
                        <syncfusion:RibbonMenuGroup >
                            <syncfusion:RibbonMenuItem Header="Rectangles"/>
                            <syncfusion:RibbonMenuItem Header="Lines"/>
                            <syncfusion:RibbonMenuItem Header="Flow Chart"/>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonDropDownButton>
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" SizeMode="Large" Label="Smart Art" IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/SmartArt32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/SmartArt16.png"/>
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" SizeMode="Large" Label="Chart"  IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Chart32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Chart16.png"/>
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" SizeMode="Large" Label="Screenshot"  IsMultiLine="True"
                                                LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Screenshot.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Screenshot.png"/>
                </syncfusion:RibbonBar>

                <syncfusion:RibbonBar Header="Links" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Hyperlink32.png">
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" Label="Hyperlink" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Hyperlink32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Hyperlink16.png" SizeMode="Large"/>
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" Label="Bookmark" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Bookmark32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/BlankPage16.png" SizeMode="Large"/>
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" Label="Cross-reference" IsMultiLine="True" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/CrossReference32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/CrossReference16.png" SizeMode="Large"/>
                </syncfusion:RibbonBar>

                <syncfusion:RibbonBar Header="Header and Footer" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Header32.png">
                    <syncfusion:RibbonDropDownButton IsAutoSizeFormEnabled="True" Label="Header" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Header32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Header16.png" SizeMode="Large" IsMultiLine="True">
                        <syncfusion:RibbonMenuGroup IconBarEnabled="True" IsResizable="True" >
                            <syncfusion:RibbonMenuItem Header="Edit Header"/>
                            <syncfusion:RibbonMenuItem Header="Remove Header"/>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonDropDownButton>
                    <syncfusion:RibbonButton IsAutoSizeFormEnabled="True" Label="Footer" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Footer32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Footer16.png" SizeMode="Large" >
                        <syncfusion:RibbonMenuGroup IconBarEnabled="True" IsResizable="True" >
                            <syncfusion:RibbonMenuItem Header="Edit Footer"/>
                            <syncfusion:RibbonMenuItem Header="Remove Footer"/>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonButton>
                    <syncfusion:RibbonButton IsMultiLine="True" IsAutoSizeFormEnabled="True" Label="Page Number" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/PageNumber32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/PageNumber16.png" SizeMode="Large" >
                        <syncfusion:RibbonMenuGroup IconBarEnabled="True" IsResizable="True" >
                            <syncfusion:RibbonMenuItem Header="Format Page Numbers"/>
                            <syncfusion:RibbonMenuItem Header="Remove Page Numbers"/>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonButton>
                </syncfusion:RibbonBar>

                <syncfusion:RibbonBar Header="Text" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/WordArt16.png">
                    <syncfusion:RibbonDropDownButton Label="TextBox" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/TextBox32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/TextBox32.png"  SizeMode="Large" IsMultiLine="True" />
                    <syncfusion:RibbonDropDownButton Label="Quick Parts" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/QuickParts32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/QuickParts16.png"  SizeMode="Large" IsMultiLine="True" >
                        <syncfusion:RibbonMenuGroup IconBarEnabled="True" IsResizable="True" >
                            <syncfusion:RibbonMenuItem Header="AutoText"/>
                            <syncfusion:RibbonMenuItem Header="Document Property">
                                <syncfusion:RibbonMenuItem Header="Abstract"/>
                                <syncfusion:RibbonMenuItem Header="Author"/>
                                <syncfusion:RibbonMenuItem Header="Category"/>
                                <syncfusion:RibbonMenuItem Header="Comments"/>
                                <syncfusion:RibbonMenuItem Header="Status"/>
                                <syncfusion:RibbonMenuItem Header="Subject"/>
                                <syncfusion:RibbonMenuItem Header="Text"/>
                            </syncfusion:RibbonMenuItem>
                            <syncfusion:RibbonMenuItem Header="Building Block Organizer"/>
                        </syncfusion:RibbonMenuGroup>
                    </syncfusion:RibbonDropDownButton>
                    <syncfusion:RibbonDropDownButton  Label="Word Art" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/WordArt32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/WordArt16.png"  SizeMode="Large" IsMultiLine="True" />
                    <syncfusion:RibbonDropDownButton  Label="Drop Cap" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/DropCap32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/DropCap16.png"  SizeMode="Large" IsMultiLine="True" />
                    <StackPanel >
                        <syncfusion:RibbonSplitButton Label="Signature Line" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/SignatureLine16.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/SignatureLine16.png" SizeMode="Normal" >
                            <syncfusion:RibbonMenuGroup >
                                <syncfusion:RibbonMenuItem Header="Microsoft Office Signature Line.."/>
                                <syncfusion:RibbonMenuItem Header="Add Signature Services.."/>
                            </syncfusion:RibbonMenuGroup>
                        </syncfusion:RibbonSplitButton>
                        <syncfusion:RibbonButton Label="Date and Time" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/DateTime16.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/DateTime16.png" SizeMode="Normal" />
                        <syncfusion:RibbonSplitButton Label="Object" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Object16.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Object16.png" SizeMode="Normal" >
                            <syncfusion:RibbonMenuGroup>
                                <syncfusion:RibbonMenuItem Header="Object"/>
                                <syncfusion:RibbonMenuItem Header="Text From File.."/>
                            </syncfusion:RibbonMenuGroup>
                        </syncfusion:RibbonSplitButton>
                    </StackPanel>
                </syncfusion:RibbonBar>
                <syncfusion:RibbonBar Header="Symbols" CollapseImage="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Symbol16.png">
                    <syncfusion:RibbonButton  Label="Equation" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Equation32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Equation16.png"  SizeMode="Large" IsMultiLine="True" />
                    <syncfusion:RibbonButton  Label="Symbol" LargeIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Symbol32.png" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/Symbol16.png"  SizeMode="Large" IsMultiLine="True" />
                </syncfusion:RibbonBar>
            </syncfusion:RibbonTab>
        </syncfusion:Ribbon>

        <ScrollViewer VerticalScrollBarVisibility="Visible" Grid.Row="1" VerticalAlignment="Stretch">
            <Grid>
                <RichTextBox Name="Editor" Padding="50" Background="White" VerticalAlignment="Stretch" Margin="100 20">

                    <Paragraph FontSize="26" FontFamily="Cambria" TextAlignment="Center" FontWeight="ExtraBold" >
                        Silverlight Ribbon
                    </Paragraph>
                    <Paragraph >

                    </Paragraph>
                    <Paragraph FontSize="16" FontFamily="Calibri">
                        Ribbon illustrates the implementation of Office2010 UI, which is a UI layout designed by Microsoft in its Office 2010 package. Configuring and designing the layout is very easy when using  XAML code. Enhanced tooltips help users use and understand the application very easily.
                    </Paragraph>
                    <Paragraph>
                        <LineBreak />
                        <InlineUIContainer>
                            <Line X1="1" Height="2" Fill="Black" Stretch="Fill" Stroke="Black" HorizontalAlignment="Stretch" />
                        </InlineUIContainer>
                    </Paragraph>
                    <Paragraph/>
                    <Paragraph FontSize="15">
                        <Run FontWeight="Bold" FontStyle="Italic" FontFamily="Cambria">
                            Ribbon Window
                        </Run>
                    </Paragraph>
                    <Paragraph/>
                    <Paragraph>
                        Ribbon Window will provide Office 2010 look and feel, when hosted in any application.The property IsInRibbonWindow should be set to true, when hosting the Ribbon control in Ribbon Window, so that the Ribbon control fit into the Ribbon Window as Office 2010 UI.
                    </Paragraph>
                    <Paragraph />
                    <Paragraph FontSize="15">
                        <Run FontWeight="Bold" FontStyle="Italic" FontFamily="Cambria">
                            Dynamic Resizing
                        </Run>
                    </Paragraph>
                    <Paragraph />
                    <Paragraph>
                        Dynamic Resizing support prevents the Ribbon items to hidden or clipped from the view while resizing the Ribbon. The Ribbon Items will resize themselves, so that it can be fit into the Ribbon. The property IsAutoSizeFormEnabled decides whether the item has to change its size or not.
                    </Paragraph>
                </RichTextBox>
                <syncfusion:RibbonShadow Margin="100 20"/>
            </Grid>
        </ScrollViewer>

        <syncfusion:RibbonStatusBar Grid.Row="2" Name="status" VerticalAlignment="Bottom">
            <syncfusion:RibbonStatusBar.StatusItemsPane>
                <ItemsControl >
                    <TextBlock Text="Page 1 of 1" x:Name="statusPageNo" Margin="20,3,0,0" Foreground="#FF092061"/>
                    <syncfusion:RibbonSeparator Margin="3,0" Orientation="Vertical"/>
                    <TextBlock Text="Words: 0" x:Name="WordsCount" Margin="5,3,0,0" Foreground="#FF092061"/>
                    <syncfusion:RibbonSeparator Margin="3,0" Orientation="Vertical"/>
                </ItemsControl>
            </syncfusion:RibbonStatusBar.StatusItemsPane>
            <syncfusion:RibbonStatusBar.ControlItemsPane>
                <ItemsControl>
                    <Border BorderBrush="Transparent" BorderThickness="1" CornerRadius="2" Background="Transparent">
                        <StackPanel Orientation="Horizontal">
                            <syncfusion:RibbonButton SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/printlayout.png"/>
                            <syncfusion:RibbonSeparator Orientation="Vertical"/>
                            <syncfusion:RibbonButton SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/fullscreen.png" />
                            <syncfusion:RibbonSeparator Orientation="Vertical"/>
                            <syncfusion:RibbonButton SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/weblayout.png" />
                            <syncfusion:RibbonSeparator Orientation="Vertical"/>
                            <syncfusion:RibbonButton SizeMode="Small" SmallIcon="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/draft.png" />
                        </StackPanel>
                    </Border>
                    <TextBlock Text="100%" Margin="5,5,2,0"  Foreground="#FF092061"/>
                    <Image Source="/ThemingSamples.Silverlight;component/Ribbon/RibbonCustomizationDemo/Images/statusrange.png" x:Name="statusImage" Margin="1"/>
                </ItemsControl>
            </syncfusion:RibbonStatusBar.ControlItemsPane>
        </syncfusion:RibbonStatusBar>
    </Grid>
</syncfusion:RibbonWindow>

 

 

Vediamo un controllo Mappe:

image

e questo è il codice:

<UserControl x:Class="BubbleVisualization.MainPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:local="clr-namespace:BubbleVisualization"
             xmlns:sbl="clr-namespace:Syncfusion.SampleBrowserLayout.Silverlight;assembly=Syncfusion.SampleBrowserLayout.Silverlight"
             xmlns:syncfusion="clr-namespace:Syncfusion.UI.Xaml.Maps;assembly=Syncfusion.SfMaps.Silverlight">

    <UserControl.Resources>
        <local:MapViewModel x:Key="model"/>
    </UserControl.Resources>

    <sbl:SampleBrowserLayout SampleHeader="Bubble Visualization Demo" x:Name="SBLayout" EnableSkinCombo="False" SampleName="Maps.Silverlight;component/BubbleVisualization">
        <sbl:SampleBrowserLayout.Content>
            <Grid DataContext="{Binding Source={StaticResource model}}" x:Name="LayoutRoot" Background="White">
                <syncfusion:SfMap Width="1200" Height="450">
                    <syncfusion:SfMap.Layers>
                        <syncfusion:ShapeFileLayer Background="White" EnableSelection="False" ItemsSource="{Binding Countries}" ShapeIDPath="NAME"  ShapeIDTableField="NAME" Uri="SilverlightSampleBrowser.ShapeFiles.world1.shp">
                            <syncfusion:ShapeFileLayer.BubbleMarkerSetting>
                                <syncfusion:BubbleMarkerSetting AutoFillColor="False" MaxSize="100" MinSize="50" StrokeThickness="0" ValuePath="Population">
                                    <syncfusion:BubbleMarkerSetting.ColorMappings>
                                        <syncfusion:RangeColorMapping Color="#7F20BCEE" To="1347350000" From="314623001"/>
                                        <syncfusion:RangeColorMapping Color="#7FA7CE38" To="314623001" From="143228301"/>
                                        <syncfusion:RangeColorMapping Color="#7FF1B21A" To="143228301" From="82724090"/>
                                        <syncfusion:RangeColorMapping Color="#7F1DA249" To="50586757" From="22789702"/>
                                        <syncfusion:RangeColorMapping Color="#7FEB737C" To="22789702" From="0"/>
                                        <syncfusion:RangeColorMapping Color="#7FED2D95" To="82724090" From="50586757"/>
                                    </syncfusion:BubbleMarkerSetting.ColorMappings>
                                </syncfusion:BubbleMarkerSetting>
                            </syncfusion:ShapeFileLayer.BubbleMarkerSetting>
                            <syncfusion:ShapeFileLayer.ItemsTemplate>
                                <DataTemplate>
                                    <Border Background="Transparent">
                                        <TextBlock FontFamily="Segoe UI" FontSize="12" Foreground="#FF333333" Text="{Binding Data.PopulationFormat}"/>
                                    </Border>
                                </DataTemplate>
                            </syncfusion:ShapeFileLayer.ItemsTemplate>
                            <syncfusion:ShapeFileLayer.ShapeSettings>
                                <syncfusion:ShapeSetting ShapeStroke="#C1C1C1" ShapeStrokeThickness="0.5" ShapeValuePath="Population" ShapeFill="#E5E5E5"/>
                            </syncfusion:ShapeFileLayer.ShapeSettings>
                        </syncfusion:ShapeFileLayer>
                    </syncfusion:SfMap.Layers>
                </syncfusion:SfMap>
            </Grid>
        </sbl:SampleBrowserLayout.Content>
    </sbl:SampleBrowserLayout>
</UserControl>

 

Come potete vedere, non esiste un controllo che non risponda alle vostre esigenze.

Nel prossimo articolo vedremo le due tecnologie per scrivere applicazioni in ambienti Desktop: Windows Form e WPF.

 

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

Ancora su ASP.NET in Syncfusion Essential Studio

Posted on 3 gennaio 2015. Filed under: Senza categoria |

Nuovo articolo della serie su questo straordinario prodotto che consiglio vivamente a ogni sviluppatore per tecnologie Microsoft.

Vediamo qua i controlli “classici” di ASP.NET e ASP.NET MVC che sono quelle due in basso a sinistra della Dashboard, come vediamo nella figura seguente.

image

 

Cliccando su “RUN LOCAL SAMPLES” avremo questa schermata:

image

Guardate quanti controlli potete usare nelle vostre applicazioni web. Una marea.

Guardiamo quelli di ASP.NET Classici:

image

Seppur sia diversa la schermata, la sostanza non cambia: centinaia e centinaia di controlli a vostra disposizione, pronti per essere usati.

Come integrare questi controlli sui propri progetti? Come abbiamo visto in un precedente articolo: clicchiamo su sample creator, impostiamo i vari parametri e clicchiamo poi su Create.

 

image

 

Vediamo brevemente una galleria fotografica di schermate

di questi controlli.

image

image

image

image

 

image

image

image

image

image

image

image

image

image

image

image

image

image

image

 

Nel prossimo articolo vedremo le altre tecnologie web, come Javascript e Silverlight.

 

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

Problemi con le Api StepCounter per Windows Phone 8.1

Posted on 2 gennaio 2015. Filed under: Senza categoria |

Oggi ho voluto studiare e fare delle prove sul Sensorcore SDK, sviluppato da Nokia.

Comprende diverse API:

1) Contapassi

2) Attività

3) Posti

4) Tracce

 

Ho studiato il contapassi. Ho scaricato l’esempio di codice dal sito Microsoft e rilanciato. Ovviamente non funziona. Una volta reimpostato il tutto per l’SDK, mi sono trovato di fronte a questo errore:

image

In pratica dopo ore e ore di tentativi e ricerche su Internet ho poi scoperto che la Versione 1.0 dell’SDK non soffre di questo problema (l’ho provato ed è così). Cosa è successo quindi? Il Sensorcore è stata sviluppato su Vs 2013 Update 2 mentre ora c’è fuori l’Update 4.

Sicuramente la versione 4 dell’update avrà qualche cosa che lo blocca. In Microsoft comunque lo sanno.

Alla fine ho ripreso la versione 1.0 dell’SDK e sono riuscito a far funzionare il tutto.

Di sicuro bisogna modificare il file Package.appxmanifest mettendo dopo “<Applications>” le seguenti righe:

<Extensions>

   <Extension Category="windows.activatableClass.inProcessServer">

      <InProcessServer>

        <Path>Lumia.Sense.Testing.dll</Path>

        <ActivatableClass ActivatableClassId="Lumia.Sense.Testing.StepCounterSimulator" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.Testing.SenseRecorder" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.Testing.ActivityMonitorSimulator" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.Testing.SenseRecording" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.Testing.TrackPointMonitorSimulator" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.Testing.PlaceMonitorSimulator" ThreadingModel="both" />

      </InProcessServer>

    </Extension>

    <Extension Category="windows.activatableClass.inProcessServer">

      <InProcessServer>

        <Path>Lumia.Sense.dll</Path>

        <ActivatableClass ActivatableClassId="Lumia.Sense.Place" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.StepCounter" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.SenseHelper" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.ActivityMonitor" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.SenseTrigger" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.ActivityMonitorReading" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.StepCount" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.PlaceMonitor" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.TrackPointMonitor" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.TrackPoint" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Sense.StepCounterReading" ThreadingModel="both" />

      </InProcessServer>

    </Extension>

    <Extension Category="windows.activatableClass.inProcessServer">

      <InProcessServer>

        <Path>Lumia.Internal.HMBClient.dll</Path>

        <ActivatableClass ActivatableClassId="Lumia.Internal.HMBClient.HMBMessage" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Internal.HMBClient.HMBServiceClient" ThreadingModel="both" />

        <ActivatableClass ActivatableClassId="Lumia.Internal.HMBClient.HMBMessageEventArgs" ThreadingModel="both" />

      </InProcessServer>

    </Extension>

  </Extensions>

 

Risolto quello poi arrivava un altro errore e così via per tutta la serata:

[System.TypeLoadException] = {System.TypeLoadException: Requested Windows Runtime type ‘Lumia.Sense.StepCounter’ is not registered. —> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
   — End of inner exc…

 

Errore    2    il manifesto fa riferimento al file ‘Lumia.Internal.HMBClient.dll’ che non fa parte del payload.    C:\Users\Piero Sbressa\Desktop\sensorcore\steps-1.1\steps-1.1\Steps\Package.appxmanifest    Steps

 

[System.TypeLoadException] = {System.TypeLoadException: Requested Windows Runtime type ‘Lumia.Sense.StepCounter’ is not registered. —> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
   — End of inner exc…

 

ExceptionObject = {System.TypeLoadException: Requested Windows Runtime type ‘Lumia.Sense.SenseHelper’ is not registered. —> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
   — End of inner exc…

 

Poi una volta risolto questo appariva che le API non riuscivano a connettersi. A quel punto mi sono fermato, in attesa di una versione più stabile e scaricando la versione 1.0 dell’SDK.

 

Riferimenti al problema sono qua:

https://social.msdn.microsoft.com/Forums/windowsapps/en-US/6ea4cbbc-8649-462e-9ea2-8cfbeac672e7/lumia-sensorcoresdk-in-combination-with-background-task-not-working?forum=wpdevelop

https://social.msdn.microsoft.com/Forums/en-US/a6425c4d-2ceb-4fcb-a06c-e5fe6d93f7a4/sensorcore-sdk-steps-example-app-not-working?forum=wpdevelop

 

Mentre questa è la pagina ufficiale delle API:

http://developer.nokia.com/resources/library/Lumia/sensorcore-sdk/samples.html

 

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

Contapassi sul Windows Phone 8.1

Posted on 2 gennaio 2015. Filed under: Senza categoria |

In questo articolo vediamo come creare da zero un’app che, sfruttando l’SDK del Sensorcore, visualizza i passi fatti nella giornata corrente.

Poichè lo StepCounter non supporta le Universal App, dovremo creare il progetto scegliendo come template una applicazione SilverLight 8.1 per Windows Phone.

Una volta creato e salvato il progetto, scarichiamo l’SDK da Nuget, come nella seguente figura:

image

 

Una volta installati i due progetti (basta il primo; il secondo sarà installato automaticamente) vedremo le due nuove Reference in Esplora Soluzioni.

 

image

 

Poiché questo articolo è puramente a scopo didattico, vediamo semplicemente come recuperare i dati dei passi totali, quelli di camminata e quelli di corsa effettuati nella giornata corrente (in tempo reale).

Prima cosa da fare è creare una classe (che chiamiamo MainModel.cs) che conterrà i metodi forniti dall’SDK.

Questo è il codice:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PhoneApp1
{
    public class MainModel : INotifyPropertyChanged
    {
        private double _width;
        private double _height;
        private List<uint> _steps = new List<uint>();
        private uint _max = 20000;
        int _resolutionInMinutes = 15;
        int _arrayMaxSize = 96;
        int _margin = 6;

        public void setParameters(double width, double height, List<uint> steps, int resolutionInMinutes)
        {
            _width = width;
            _height = height;
            _steps = steps;

            _resolutionInMinutes = resolutionInMinutes;  // Resolution of graph is 15 min. Can be 5,10,15,20…60
            _arrayMaxSize = 1440 / _resolutionInMinutes;

            NotifyPropertyChanged(null); //We refresh all properties here
        }

        public void ChangeMax()
        {
            if (_max == 20000)
                _max = 10000;
            else if (_max == 10000)
                _max = 5000;
            else
                _max = 20000;

            NotifyPropertyChanged(null); //We refresh all properties here
        }

 

        public string MAX { get { return _max.ToString(); } }
        public string HALF { get { return (_max / 2).ToString(); } }
        public string MARGIN { get { return (_margin).ToString(); } }

        private uint _walkingSteps = 0;
        /// <summary>
        /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
        /// </summary>
        /// <returns></returns>
        public uint WalkingSteps
        {
            get
            {
                return _walkingSteps;
            }
            set
            {

                if (value != _walkingSteps)
                {
                    _walkingSteps = value;
                    NotifyPropertyChanged("WalkingSteps");
                }
            }
        }

        private uint _runningSteps = 0;
        /// <summary>
        /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
        /// </summary>
        /// <returns></returns>
        public uint RunningSteps
        {
            get
            {
                return _runningSteps;
            }
            set
            {

                if (value != _runningSteps)
                {
                    _runningSteps = value;
                    NotifyPropertyChanged("RunningSteps");
                }
            }
        }
        private uint _stepsToday = 0;

        public uint StepsToday
        {
            get
            {
                return _stepsToday;
            }
            set
            {

                if (value != _stepsToday)
                {
                    _stepsToday = value;
                    NotifyPropertyChanged("StepsToday");
                }
            }
        }

        public string PathString
        {
            get
            {

                String path = "M 6," + ((uint)_height).ToString();
                for (int i = 1; i < _steps.Count; i++)
                {
                    uint stepcount = _max > _steps[i] ? _steps[i] : _max;

                    path += " L " + ((uint)(((double)i / _arrayMaxSize) * (_width – 6)) + 6).ToString() + "," + (_height – (uint)(stepcount * (_height / _max))).ToString() + " ";
                }
                System.Diagnostics.Debug.WriteLine(path);
                return path;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

    }
}

 

Questo è lo XAML: semplicemente sulle tre TextBlock sulla colonna di destra andremo a scrivere i dati rilevati dal sensore, il tutto in databinding.

 

<

phone:PhoneApplicationPage x:Class="PhoneApp1.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml&quot; xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008&quot; xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006&quot; mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" xmlns:local="clr-namespace:PhoneApp1" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"> <!–LayoutRoot è la griglia radice in cui viene inserito tutto il contenuto della pagina–> <Grid x:Name="LayoutRoot" d:DataContext="{d:DesignInstance Type=local:MainModel, IsDesignTimeCreatable=True}" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!–TitlePanel contiene il nome dell’applicazione e il titolo della pagina–> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock Text="Sensorecore SDK" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/> <TextBlock Text="Contapassi" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel>

<!–ContentPanel – inserire ulteriore contenuto qui–> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <TextBlock VerticalAlignment="Center" Grid.Row="0" FontSize="{StaticResource PhoneFontSizeMediumLarge}">Passi totali di oggi:</TextBlock> <TextBlock VerticalAlignment="Center" Grid.Row="1" FontSize="{StaticResource PhoneFontSizeMediumLarge}">Passi di camminata:</TextBlock> <TextBlock VerticalAlignment="Center" Grid.Row="2" FontSize="{StaticResource PhoneFontSizeMediumLarge}">Passi in corsa:</TextBlock> <TextBlock Name="PassiTotaliOggi" Grid.Row="0" Grid.Column="1" Text="{Binding StepsToday}" FontSize="{StaticResource PhoneFontSizeMediumLarge}"/> <TextBlock Name="PaasiCamminataOggi" Grid.Row="1" Grid.Column="1" Text="{Binding WalkingSteps}" FontSize="{StaticResource PhoneFontSizeMediumLarge}"/> <TextBlock Name="PassiCorsaOggi" Grid.Row="2" Grid.Column="1" Text="{Binding RunningSteps}" FontSize="{StaticResource PhoneFontSizeMediumLarge}"/> </Grid> </Grid>

</

phone:PhoneApplicationPage>

 

Questo il codebehind:

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Lumia.Sense;
using Lumia.Sense.Testing;
using System.Threading.Tasks;
using System.Windows.Threading;

namespace PhoneApp1
{
    public partial class MainPage : PhoneApplicationPage
    {

        private MainModel _mainModel;
        private IStepCounter _stepCounter;

        private uint _firstWalkingSteps = 0;
        private uint _firstRunningSteps = 0;

        private DispatcherTimer _pollTimer;

        const int _resolutionInMinutes = 15;  // Resolution of graph is 15 min. Can be 5,10,15,20…60
        const int _ArrayMaxSize = 1440 / _resolutionInMinutes;

        private bool _usingSimulator = false;

        // Costruttore
        public MainPage()
        {
            InitializeComponent();

            _mainModel = new MainModel();
            LayoutRoot.DataContext = _mainModel;

        }

        private async Task UpdateStepsAsync()
        {
            if (_stepCounter != null)
            {
                StepCounterReading reading = null;

                bool res = await CallSensorCoreApiAsync(async () => { reading = await _stepCounter.GetCurrentReadingAsync(); });

                if (reading != null && res)
                {
                    _mainModel.StepsToday = reading.WalkingStepCount + reading.RunningStepCount – _firstRunningSteps – _firstWalkingSteps;
                    _mainModel.WalkingSteps = reading.WalkingStepCount – _firstWalkingSteps;
                    _mainModel.RunningSteps = reading.RunningStepCount – _firstRunningSteps;
                }
            }

        }

        private async Task<bool> CallSensorCoreApiAsync(Func<Task> action)
        {
            Exception failure = null;

            try
            {
                await action();
            }
            catch (Exception e)
            {
                failure = e;
            }

            if (failure != null)
            {

                switch (SenseHelper.GetSenseError(failure.HResult))
                {
                    case SenseError.LocationDisabled:
                        MessageBoxResult res = MessageBox.Show(
                            "Location has been disabled. Do you want to open Location settings now?",
                            "Information",
                            MessageBoxButton.OKCancel
                            );
                        if (res == MessageBoxResult.OK)
                        {
                            await SenseHelper.LaunchLocationSettingsAsync();
                        }

                        return false;

                    case SenseError.SenseDisabled:

                        MessageBoxResult res2 = MessageBox.Show(
                            "Motion data has been disabled. Do you want to open Motion data settings now?",
                            "Information",
                            MessageBoxButton.OKCancel
                            );

                        if (res2 == MessageBoxResult.OK)
                        {
                            await SenseHelper.LaunchSenseSettingsAsync();
                        }

                        return false;

                    default:
                        MessageBoxResult res3 = MessageBox.Show(
                              "Error:" + SenseHelper.GetSenseError(failure.HResult),
                              "Information",
                              MessageBoxButton.OK);

                        return false;
                }
            }
            else
            {
                return true;
            }
        }

 

        private async Task InitializeAsync(bool useSimulator = false)
        {
            if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Emulator || useSimulator)
            {
                await InitializeSimulatorAsync();
                _usingSimulator = true;
            }
            else
            {
                await InitializeSensorAsync();
                _usingSimulator = false;
            }
        }

        private async Task InitializeSimulatorAsync()
        {
            var obj = await SenseRecording.LoadFromFileAsync("Simulations\\short recording.txt");

            bool res = await CallSensorCoreApiAsync(async () => { _stepCounter = await StepCounterSimulator.GetDefaultAsync(obj, DateTime.Now – TimeSpan.FromHours(12)); });

            if (!res)
                Application.Current.Terminate();
        }

        private async Task InitializeSensorAsync()
        {

            if (!await StepCounter.IsSupportedAsync())
            {
                MessageBox.Show(
                    "Your device doesn’t support Motion Data. Application will be closed",
                    "Information", MessageBoxButton.OK);
                Application.Current.Terminate();
            }

            bool res = await CallSensorCoreApiAsync(async () => { _stepCounter = await StepCounter.GetDefaultAsync(); });

            if (!res)
                Application.Current.Terminate();

        }

        private async Task<bool> GetListAsync(List<uint> steps)
        {

            for (int i = 0; i < _ArrayMaxSize; i++)
                steps.Add(0);

            var results = await _stepCounter.GetStepCountHistoryAsync(DateTime.Now.Date, DateTime.Now – DateTime.Now.Date);

            bool first = true;

            int currentStep = 0;

            foreach (StepCounterReading reading in results)
            {
                if (first)
                {
                    first = false;
                    _firstWalkingSteps = reading.WalkingStepCount;
                    _firstRunningSteps = reading.RunningStepCount;

                }
                else if (reading.Timestamp.DateTime.Minute % _resolutionInMinutes == 0)
                {
                    currentStep = (reading.Timestamp.DateTime.Hour * 60 + reading.Timestamp.DateTime.Minute) / _resolutionInMinutes;
                    steps[currentStep] = reading.WalkingStepCount + reading.RunningStepCount – _firstWalkingSteps – _firstRunningSteps;
                }

            }

            //If there are gaps in the array we fill them e.g. 13,15,0,20 will be 13,15,15,20
            for (int i = 0; i < currentStep – 1; i++)
            {
                if (steps[i] > steps[i + 1])
                    steps[i + 1] = steps[i];
            }

            //Removes empty items from the end of array
            if (currentStep < _ArrayMaxSize)
                steps.RemoveRange(currentStep + 1, _ArrayMaxSize – 1 – currentStep);

            return true;

        }

 

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (_stepCounter == null)
            {
                await InitializeAsync();
            }
            await _stepCounter.ActivateAsync();
            await UpdateModelAsync();
        }

        private async Task UpdateModelAsync()
        {
            List<uint> steps = new List<uint>();

            await GetListAsync(steps);

            await UpdateStepsAsync();

            _pollTimer = new DispatcherTimer();
            _pollTimer.Interval = TimeSpan.FromSeconds(5);
            _pollTimer.Tick += _pollTimer_Tick;

            _pollTimer.Start();

        }

        async void _pollTimer_Tick(object sender, EventArgs e)
        {
            await UpdateStepsAsync();
        }

 

        private void StepGraph_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            _mainModel.ChangeMax();
        }

    }
}

 

Lanciamo l’applicazione e questa è la schermata:

wp_ss_20150102_0002

 

Facciamo giusto un paio di passi, per vedere se funziona.

 

wp_ss_20150102_0003

 

 

Come potete vedere è molto semplice recuperare questi valori. Ricordatevi di creare l’app per SilverLight 8.1 e non Universal App.

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

I controlli in Syncfusion Essential Studio

Posted on 2 gennaio 2015. Filed under: Senza categoria |

Nuovo articolo della serie su Syncfusion Essential Studio. Qua vedremo i vari tipi di controllo disponibili sulla sinistra.

Quelli che abbiamo visto nei precedenti articoli, riguardano solo la sezione “Showcase” ma abbiamo altre diverse categorie.

Detto in poche parole “Non manca nulla”. Quello che serve allo sviluppatore c’è.

Vedremo poi anche come integrare il tutto in Visual Studio.

Su ASP.NET Abbiamo le categorie:

Chart

Grid

Gantt

TreeGrid

Schedule

Diagram

Maps

TreeMap

Radial Gauge

Linear Gauge

Digital Gauge

Bullet Graph

Range Navigator

RadialMenu

Report Viewer

OlapClient

OlapGrid

OlapChart

OlapGauge

XlsO

Pdf

DocIO

Predictive Analytics

RichTextEditor

TreeView

ColorPicker

DatePicker

TimePicker

DateTimePicker

TextBoxes,

Autocomplete

Rotator,

Tab,Menu

Barcode

Accordion

ProgressBar

Rating

Dropdownlist

ListBox

Slider

Splitter

TagCloud

Button

Toolbar

WaitingPopup

Dialog

Upload

Scroller

Captcha

ListView

NavigationDrawer

Tile View

 

Non sto a piegarvi cosa significano, si dà per scontato che un programmatore conosca i controlli.

Vediamo solo a scopo dimostrativo alcuni di questi e il relativo codice.

 

image

@{ ViewBag.Title = "Default Functionalities"; } <h2>Default Functionalities</h2> @section SampleHeading{ <span class="sampleName">Diagram / Default Functionalities</span>} @section ControlsSection{ <div> @Html.EJ().Diagram("Diagram1", ViewData["diagramModel"] as Syncfusion.JavaScript.DataVisualization.Models.DiagramProperties) </div> }

 

 

image

@section SampleHeading{ <span class="sampleName">Tile View / Default Functionalities</span>} @section ControlsSection{ <div class="group"> <div class="column"> @Html.EJ().Tile("tile1").ImagePosition(TileImagePosition.Fill).TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/people_1.png").Text("People") <div class="small-col-2"> @Html.EJ().Tile("tile2").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Small).ImageUrl("../Images/tile/windows/alerts.png") @Html.EJ().Tile("tile3").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Small).ImageUrl("../Images/tile/windows/bing.png") @Html.EJ().Tile("tile4").TileSize(TileSize.Small).ImageUrl("../Images/tile/windows/camera.png") @Html.EJ().Tile("tile5").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Small).ImageUrl("../Images/tile/windows/messages.png") </div> @Html.EJ().Tile("tile6").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/games.png").Text("Play") @Html.EJ().Tile("tile7").TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/map.png").Text("Maps") @Html.EJ().Tile("tile8").ImagePosition(TileImagePosition.Fill).TileSize(TileSize.Wide).ImageUrl("../Images/tile/windows/sports.png").Text("Sports") </div> <div class="column"> @Html.EJ().Tile("tile9").ImagePosition(TileImagePosition.Fill).TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/people_2.png").Text("People") @Html.EJ().Tile("tile10").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/pictures.png").Text("Photo") @Html.EJ().Tile("tile11").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Wide).ImageUrl("../Images/tile/windows/weather.png").Text("Weather") @Html.EJ().Tile("tile12").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/music.png").Text("Music") @Html.EJ().Tile("tile13").ImagePosition(TileImagePosition.Center).TileSize(TileSize.Medium).ImageUrl("../Images/tile/windows/favs.png").Text("Favorites") </div> </div> } <style> #tile2 { background: rgb(208, 75, 43); } #tile3 { background: rgb(215, 147, 23); } #tile4 { background: rgb(43, 128, 234); } #tile5 { background: rgb(94, 58, 179); } #tile6 { background: rgb(145, 20, 154); } #tile7 { background: rgb(0, 157, 0); } #tile10 { background: rgb(238, 135, 40); } #tile11 { background: rgb(74, 168, 222); } #tile12 { background: rgb(208, 75, 43); } #tile13 { background: rgb(238, 199, 20); } </style>

 

#region Copyright Syncfusion Inc. 2001 – 2014 // Copyright Syncfusion Inc. 2001 – 2014. All rights reserved. // Use of this code is subject to the terms of our license. // A copy of the current license can be obtained at any time by e-mailing // licensing@syncfusion.com. Any infringement will be prosecuted under // applicable laws. #endregion using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MVCSampleBrowser.Controllers.TileView { public partial class TileViewController : Controller { // // GET: /DefaultFunctionalities/ public ActionResult DefaultFunctionalities() { return View(); } } }

 

 

 

 

image

 

@using Syncfusion.JavaScript @using Syncfusion.MVC.EJ @using Syncfusion.JavaScript.DataVisualization @using Syncfusion.JavaScript.DataVisualization.Models @section SampleHeading{ <span class="sampleName">Map / Data Markers</span> } @section ControlsSection{ @{ var datasource = ViewData["datasource"]; var mapData = ViewData["mapdata"]; } <div style="min-height:404px;"> @(Html.EJ().Map("container") .CenterPosition(new ShapePoint(38.5000,-98)) .NavigationControl(nc => { nc.EnableNavigation(true) .Orientation(Orientation.Vertical) .AbsolutePosition(new ShapePoint(5,10)) .DockPosition(DockPosition.None); }) .Background("white") .EnableAnimation(true) .Layers(lr => { lr.LayerType(LayerType.Geometry) .EnableSelection(false) .EnableAnimation(true) .EnableMouseHover(false) .Markers(datasource) .ShowMapItems(false) .MarkerTemplate("template") .ShapeSettings(sp => { sp.Fill("#626171") .StrokeThickness(1) .Stroke("#6F6F79") .AutoFill(false) .HighlightStroke("#6F6F79") .ValuePath("name") .HighlightColor("gray"); }) .ShapeData(mapData).Add(); }) ) </div> <div style="background-color: #FAFAF9;border-color: lightgray;border-width: 2px;opacity: 0.7;left: 300px;top: 185px;position: absolute;height: 60px" > <label style="color:Black;font-size:22px;margin:15px;margin-top:10px;margin-left:15px;margin-right:20px;height:25px;font-weight:Normal;">Syncfusion Locations</label> </div> <script id="template" type="application/jsrender"> <div > <div style="background-image:url(../Images/map/pin.png);margin-top:-38px;margin-left:-11px;height:40px;width:26px;background-repeat:no-repeat;"> </div> <div style="background-image:url(../Images/map/mappath.png);margin-left:5px;height:45px;width:120px;margin-top:-15px;"> </div> <div style="margin-left:10px;height:45px;width:120px;margin-top:-42px;"> <label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label> <p/> <div style="margin-top:-15px;"> <label class="label2" style="color:white;margin-left:15px;font-weight:normal">{{:Country}}</label> </div> </div> </div> </script> } @section ScriptSection{ <script> $(window).load(function () { $("#container").css("height", "404px"); $("#container").ejMap("refresh"); }); </script> } @section StyleSection { <style type="text/css"> .panButton{ border-radius: 5px; } .e-map{ position:static; } .panButton,.incrementButton{ -moz-user-select : none; -khtml-user-select : none; -webkit-user-select : none; -o-user-select : none; user-select : none; width:18px; height:18px; border:1px solid white; background-color:gray; } .panButton:hover,.incrementButton:hover { cursor:pointer; background-color:#676868; } </style> }

 

Vediamo adesso come usare uno di questi controlli.

Dalla schermata principale di SyncFusion Essential Studio, clicchiamo su Sample Creator:

image

 

 

Apparirà una schermata come questa:

image

Decidiamo la versione di MVC, la versione di Visual Studio e del .NET Framework, il linguaggio, il nome e il percorso del progetto di esempio.

Selezioniamo quindi i controlli che ci interessano, da includere nel progetto e clicchiamo su “Create”

Nel giro di pochi secondi, il progetto viene creato ed è pronto da essere aperto in Visual Studio.

 

image

 

Clicchiamo su “Yes” ed ecco il nostro esempio in Visual Studio.

image

 

Vedete che man mano usiamo Essential Studio e ci addentriamo sempre più nei suoi meandri, scopriamo caratteristiche e risorse che aiutano lo sviluppatore. Io consacro Syncfusion Essential Studio come il migliore dei prodotti di terze parti da affiancare a Visual Studio, per lo sviluppo di applicazioni di tecnologie Microsoft.

 

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

Altri esempi su Syncfusion Essential Studio ASP.NET MVC

Posted on 2 gennaio 2015. Filed under: Senza categoria |

Terzo articolo sulla Suite della Syncfusion, il meraviglioso strumento che aiuta lo sviluppatore a creare applicazioni efficienti in modo rapido.

Qua vediamo altri controlli su ASP.NET MVC.

image

 

 

 

image

 

Questa è la lista dei controlli disponibili:

Health Tracker

Project Tracker

Diagram Builder

Expense Analysis

Sales Analysis

Stock Analysis

Weather Analysis

Airline Reservation (visto nel precedente articolo)

SSRS ReportViewer

 

Vediamone alcune.

Health Tracker fornisce le informazioni sulle proprie attività fisiche (o dei clienti, nel caso fossimo degli sviluppatori che stanno creando un sito per una palestra o uno studio medico).

Quindi avremo la possibilità di inserire e visualizzare i contapassi, la massa corporea, le calorie bruciate, quelle immagazzinate tramite cibo, quali alimenti sono stati consumati e dei grafici.

image

 

image

 

 

Un altro esempio che vediamo è Sales Analysis.

image

image

 

 

image

Come potete vedere offre una serie di grafici per la valutazione delle vendite di una qualsiasi azienda x. Cliccando sulla Nazione i grafici saranno filtrati per sola quella nazione.

 

Ultimo esempio che vediamo è Weather Analysis.

Questo ci mostrerà una serie di informazioni relative allo stato attuale del meteo in una determinata città.

 

image

 

Seguono alcune schermate sugli altri controlli.

image

image

image

image

image

 

Come potete vedere le possibilità che vi offre Synfusion Essential Studio sono tante. E’ un tool che io consiglio vivamente sia che siate sviluppatori hobbistici o professionisti. Non deve mai mancare dalla vostra cassetta degli attrezzi.

Il prossimo articolo inizierà il giro su un’altra tecnologia.

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

Costruiamo una Windows Phone 8.1 App per la gestione del TI Sensortag

Posted on 1 gennaio 2015. Filed under: Senza categoria |

In questo articolo riprendiamo il discorso del Sensortag della Texas Instruments.

Costruiremo una App per Windows Phone 8.1 che si connetterà al sensore e leggeremo le informazioni come pressione, temperatura e umidità.

Vedremo quali sono le classi che avremo a disposizione e le proprietà che ci danno questi valori.

Il tutto lo faremo in Visual Studio 2013.

 

Apriamo VS 2013 e creiamo una nuova Windows Phone App. Il linguaggio che useremo è C#. Scegliamo la versione 8.1 dell’SDK.

L’app la chiamiamo TISensorTag.

Come abbiamo visto nei precedenti articoli, la connessione col sensore avverrà tramite Bluetooth. Per cui non ci sarà da aggiungere alcuna reference al progetto.

Creiamo una nuova pagina che conterrà la lista dei dispositivi Bluetooth LE trovati nelle vicinanze (la chiamiamo “DispositiviBluetooth”).

Questa pagina la possiamo mettere anche come pagina di avvio dell’app (in modo che faccia la connessione subito col dispositivo della Texas Instruments) e caricabile ogni volta che si vuole tramite il menù sulla pagina principale. Andiamo quindi a modificare la riga 95 circa di App.xaml.cs e scriviamo in questo modo:

 

if (!rootFrame.Navigate(typeof(DispositiviBluetooth), e.Arguments))

Faremo anche in modo che all’avvio, l’applicazione verifica se il Bluetooth sul telefono è spento: in questo caso, l’informazione sarà notificata all’utente.

 

Questo è l’XAML della pagina:

<Page
    x:Name="devpage"
    x:Class="SensorTagWPApp.DispositiviBluetooth"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SensorTagWPApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock  HorizontalAlignment="Center" Grid.Row="0" FontSize="16" Margin="3">Dispositivi Bluetooth LE nelle vicinanze:</TextBlock>
        <ListBox x:Name="deviceListBox" FontSize="24" Margin="3" Grid.Row="1" ItemsSource="{Binding bleDevices, ElementName=devpage}" SelectionChanged="deviceListBox_SelectionChanged" />
        <Button Grid.Row="2" HorizontalAlignment="Center" Width="150" Name="AggiornaButton" Content="Aggiorna lista" Click="AggiornaButton_Click"/>
        <Button Grid.Row="3" HorizontalAlignment="Center" Name="TrovaBluetoothButton" Click="TrovaBluetoothButton_Click" Content="Verifica se Bletooth è spento"></Button>
    </Grid>
</Page>

 

Mentre questo il codebehind:

using System;
using Windows.Networking.Proximity;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Popups;
using System.Collections.ObjectModel;
using Windows.Devices.Bluetooth;
using Windows.Devices.Enumeration;

// Il modello di elemento per la pagina vuota è documentato all’indirizzo http://go.microsoft.com/fwlink/?LinkID=390556

namespace SensorTagWPApp
{
    /// <summary>
    /// Pagina vuota che può essere utilizzata autonomamente oppure esplorata all’interno di un frame.
    /// </summary>
    public sealed partial class DispositiviBluetooth : Page
    {

        public ObservableCollection<BLEDevice> bleDevices { get; private set; }
        private BLEDevice selectedBLEDevice = null;

       
       
        public DispositiviBluetooth()
        {
            bleDevices = new ObservableCollection<BLEDevice>();
           
            this.InitializeComponent();
        }

        /// <summary>
        /// Richiamato quando la pagina sta per essere visualizzata in un Frame.
        /// </summary>
        /// <param name="e">Dati dell’evento in cui vengono descritte le modalità con cui la pagina è stata raggiunta.
        /// Questo parametro viene in genere utilizzato per configurare la pagina.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            TrovaBluetoothButton_Click(null, null);
            AggiornaButton_Click(null, null);
        }

        private async void AggiornaButton_Click(object sender, RoutedEventArgs e)
        {
            bleDevices.Clear();
            foreach (DeviceInformation di in await DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector()))
            {
                BluetoothLEDevice bleDevice = await BluetoothLEDevice.FromIdAsync(di.Id);
                bleDevices.Add(new BLEDevice(bleDevice));
            }

        }

        private void deviceListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (deviceListBox.SelectedItem != null)
            {
                selectedBLEDevice = deviceListBox.SelectedItem as BLEDevice;

                if (selectedBLEDevice != null)
                    Frame.Navigate(typeof(MainPage), selectedBLEDevice);
            }
        }

 

        private async void TrovaBluetoothButton_Click(object sender, RoutedEventArgs e)
        {
            PeerFinder.Start();
            try
            {

                 var peers = await PeerFinder.FindAllPeersAsync();
                 foreach (PeerInformation peerInformation in peers)
                 {
                     //    MessageDialog ooo = new MessageDialog("Il Bluetooth è acceso :-)");
                 //    ooo.ShowAsync();
                 }
                 //MessageDialog ooo = new MessageDialog("Il Bluetooth è acceso :-)");
                 //ooo.ShowAsync();
            }
            catch (Exception exc)
            {
                if ((uint)exc.HResult == 0x8007048F)
                {
                    MessageDialog ooo = new MessageDialog("Il Bluetooth è spento :-(");
                    ooo.ShowAsync();
                }
            }
        }

 

    }

 

    public class BLEDevice
    {
        private BluetoothLEDevice device;
        private string addressString;

        public BLEDevice(BluetoothLEDevice bled)
        {
            this.device = bled;
            addressString = device.BluetoothAddress.ToString("x012");
        }

        public string Name { get { return device.Name; } }

        public BluetoothLEDevice Core { get { return device; } }

        public override string ToString()
        {
            return device.Name;
        }
    }

}

 

Nel Codebehind abbiamo impostato una CollectionViewSource che andrà valorizzata in un ciclo for each di ogni dispositivo trovato.

La ricerca vera e propria viene effettuata dal DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector() che in modo asincrono enumera tutti i dispositivi Bluetooth a basso consumo energetico trovati.

Abbiamo messo un pulsante di aggiornamento per forzare la ricerca (la ricerca sarà comunque fatta al caricamento della pagina).

Abbiamo anche messo un pulsante per la verifica se il Bluetooth è acceso o spento.

Infine nell’evento SelectionChanged si valorizzerà la variabile selectedBLEDevice con il nome del Sensore trovato (nel mio caso è l’unico che ho, chi ha più sensori Bluetooth nelle vicinanze avrà una lista più lunga.

Questa è la schermata che vedrete all’avvio dell’applicazione, se le cose fatte fin qua sono state eseguite correttamente.

wp_ss_20150101_0005

Chiaro che graficamente possiamo migliorarla, ma esula da questo articolo.

Proviamo ora a spegnere il Bluetooth e fare tap sul pulsante “Verifica se Bluetooth è spento”. Se le operazioni sono state fatte correttamente vedremo una schermata come questa:

wp_ss_20150101_0002

Vediamo ora la schermata principale.

La schermata principale conterrà semplicemente un pulsante per la connessione al dispositivo e le sezioni con i valori.

Questo è lo XAML:

<Page
    x:Name="page"
    x:Class="TISensorTag.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TISensorTag"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <ScrollViewer>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0">
                <Rectangle Fill="White" Height="2" Margin="0,2" />
                <TextBlock Foreground="Yellow" FontSize="20" FontWeight="Bold" Margin="10">Termometro:</TextBlock>
                <TextBlock x:Name="thermometer" Margin="20,0,0,0" Text="…" Style="{StaticResource BodyTextBlockStyle}"/>
                <Rectangle Fill="White" Height="2" Margin="0,2" />
            </StackPanel>

            <StackPanel Grid.Row="1">
                <TextBlock Foreground="Yellow" FontSize="20" FontWeight="Bold" Margin="10">Accelerometro:</TextBlock>
                <TextBlock x:Name="accelerometer" Margin="20,0,0,0" Text="…" Style="{StaticResource BodyTextBlockStyle}"/>
                <Rectangle Fill="White" Height="2" Margin="0,2" />
            </StackPanel>

            <StackPanel Grid.Row="2">
                <TextBlock Foreground="Yellow" FontSize="20" FontWeight="Bold" Margin="10">Umidità:</TextBlock>
                <TextBlock x:Name="humidity" Margin="20,0,0,0" Text="…" Style="{StaticResource BodyTextBlockStyle}"/>
                <Rectangle Fill="White" Height="2" Margin="0,2" />
            </StackPanel>

            <StackPanel Grid.Row="3">
                <TextBlock Foreground="Yellow" FontSize="20" FontWeight="Bold" Margin="10">Magnetometro:</TextBlock>
                <TextBlock x:Name="magnetometer" Margin="20,0,0,0" Text="…" Style="{StaticResource BodyTextBlockStyle}"/>
                <Rectangle Fill="White" Height="2" Margin="0,2" />
            </StackPanel>

            <StackPanel Grid.Row="4">
                <TextBlock Foreground="Yellow" FontSize="20" FontWeight="Bold" Margin="10">Barometro:</TextBlock>
                <TextBlock x:Name="barometer" Margin="20,0,0,0" Text="…" Style="{StaticResource BodyTextBlockStyle}"/>
                <Rectangle Fill="White" Height="2" Margin="0,2" />
            </StackPanel>

            <StackPanel Grid.Row="5">
                <TextBlock Foreground="Yellow" FontSize="20" FontWeight="Bold" Margin="10">Giroscopio:</TextBlock>
                <TextBlock x:Name="gyroscope" Margin="20,0,0,0" Text="…" Style="{StaticResource BodyTextBlockStyle}"/>
                <Rectangle Fill="White" Height="2" Margin="0,2" />
            </StackPanel>
            <Button HorizontalAlignment="Center" Name="btnConnect" Grid.Row="6" Content="Connetti" Click="btnConnect_Click"/>
        </Grid>
    </ScrollViewer>

</Page>

wp_ss_20150101_0006

Mentre questo il Codebehind:

using System;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Popups;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.GenericAttributeProfile;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.ApplicationModel.Core;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.System.Threading;

namespace TISensorTag
{
    public class AppSettings
    {
        ApplicationDataContainer localSettings;

        private int interval;

        public int timerInterval
        {
            get { return interval; }
            set
            {
                interval = value;
                localSettings.Values["timerInterval"] = interval;
            }
        }
    }

    public class TISensor
    {
        protected string DATA = "";
        protected string CONF = "";
        protected string PERIOD = "";
        protected string CALI = "";

        protected byte sensorActivationByte = 1;

        protected TextBlock DisplayPanel = null;
        public GattDeviceService Service { get; set; }

        public TISensor(GattDeviceService svc, TextBlock tb)
        {
            this.Service = svc;
            this.DisplayPanel = tb;
        }

        protected async Task<byte[]> ReadUncachedSensorData(GattCharacteristic ch)
        {
            GattReadResult readResult = await ch.ReadValueAsync(BluetoothCacheMode.Uncached);
            if (readResult.Status == GattCommunicationStatus.Unreachable)
            {
                MessageDialog dialog = new MessageDialog("Sensore non connesso");
                await dialog.ShowAsync();
            }

            var result = new byte[readResult.Value.Length];
            DataReader.FromBuffer(readResult.Value).ReadBytes(result);

            return result;
        }

        protected virtual void ExtractMeasurement(byte[] RawData)
        {
        }

        public virtual string GetDisplayValue()
        {
            return "…";
        }

        public virtual async void UpdateDisplayPanel(string dispVal)
        {
            try
            {
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                    () =>
                    {
                        try { this.DisplayPanel.Text = dispVal; }
                        catch (Exception ex) { }
                    });
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }

        public virtual async void Enable()
        {
            try
            {
                // Init
                var configChar = this.Service.GetCharacteristics(Guid.Parse(CONF)).First();
                byte[] sensorData = new byte[] { sensorActivationByte };

                GattCommunicationStatus status = await configChar.WriteValueAsync(sensorData.AsBuffer());

                if (status != GattCommunicationStatus.Success)
                {
                    MessageDialog dialog = new MessageDialog("Impossibile accedere al sensore.");
                    await dialog.ShowAsync();
                }

                // SetCalback
                GattCharacteristic dataChar = this.Service.GetCharacteristics(Guid.Parse(DATA)).First();
                if (dataChar.CharacteristicProperties == (GattCharacteristicProperties.Read | GattCharacteristicProperties.Notify))
                {
                    dataChar.ValueChanged += this.dataValueChanged;
                    status = await dataChar.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);

                    if (status != GattCommunicationStatus.Success)
                    {
                        MessageDialog dialog = new MessageDialog("Impossibile accedere al sensore.");
                        await dialog.ShowAsync();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }

        public virtual async void dataValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args)
        {
            try
            {
                var res = await this.ReadUncachedSensorData(sender);

                this.ExtractMeasurement(res);

                string dispVal = this.GetDisplayValue();

                this.UpdateDisplayPanel(dispVal);
            }
            catch (Exception ex)
            {

            }
        }
    }

    public class TISensorThermometer : TISensor
    {
        public double ambTemp = 0.0;
        public double objTemp = 0.0;

        public TISensorThermometer(GattDeviceService svc, TextBlock tb)
            : base(svc, tb)
        {
            DATA = "f000aa01-0451-4000-b000-000000000000";
            CONF = "f000aa02-0451-4000-b000-000000000000";

            sensorActivationByte = 1;
        }

        protected override void ExtractMeasurement(byte[] RawData)
        {
            // Extract ambiant temperature
            this.ambTemp = BitConverter.ToUInt16(RawData, 2) / 128.0;

            // Extract object temperature
            int twoByteValue = BitConverter.ToInt16(RawData, 0);
            double Vobj2 = twoByteValue * 0.00000015625;
            double Tdie = this.ambTemp + 273.15;
            double S0 = 5.593E-14;    // Calibration factor
            double a1 = 1.75E-3;
            double a2 = -1.678E-5;
            double b0 = -2.94E-5;
            double b1 = -5.7E-7;
            double b2 = 4.63E-9;
            double c2 = 13.4;
            double Tref = 298.15;
            double S = S0 * (1 + a1 * (Tdie – Tref) + a2 * System.Math.Pow((Tdie – Tref), 2));
            double Vos = b0 + b1 * (Tdie – Tref) + b2 * System.Math.Pow((Tdie – Tref), 2);
            double fObj = (Vobj2 – Vos) + c2 * System.Math.Pow((Vobj2 – Vos), 2);
            double tObj = System.Math.Pow(System.Math.Pow(Tdie, 4) + (fObj / S), .25);
            this.objTemp = tObj – 273.15;
        }

        public override string GetDisplayValue()
        {
            string sAmbTemp = string.Format("Ambiente: {0:N1} °C", this.ambTemp);
            string sObjTemp = string.Format("Oggetto: {0:N1} °C", this.objTemp);

            return sAmbTemp + "\n" + sObjTemp;
        }
    }

    public class TISensorAccelerometer : TISensor
    {
        public double x = 0.0;
        public double y = 0.0;
        public double z = 0.0;

        public TISensorAccelerometer(GattDeviceService svc, TextBlock tb)
            : base(svc, tb)
        {
            DATA = "f000aa11-0451-4000-b000-000000000000";
            CONF = "f000aa12-0451-4000-b000-000000000000";
            PERIOD = "f000aa13-0451-4000-b000-000000000000";

            sensorActivationByte = 1;
        }

        public override async void Enable()
        {
            try
            {
                // Init
                var periodChar = this.Service.GetCharacteristics(Guid.Parse(PERIOD)).First();
                byte[] sensorPeriod = new byte[] { 50 };  // unit is 10ms

                GattCommunicationStatus status = await periodChar.WriteValueAsync(sensorPeriod.AsBuffer());

                if (status != GattCommunicationStatus.Success)
                {
                    MessageDialog dialog = new MessageDialog("Impossibile accedere al sensore.");
                    await dialog.ShowAsync();
                }

                base.Enable();
            }
            catch (Exception ex)
            {

            }
        }

        protected override void ExtractMeasurement(byte[] RawData)
        {
            this.x = (double)(RawData[0] * 1.0) / 64.0;
            this.y = (double)(RawData[1] * 1.0) / 64.0;
            this.z = (double)(RawData[2] * 1.0) / 64.0;
        }

        public override string GetDisplayValue()
        {
            return string.Format("X: {0:N2} G\nY: {1:N2} G\nZ: {2:N2} G", this.x, this.y, this.z);
        }
    }

    public class TISensorHumidity : TISensor
    {
        public double relHum = 0.0;
        public double relTemp = 0.0;

        public TISensorHumidity(GattDeviceService svc, TextBlock tb)
            : base(svc, tb)
        {
            DATA = "f000aa21-0451-4000-b000-000000000000";
            CONF = "f000aa22-0451-4000-b000-000000000000";

            sensorActivationByte = 1;
        }

        protected override void ExtractMeasurement(byte[] RawData)
        {
            int rawH = BitConverter.ToUInt16(RawData, 2);
            rawH &= ~0x0003; // clear bits [1..0] (status bits)
            this.relHum = -6.0 + 125.0 / 65536 * (double)rawH;

            int rawT = BitConverter.ToUInt16(RawData, 0);
            this.relTemp = -46.85 + 175.72 / 65536 * (double)rawT;
        }

        public override string GetDisplayValue()
        {
            return string.Format("{0:N2} %rH\n{1:N2} °C", this.relHum, this.relTemp);
        }
    }

    public class TISensorMagnetometer : TISensor
    {
        public double x = 0.0;
        public double y = 0.0;
        public double z = 0.0;

        public TISensorMagnetometer(GattDeviceService svc, TextBlock tb)
            : base(svc, tb)
        {
            DATA = "f000aa31-0451-4000-b000-000000000000";
            CONF = "f000aa32-0451-4000-b000-000000000000";
            PERIOD = "f000aa33-0451-4000-b000-000000000000";

            sensorActivationByte = 1;
        }

        public override async void Enable()
        {
            // Init
            try
            {
                var periodChar = this.Service.GetCharacteristics(Guid.Parse(PERIOD)).First();
                byte[] sensorPeriod = new byte[] { 50 };  // unit is 10ms

                GattCommunicationStatus status = await periodChar.WriteValueAsync(sensorPeriod.AsBuffer());

                if (status != GattCommunicationStatus.Success)
                {
                    MessageDialog dialog = new MessageDialog("Impossibile accedere al sensore.");
                    await dialog.ShowAsync();
                }

                base.Enable();
            }
            catch (Exception ex)
            {
            }
        }

        protected override void ExtractMeasurement(byte[] RawData)
        {
            this.x = BitConverter.ToInt16(RawData, 0) * (2000f / 65536f);
            this.y = BitConverter.ToInt16(RawData, 2) * (2000f / 65536f);
            this.z = BitConverter.ToInt16(RawData, 4) * (2000f / 65536f);
        }

        public override string GetDisplayValue()
        {
            return string.Format("X: {0:N2} uT\nY: {1:N2} uT\nZ: {2:N2} uT", this.x, this.y, this.z);
        }
    }

    public class TISensorBarometer : TISensor
    {
        public double ambPres = 0.0;
        public double ambTemp = 0.0;

        // Calibration data
        UInt16 c1 = 0, c2 = 0, c3 = 0, c4 = 0;
        Int16 c5 = 0, c6 = 0, c7 = 0, c8 = 0;

        public TISensorBarometer(GattDeviceService svc, TextBlock tb)
            : base(svc, tb)
        {
            DATA = "f000aa41-0451-4000-b000-000000000000";
            CONF = "f000aa42-0451-4000-b000-000000000000";
            CALI = "f000aa43-0451-4000-b000-000000000000";
           
            sensorActivationByte = 1;
        }

        public override async void Enable()
        {
            try
            {
                // Init, read calibration values first
                var configChar = this.Service.GetCharacteristics(Guid.Parse(CONF)).First();
                byte[] sensorData = new byte[] { 2 };

                GattCommunicationStatus status = await configChar.WriteValueAsync(sensorData.AsBuffer());

                if (status != GattCommunicationStatus.Success)
                {
                    MessageDialog dialog = new MessageDialog("Impossibile accedere al sensore.");
                    await dialog.ShowAsync();
                }

                GattCharacteristic caliChar = this.Service.GetCharacteristics(Guid.Parse(CALI)).First();
                GattReadResult readResult = await caliChar.ReadValueAsync(BluetoothCacheMode.Uncached);
                if (readResult.Status == GattCommunicationStatus.Unreachable)
                {
                    MessageDialog dialog = new MessageDialog("Sensor non connesso");
                    await dialog.ShowAsync();
                }

                var result = new byte[readResult.Value.Length];
                DataReader.FromBuffer(readResult.Value).ReadBytes(result);

                // Calibration data
                c1 = BitConverter.ToUInt16(result, 0);
                c2 = BitConverter.ToUInt16(result, 2);
                c3 = BitConverter.ToUInt16(result, 4);
                c4 = BitConverter.ToUInt16(result, 6);
                c5 = BitConverter.ToInt16(result, 8);
                c6 = BitConverter.ToInt16(result, 10);
                c7 = BitConverter.ToInt16(result, 12);
                c8 = BitConverter.ToInt16(result, 14);

                base.Enable();
            }
            catch (Exception ex)
            {
            }
        }

        protected override void ExtractMeasurement(byte[] RawData)
        {
            Int16 Tr = BitConverter.ToInt16(RawData, 0);
            UInt16 Pr = BitConverter.ToUInt16(RawData, 2);

            Int64 s, o, pres, val;

            // Sensitivity
            s = (Int64)c3;
            val = (Int64)c4 * Tr;
            s += (val >> 17);
            val = (Int64)c5 * Tr * Tr;
            s += (val >> 34);

            // Offset
            o = (Int64)c6 << 14;
            val = (Int64)c7 * Tr;
            o += (val >> 3);
            val = (Int64)c8 * Tr * Tr;
            o += (val >> 19);

            // Pressure (Pa)
            pres = ((Int64)(s * Pr) + o) >> 14;
            this.ambPres = (double)pres / 100;

 

            val = ((Int64)(c1 * Tr) * 100);
            Int64 temp = (val >> 24);
            val = ((Int64)c2 * 100);
            temp += (val >> 10);
            this.ambTemp = ((double)temp) / 100;
        }

        public override string GetDisplayValue()
        {
            return string.Format("{0:N2} Hp\n{1:N2} °C", this.ambPres, this.ambTemp);
        }
    }

    public class TISensorGyroscope : TISensor
    {
        public double x = 0.0;
        public double y = 0.0;
        public double z = 0.0;

        public TISensorGyroscope(GattDeviceService svc, TextBlock tb)
            : base(svc, tb)
        {
            DATA = "f000aa51-0451-4000-b000-000000000000";
            CONF = "f000aa52-0451-4000-b000-000000000000";

            sensorActivationByte = 7;
        }

        protected override void ExtractMeasurement(byte[] RawData)
        {
            this.y = BitConverter.ToInt16(RawData, 0) * (500f / 65536f) * -1;
            this.x = BitConverter.ToInt16(RawData, 2) * (500f / 65536f);
            this.z = BitConverter.ToInt16(RawData, 4) * (500f / 65536f);
        }

        public override string GetDisplayValue()
        {
            return string.Format("X: {0:N2} °/S\nY: {1:N2} °/S\nZ: {2:N2} °/S", this.x, this.y, this.z);
        }
    }

    public sealed partial class MainPage : Page
    {
        private AppSettings appSettings = null;

        private static BLEDevice selectedBLEDevice = null;

        private static ThreadPoolTimer timerDataTransfer;
   
        private const string UUID_TEMP = "f000aa00-0451-4000-b000-000000000000";
        private const string UUID_ACCEL = "f000aa10-0451-4000-b000-000000000000";
        private const string UUID_HUMID = "f000aa20-0451-4000-b000-000000000000";
        private const string UUID_MAG = "f000aa30-0451-4000-b000-000000000000";
        private const string UUID_BAROM = "f000aa40-0451-4000-b000-000000000000";
        private const string UUID_GYRO = "f000aa50-0451-4000-b000-000000000000";

        TISensorThermometer sensorT = null;
        TISensorAccelerometer sensorA = null;
        TISensorHumidity sensorH = null;
        TISensorMagnetometer sensorM = null;
        TISensorBarometer sensorB = null;
        TISensorGyroscope sensorG = null;

        bool connected = false;

        public MainPage()
        {
            appSettings = new AppSettings();

            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null)
            {
                selectedBLEDevice = e.Parameter as BLEDevice;

                if (selectedBLEDevice != null)
                {
                    foreach (var service in selectedBLEDevice.Core.GattServices)
                    {
                        RegisterDeviceService(service);
                    }
                }
            }
        }

        void RegisterDeviceService(GattDeviceService gds)
        {
            switch (gds.Uuid.ToString())
            {
                case UUID_TEMP:
                    sensorT = new TISensorThermometer(gds, thermometer);
                    break;
                case UUID_ACCEL:
                    sensorA = new TISensorAccelerometer(gds, accelerometer);
                    break;
                case UUID_HUMID:
                    sensorH = new TISensorHumidity(gds, humidity);
                    break;
                case UUID_MAG:
                    sensorM = new TISensorMagnetometer(gds, magnetometer);
                    break;
                case UUID_BAROM:
                    sensorB = new TISensorBarometer(gds, barometer);
                    break;
                case UUID_GYRO:
                    sensorG = new TISensorGyroscope(gds, gyroscope);
                    break;
            }
        }

        private async void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            if (selectedBLEDevice == null)
            {
                MessageDialog dialog = new MessageDialog("Selezionare prima un dispositivo Bluetooth LE");
                await dialog.ShowAsync();
                return;
            }

            btnConnect.IsEnabled = false;
            try
            {
                    sensorT.Enable();
                    sensorA.Enable();
                    sensorH.Enable();
                    sensorM.Enable();
                    sensorB.Enable();
                    sensorG.Enable();

                    connected = true;
                }
            catch (Exception ex)
            {
            }

            btnConnect.IsEnabled = true;
        }

    }
}

Al di là del copia e incolla, come funziona il tutto?

Semplice. All’avvio della pagina viene fatto un controllo se era stato selezionato un dispositivo dalla schermata principale (cosa che dovrebbe avvenire nel 100% dei casi). Quando si preme il pulsante di connessione, viene effettuata la connessione al dispositivo (è come fare click su “collega”) e a quel punto vengono abilitati i sensori e a un intervallo di tempo regolare vengono prelevati i dati dal sensore e visualizzati nei rispettivi controlli.

Il cuore di tutto è questa void: RegisterDeviceService. In base al nome del servizio ricevuto come parametro viene richiamato il relativo sensore e quindi visualizzato il valore della proprietà corrispondente, ad esempio per la temperatura this.ambTemp (quella ambientale) e this.objTemp (quella dell’oggetto vicino al sensore).

Questo è il risultato finale:

wp_ss_20150101_0007

Il progetto completo lo trovate qua:

https://onedrive.live.com/redir?resid=558B9B11B8BD0D72!530281&authkey=!ADhEl-LPsZLh8hA&ithint=file%2crar

Articolo scritto da Piero Sbressa (www.crystalweb.it) e Carmelo La Monica, Microsoft Contributor (http://community.visual-basic.it/carmelolamonica/default.aspx)

Leggi l'articolo intero | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...