コード例 #1
0
 //private bool mRolesLoaded;
 public MyProfileControl()
 {
     InitializeComponent();
     Title = String.Format("Add New User");
     mMyProfileViewModel = new MyProfileViewModel(new User { ActiveUser = true });
     DataContext = mMyProfileViewModel;
 }
コード例 #2
0
        public MyProfileControl(MyProfileViewModel user)
        {
            InitializeComponent();

            if (user.Id != 0)
            {
                mMyProfileViewModel = user;
                DataContext = mMyProfileViewModel;
                Title = String.Format("{0} {1}'s profile", mMyProfileViewModel.FirstName, mMyProfileViewModel.LastName);
            }
            else
            {

                //had to do it this way beacuse i could overload the constructor passing in an int because we already do below...
                Title = String.Format("Add New User To Role");
                mMyProfileViewModel = new MyProfileViewModel(new User { ActiveUser = true, RoleId = user.Role.Id });
                DataContext = mMyProfileViewModel;
            }
        }
コード例 #3
0
        private void GetUser(int userId)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            EventHandler<GetUserByIdCompletedEventArgs> fetchCompleted = null;
            fetchCompleted =
                (s1, eventArgs) =>
                {
                    User user = eventArgs.Result;
                    mMyProfileViewModel = new MyProfileViewModel(user);
                    Title = String.Format("{0} {1}'s profile", mMyProfileViewModel.FirstName, mMyProfileViewModel.LastName);
                    DataContext = mMyProfileViewModel;
                };

            cmsWebServiceClient.GetUserByIdCompleted += fetchCompleted;
            cmsWebServiceClient.GetUserByIdAsync(userId);
        }