private void PageListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string errorMsg = null;
            SelectedPage = PagesListBox.SelectedItem as ASGPage;
            if (SelectedPage == null || SelectedPage == sessionManager.CurrentPage)
            {
                errorMsg = "target page";
            }
            else
            {
                long pageId = SelectedPage.UniqueId;
                if (instance.GestureTargetPageMap.ContainsKey(gesture))
                {
                    instance.GestureTargetPageMap.Remove(gesture);
                }

                instance.GestureTargetPageMap.Add(gesture, pageId);
                const string behaviorLabelFormatBase = "Navigate, Page {0}";
                behaviorLabel.Content = String.Format(behaviorLabelFormatBase, sessionManager.CurrentProject.PageDictionary[instance.GestureTargetPageMap[gesture]].PageNumber);
                ((ScatterView)this.Parent).Items.Remove(this);
            }
        }
Esempio n. 2
0
        // Goes to each PrototypeElement and removes the links that are directed to the page to be removed
        // in GestureTargetPageMap
        private void RemoveAllLinksFromRemovedPage(ASGPage pageToRemove)
        {
            IEnumerable<PrototypeElement> elements = from pages in this.CurrentProject.PageDictionary.Values
                                                     from items in pages.PrototypeElementDictionary.Values
                                                     where items.GestureTargetPageMap.ContainsValue(pageToRemove.UniqueId)
                                                     select items;

            foreach (PrototypeElement element in elements.ToList())
            {
                List<string> itemsToRemove = new List<string>();
                foreach (var pair in element.GestureTargetPageMap)
                {
                    if (pair.Value.Equals(pageToRemove.UniqueId))
                        itemsToRemove.Add(pair.Key);
                }
                foreach (string item in itemsToRemove)
                {
                    element.GestureTargetPageMap.Remove(item);
                }
            }
        }
Esempio n. 3
0
 private void RefreshPageNumbers(ASGPage pagetoRemove)
 {
     foreach (ASGPage p in CurrentProject.PageDictionary.Values)
     {
         if (p.PageNumber > pagetoRemove.PageNumber)
             p.PageNumber--;
     }
 }
Esempio n. 4
0
        public bool RemovePage(ASGPage pagetoRemove)
        {
            if (CurrentProject.PageDictionary.Count() <= 1)
            {
                return false;
            }

            RemoveAllLinksFromRemovedPage(pagetoRemove);
            CurrentProject.PageDictionary.Remove(pagetoRemove.UniqueId);
            RefreshPageNumbers(pagetoRemove);

            return true;
        }
Esempio n. 5
0
 public void LoadPage(ASGPage pageToLoad)
 {
     CurrentPage = pageToLoad;
     NotifyPropertyChanged("CurrentPage");
 }
Esempio n. 6
0
        public void AddPrototypeElementToPage(ASGPage page, PrototypeElement element)
        {
            element.UniqueId = CurrentProject.GetNextUniqueId();

            page.PrototypeElementDictionary.Add(element.UniqueId, element);
            NotifyPropertyChanged("PrototypeElementDictionary.Values");
        }
Esempio n. 7
0
 public void AddNewPageToProject()
 {
     // TODO: Generate reasonable page numbers.
     long pageNumber = CurrentProject.GetNextPageNumber();
     CurrentPage = new ASGPage { Name = String.Format("Untitled {0}", pageNumber), PageNumber = pageNumber, UniqueId = CurrentProject.GetNextUniqueId() };
     CurrentProject.PageDictionary.Add(CurrentPage.UniqueId, CurrentPage);
     NotifyPropertyChanged("CurrentPage");
 }
 private void RenderPage(ASGPage pageToLoad)
 {
     loadPageBackground(pageToLoad);
     PageInkCanvas.Strokes.Clear();
     PageInkCanvas.Strokes.Add(StrokeHelper.ConvertToStrokeCollection(pageToLoad.Strokes));
     PageNumber.Text = ActiveSessionManager.CurrentPage.PageNumber + "/" + ActiveSessionManager.CurrentProject.PageDictionary.Count;
     setContainerItemsVisibility(pageToLoad, Visibility.Visible);
 }
 /*
  * DETECTS IF THE DESGINER IS TRYING TO DELETE AN AREA (CAN BE A GESTURE AREA OR SELECTED STROKES)
  * IF THE TOUCH IS WITHIN THE TRASH AREA, DELETES IF NOT, UPDATES THE EVENT SCREEN
  *
  */
 public void SetupAndRenderPage(ASGPage pageToLoad)
 {
     events.SetupEventsPanel();
     RenderPage(pageToLoad);
     canvasHelper.loadPenSettings();
 }
 public void setContainerItemsVisibility(ASGPage page, Visibility visibility)
 {
     IEnumerable<ScatterViewItem> list = from object item in Container.Items
                                         where (item is ScatterViewItem)
                                                  && ((item as ScatterViewItem).Tag is PrototypeElement)
                                                  && (page.PrototypeElementDictionary.Values.Contains((item as ScatterViewItem).Tag as PrototypeElement))
                                         select item as ScatterViewItem;
     List<ScatterViewItem> ItemsList = list.ToList();
     foreach (ScatterViewItem svi in ItemsList)
     {
         svi.Visibility = visibility;
     }
 }
 public void loadPageBackground(ASGPage pageToLoad)
 {
     try
     {
         BackgroundImage.Source = new BitmapImage(new Uri(pageToLoad.BackgroundImageSource));
         PageInkCanvas.Background = new SolidColorBrush(Colors.Transparent);
     }
     catch(Exception ex)
     {
         PageInkCanvas.Background = new SolidColorBrush(Colors.White);
     }
 }
        /*
           * ADDS AN ELEMENT TO CANVAS (GESTURE AREA)
           * ADDS IT TO CONTAINER AND ACTIVESESSIONMANAGER
           * AND BINDS IT TO A PROTOTYPE ELEMENT
           */
        public void addThisElementToCanvas(ASGPage page, PrototypeElement _element,
            double _orientation, System.Windows.Visibility _visibility = System.Windows.Visibility.Visible)
        {
            ScatterViewItem svi = new ScatterViewItem();
            PrototypeElement element;

            Container.Items.Add(svi);

            svi.Visibility = _visibility;

            svi.BorderThickness = new Thickness(20, 20, 20, 20);
            svi.Background = new SolidColorBrush(Colors.Transparent);
            svi.ContainerManipulationCompleted += ScatterViewItem_ScatterManipulationCompleted;

            if (_element == null)
                element = new PrototypeElement { ElementType = ElementTypes.None, Orientation = _orientation, Center = svi.ActualCenter };
            else
            {
                element = new PrototypeElement
                {
                    ElementType = _element.ElementType,
                    Orientation = _element.Orientation,
                    Center = _element.Center,
                    Width = _element.Width,
                    Height = _element.Height,
                    Content = _element.Content,
                    GestureTargetPageMap = _element.GestureTargetPageMap
                };
            }

            canvasHelper.BindScatterViewItemAndElement(svi, element);

            ActiveSessionManager.AddPrototypeElementToPage(page, element);
        }