Exemple #1
0
        void CloseCommand_Fire(object sender, TouchEventArgs e)
        {
            lastTouchObj = this.pathClose;
            this.SetBrushTransition(this.pathClose, this.cvsClose, true);
            PenMenuCommandType type = PenMenuControl.GetCommandType(this.focusToolPath);

            this.RaisePenMenuCommandFireEvent(type, PenMenuCommand.Close);
        }
Exemple #2
0
        private void SetRelativePathStatus(Path path, bool isHilght)
        {
            PenMenuCommand focusPenPathcommand = PenMenuControl.GetMenuCommand(path);

            this.SetTargetPathGroupStatus(focusPenPathcommand, isHilght);
        }
Exemple #3
0
        void targetItem_TouchDown(object sender, TouchEventArgs e)
        {
            lock (synObj)
            {
                lastTouchObj       = null;
                this.timeCalculate = DateTime.Now;
                Path targetItem = sender as Path;

                PenMenuCommand     command = PenMenuControl.GetMenuCommand(targetItem);
                PenMenuCommandType type    = PenMenuControl.GetCommandType(targetItem);

                if (type == PenMenuCommandType.Tools)
                {
                    this.toolCache.Add(targetItem);
                    if (this.focusToolPath != null)
                    {
                        this.toolCache.Remove(focusToolPath);
                        //if last focus tool belong to pen,use lastFocusPenToolPath to record this one
                        PenMenuCommand lastCommand = PenMenuControl.GetMenuCommand(this.focusToolPath);
                        if (lastCommand == PenMenuCommand.FreeHandPen || lastCommand == PenMenuCommand.SmoothlyPen)
                        {
                            this.lastFocusToolPenPath = this.focusToolPath;
                        }
                    }
                    //not drawing operation
                    if (command != PenMenuCommand.FreeHandPen && command != PenMenuCommand.SmoothlyPen)
                    {
                        //drwaing pen turn to normal state
                        if (this.focusPenPath != null)
                        {
                            this.focusPenPath.Fill = this.normalBrush;
                            this.SetRelativePathStatus(this.focusPenPath, false);
                        }
                    }
                    else
                    {
                        //if select pen,get the current draing pen type(highlight or marker pen )
                        if (this.focusPenPath != null)
                        {
                            this.focusPenPath.Fill = this.highlightBrush;
                            this.SetRelativePathStatus(this.focusPenPath, true);
                        }
                    }
                    this.focusToolPath = targetItem;
                }
                else
                {
                    focusPenPath.Fill = this.normalBrush;
                    this.SetRelativePathStatus(this.focusPenPath, false);

                    //if click the drawing pen,use current button command
                    targetItem.Fill = this.highlightBrush;
                    this.SetRelativePathStatus(targetItem, true);

                    PenMenuCommand focusCommand = PenMenuControl.GetMenuCommand(this.focusToolPath);
                    if (focusCommand == PenMenuCommand.Eraser || focusCommand == PenMenuCommand.LassoSelected)
                    {
                        if (this.lastFocusToolPenPath != null)
                        {
                            if (this.toolCache.Contains(lastFocusToolPenPath) == false)
                            {
                                this.toolCache.Clear();
                                this.toolCache.Add(lastFocusToolPenPath);
                                this.focusToolPath = lastFocusToolPenPath;
                            }
                        }
                    }
                    focusPenPath = targetItem;
                }
                this.RaisePenMenuCommandFireEvent(type, command);

                if (toolCache.Count != 1)
                {
                    throw new Exception("Hight light should be one");
                }

                foreach (var item in this.gdRoot.Children)
                {
                    Path path = item as Path;
                    if (path != null)
                    {
                        PenMenuCommandType currentElementType = PenMenuControl.GetCommandType(path);
                        PenMenuCommand     menuCommand        = PenMenuControl.GetMenuCommand(path);
                        if (currentElementType == PenMenuCommandType.Tools)
                        {
                            if (path.Name.StartsWith("path_"))
                            {
                                if (path == toolCache[0])
                                {
                                    path.Fill = this.highlightBrush;
                                    this.SetRelativePathStatus(path, true);
                                    Trace.WriteLine(string.Format("{0} is hightlight", path.Name));
                                }
                                else
                                {
                                    path.Fill = menuCommand == PenMenuCommand.Animation ? this.animatoinOrCose : this.normalBrush;
                                    this.SetRelativePathStatus(path, false);
                                    Trace.WriteLine(string.Format("{0} is normal", path.Name));
                                }
                            }
                        }
                    }
                }
            }
        }