コード例 #1
0
        protected void AppendCommunicationItem(CommunicationItemViewModel item, bool isNew, bool isEditing)
        {
            if (item != null)
            {
                if (isNew)
                {
                    item.State        = CommunicationItemState.Appended;
                    item.IsEditing    = isEditing;
                    item.AuthorId     = _authorId;
                    item.AuthorName   = _authorName;
                    item.LastModified = DateTime.Now.ToUniversalTime();
                }

                DefItemCommands(item);
                item.RaiseCanExecuteChanged();

                Items.Add(item);


                if (isNew && ItemsCollection != null)
                {
                    RefreshItems();
                    ItemsCollection.MoveCurrentToFirst();
                }
                item.CommunicationItemPropertyChanged += CommunicationItem_OnPropertyChanged;

                OnPropertyChanged("OneItemInCommunicationIsInEditState");
                OnPropertyChanged("Items");
                OnPropertyChanged("IsShowEmpty");

                ModifiedRequest();
            }
        }
コード例 #2
0
 protected void AviableKnowledgeBase(CommunicationItemViewModel item, string typeKnowledgeBase)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon    = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/black_book.png",
         ToolTip = "Knowledge base".Localize(),
         Command = new DelegateCommand <object>(OpenKnowledgeBaseDialog, (x) => item.IsEditing)
     });
 }
コード例 #3
0
 protected void AviablePost(CommunicationItemViewModel item)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon       = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/save.png",
         ToolTip    = "Post".Localize(),
         Command    = new DelegateCommand <object>(x => ChangeItemState(x, CommunicationItemState.Modified, false)),
         SetVisible = () => item.IsEditing
     });
 }
コード例 #4
0
 protected void AviableDelete(CommunicationItemViewModel item)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon       = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/delete.png",
         ToolTip    = "Delete".Localize(),
         Command    = new DelegateCommand <object>(DeleteCommunicationItem),
         SetVisible = () => true
     });
 }
コード例 #5
0
 protected void AviableEdit(CommunicationItemViewModel item)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon    = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/edit.png",
         ToolTip = "Edit".Localize(),
         Command = new DelegateCommand <object>(x => ChangeItemState(x, CommunicationItemState.Modified, true)
                                                , x => x is CommunicationItemNoteViewModel && (DateTime.UtcNow - ((CommunicationItemViewModel)x).Created).Hours < 1),
         SetVisible = () => !item.IsEditing
     });
 }
コード例 #6
0
        public MockCommunicationItemBuilder(CommunicationItemViewModel communocationItem)
        {
            _mock = communocationItem;
            var index = rnd.Next(titles.Length);
            _mock.Title = titles[index];
            _mock.Body = bodyes[index];

            index = rnd.Next(users.Length);
            _mock.AuthorName = users[index];
            _mock.AuthorId = users[index];

            index = rnd.Next(dates.Length);
            _mock.Created = dates[index];
            _mock.LastModified = dates[index];
            
            for (int i = 0; i < 5; i++)
            {
                index = rnd.Next(attachments.Length * 2);
                if (index < attachments.Length)
                {
                    _mock.Attachments.Add(new CommunicationAttachment() { FileUrl = attachments[index], State = CommunicationItemState.NotModified, Url=index.ToString() });
                }
            }
        }
コード例 #7
0
		protected void AviableKnowledgeBase(CommunicationItemViewModel item, string typeKnowledgeBase)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/black_book.png",
				ToolTip = "Knowledge base",
				Command = new DelegateCommand<object>(OpenKnowledgeBaseDialog, (x) => item.IsEditing)
			});
		}
コード例 #8
0
		protected void AviablePost(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/save.png",
				ToolTip = "Post",
				Command = new DelegateCommand<object>(x => ChangeItemState(x, CommunicationItemState.Modified, false)),
				SetVisible = () => item.IsEditing
			});
		}
コード例 #9
0
		protected void AviableEdit(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/edit.png",
				ToolTip = "Edit",
				Command = new DelegateCommand<object>(x => ChangeItemState(x, CommunicationItemState.Modified, true)
					, x => x is CommunicationItemNoteViewModel && (DateTime.UtcNow - ((CommunicationItemViewModel)x).Created).Hours < 1),
				SetVisible = () => !item.IsEditing
			});
		}
コード例 #10
0
		protected void AviableDelete(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/delete.png",
				ToolTip = "Delete",
				Command = new DelegateCommand<object>(DeleteCommunicationItem),
				SetVisible = () => true
			});
		}
コード例 #11
0
		protected void AppendCommunicationItem(CommunicationItemViewModel item, bool isNew, bool isEditing)
		{
			if (item != null)
			{
				if (isNew)
				{
					item.State = CommunicationItemState.Appended;
					item.IsEditing = isEditing;
					item.AuthorId = _authorId;
					item.AuthorName = _authorName;
				    item.LastModified = DateTime.Now.ToUniversalTime();
				}

				DefItemCommands(item);
				item.RaiseCanExecuteChanged();

				Items.Add(item);


				if (isNew && ItemsCollection != null)
				{
					RefreshItems();
					ItemsCollection.MoveCurrentToFirst();
				}
				item.CommunicationItemPropertyChanged += CommunicationItem_OnPropertyChanged;

				OnPropertyChanged("OneItemInCommunicationIsInEditState");
				OnPropertyChanged("Items");
				OnPropertyChanged("IsShowEmpty");

				ModifiedRequest();
			}
		}
コード例 #12
0
 public MockCommunicationItemInboundCallBuilder(CommunicationItemViewModel communocationItem)
     : base(communocationItem)
 {
 }
		private bool RaiseNoteEditInteractionRequest(CommunicationItemViewModel itemVM, string title)
		{
			bool result = false;

			var confirmation = new ConditionalConfirmation(() => !string.IsNullOrEmpty(itemVM.Body));
			confirmation.Title = title;
			confirmation.Content = itemVM;

			CommonConfirmRequest.Raise(confirmation, (x) =>
			{
				result = x.Confirmed;
			});

			return result;
		}
コード例 #14
0
 /// <summary>
 /// Define available operations (commands) for given item
 /// </summary>
 /// <example>
 /// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
 /// </example>
 abstract protected void DefItemCommands(CommunicationItemViewModel item);
コード例 #15
0
		/// <summary>
		/// Define available operations (commands) for given item
		/// </summary>
		/// <example>
		/// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
		/// </example>
		abstract protected void DefItemCommands(CommunicationItemViewModel item);
コード例 #16
0
 public MockCommunicationItemNoteBuilder(CommunicationItemViewModel communocationItem)
     : base(communocationItem)
 {
 }
コード例 #17
0
		protected void AviableSelect(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/star_none.png",
				ToolTip = "Select".Localize(),
				Command = new DelegateCommand<object>(SelectCommunicationItem),
				SetVisible = () => true
			});
		}
コード例 #18
0
		/// <summary>
		/// Определяет доступные комманды для полученного в параметре Item
		/// </summary>
		/// <param name="item">CommunicationItem для которого надо определить доступные комманды</param>
		/// <example>
		/// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
		/// </example>
		protected override void DefItemCommands(CommunicationItemViewModel item)
		{
			AviableEdit(item);
			AviablePost(item);
			if (item.State == CommunicationItemState.Appended)
			{
				AviableDelete(item);
			}
			AviableKnowledgeBase(item, "testBase");
		}
		/// <summary>
		/// Define available operations for given communication item
		/// Can add predefine such as AviableSelect, AviableEdit, AviableDelete.
		/// Can add any command (see example)
		/// </summary>
		/// <param name="item">CommunicationItem для которого надо определить доступные комманды</param>
		/// <example>
		/// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
		/// </example>
		protected override void DefItemCommands(CommunicationItemViewModel item)
		{
			AviableSelect(item);
			AviableEdit(item);
			AviableDelete(item);
		}