public void TestAddField( )
        {
            NewProfileControl profileCtrl = new NewProfileControl( );

            Assert.IsNotNull( profileCtrl.Fields );
            Assert.AreEqual( 0, profileCtrl.Fields.Length );

            profileCtrl.AddField( new MockFieldInfo( "Field1" ) );
            profileCtrl.AddField( new MockFieldInfo( "Field2" ) );

            Assert.AreEqual( 2, profileCtrl.Fields.Length );
            Assert.AreEqual( "Field1", profileCtrl.Fields[ 0 ].Name );
            Assert.AreEqual( "", profileCtrl.Fields[ 0 ].Value );
            Assert.AreEqual( "Field2", profileCtrl.Fields[ 1 ].Name );
            Assert.AreEqual( "", profileCtrl.Fields[ 1 ].Value );
        }
        public void TestUpdateData( )
        {
            NewProfileControl profileCtrl = new NewProfileControl( );

            profileCtrl.AddField( new MockFieldInfo( "Field1" ) );
            profileCtrl.AddField( new MockFieldInfo( "Field2" ) );

            FieldControl fc = profileCtrl.flowLayoutPanelFields.Controls[ "Field1" ] as FieldControl;
			fc.itemCtrl.Control.Text = "Value1";

            fc = profileCtrl.flowLayoutPanelFields.Controls[ "Field2" ] as FieldControl;
			fc.itemCtrl.Control.Text = "Value2";

            Assert.AreEqual( "", profileCtrl.Fields[ 0 ].Value );
            Assert.AreEqual( "", profileCtrl.Fields[ 1 ].Value );

            profileCtrl.UpdateData();

            Assert.AreEqual( 2, profileCtrl.Fields.Length );
            Assert.AreEqual( "Value1", profileCtrl.Fields[ 0 ].Value );
            Assert.AreEqual( "Value2", profileCtrl.Fields[ 1 ].Value );
        }
Example #3
0
        private void New_Profile_Click(object sender, RoutedEventArgs e)
        {
            NewProfileControl nc = new NewProfileControl();

            nc.ProfileChosen += nc_ProfileChosen;

            SettingsFlyout settings = new SettingsFlyout();

            // set the desired width.  If you leave this out, you will get Narrow (346px)
            settings.FlyoutWidth = Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth.Narrow;

            // optionally change header and content background colors away from defaults (recommended)
            // if using Callisto's AppManifestHelper you can grab the element from some member var you held it in
            settings.HeaderBrush            = new SolidColorBrush(App.VisualElements.BackgroundColor);
            settings.HeaderText             = "Profiles"; // string.Format("{0}", App.VisualElements.DisplayName);
            settings.ContentBackgroundBrush = ProfileDisplayControl.CanvasBackgroundBrush;
            // provide some logo (preferrably the smallogo the app uses)
            BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri);

            settings.SmallLogoImageSource = bmp;
            settings.Content = nc;
            // open it
            settings.IsOpen = true;
        }