示例#1
0
        public static string CreateHeaderText(Type entityType, bool isEditMode)
        {
            DialogModeEnum mode = DialogModeEnum.Create;

            if (isEditMode)
            {
                mode = DialogModeEnum.Edit;
            }

            return(CreateHeaderText(entityType, mode));
        }
        private void CreateOrViewListening(Listening listening, bool isViewMode)
        {
            var viewModel = container.Resolve <IListeningEditViewModel>();

            viewModel.IsViewMode = isViewMode;
            viewModel.Listening  = listening;

            DialogModeEnum mode = isViewMode ? DialogModeEnum.View : DialogModeEnum.Create;

            var dialog = new CommonDialog()
            {
                DialogContent = new ListeningEditView(viewModel),
                HeaderText    = HeaderTextHelper.CreateHeaderText(typeof(Listening), mode)
            };

            dialog.ShowDialog();
        }
示例#3
0
        public static string CreateHeaderText(Type entityType, DialogModeEnum mode)
        {
            string typeName = entityType.Name.ToLower();

            switch (mode)
            {
            case DialogModeEnum.Create:
                return(String.Format("Create new {0}", typeName));

            case DialogModeEnum.Edit:
                return(String.Format("Edit {0}", typeName));

            case DialogModeEnum.View:
                return(String.Format("View {0}", typeName));

            default:
                throw new NotImplementedException();
            }
        }