Ejemplo n.º 1
0
        public void CreateNewItemBasedOn(ItemViewModel currentItem, NavigationService navigationService, bool includeCopyText = true, bool copyUniqueId = false)
        {
            var newItem = new ItemViewModel()
            {
                Title = (includeCopyText ? "From " : string.Empty) + currentItem.Title,
                Code = currentItem.Code,
                HasGPSPermission = currentItem.HasGPSPermission,
                HasWebPermission = currentItem.HasWebPermission,
                CategoryTag = currentItem.CategoryTag
            };
            if (copyUniqueId)
                newItem.UniqueId = currentItem.UniqueId;
            StoreItem(newItem);

            App.ViewModel.Items.Insert(0, newItem);

            // TODO - get navigation service out of here!
            if (navigationService != null)
            {
                navigationService.Navigate(new Uri("/Views/EditPage.xaml?ScriptIndex=" + newItem.UniqueId, UriKind.Relative));
            }
        }
Ejemplo n.º 2
0
 private void StoreItem(ItemViewModel item)
 {
     item.Store();
 }