コード例 #1
0
        private void Fill_Click(object sender, EventArgs e)
        {
            textBox1.Visible      = false;
            numericUpDown.Visible = false;
            toolController        = new FillController();
            Button Btn = sender as Button;

            if (Btn != null)
            {
                setColor(this, Btn);
            }
            PaintMode = false;
        }
コード例 #2
0
        private void Hand_Click(object sender, EventArgs e)
        {
            textBox1.Visible      = false;
            numericUpDown.Visible = false;
            Button Btn = sender as Button;

            if (Btn != null)
            {
                setColor(this, Btn);
            }
            toolController = new HandController();
            toolFactory    = new HandFactory();
            tool           = toolFactory.CreateTool(tool.Selector);
            PaintMode      = false;
        }
コード例 #3
0
        public void TestInitialize()
        {
            List <ITool> tools = new List <ITool>();

            for (int i = 0; i < 10; i++)
            {
                Mock <ITool> tool = new Mock <ITool>();
                tool.Setup(row => row.Name).Returns($"Tool {i}");
                tools.Add(tool.Object);
            }

            Mock <IToolFactory> toolFactory = new Mock <IToolFactory>();

            toolFactory.Setup(row => row.CreateInstance(It.IsAny <string>())).Returns(new AmazingTool());

            toolController = new ToolController(toolFactory.Object);
        }
コード例 #4
0
 public EditorForm()
 {
     InitializeComponent();
     SizeLabel.Text    = Convert.ToString($"{pictureBox.Width} X {pictureBox.Height}");
     canvas            = new Canvas(pictureBox.Width, pictureBox.Height);
     canvas.PictureBox = pictureBox;
     canvas.TmpBitmap  = (Bitmap)canvas.MainBitmap.Clone();
     canvas.Graphics   = Graphics.FromImage(canvas.TmpBitmap);
     pictureBox.Image  = canvas.MainBitmap;
     pen            = new Pen(Color.Black, (int)numericUpDown1.Value);
     pen.StartCap   = LineCap.Round;
     pen.EndCap     = LineCap.Round;
     figure         = new BrushFigure(new BrushController());
     toolController = new HandController();
     figureFactory  = new BrushFactory();
     tool           = new HandTool(new HandSelector());
     container      = new Container();
 }
コード例 #5
0
    private void HandleTags(ITouch touch)
    {
        Tags tags = touch.Tags;

        if (tags.Count > 0)
        {
            Debug.Log(string.Format("Tag detected: {0}", tags));

            foreach (string tag in tags.TagList)
            {
                // Check whether this tag should be ignored e.g. Mouse etc.
                if (_ignoredTagNames.Contains(tag))
                {
                    Debug.Log(string.Format("Ignoring tag: {0}", tag));
                    continue;
                }

                Vector3 worldPosition = Camera.main.ScreenToWorldPoint(new Vector3(touch.Position.x,
                                                                                   touch.Position.y,
                                                                                   0.0f));

                // Check whether this tag is a tool tag
                if (_tagNameToToolDict.ContainsKey(tag))
                {
                    Debug.Log(string.Format("Instantiating tool with tag: {0}", tag));
                    GameObject tool = (GameObject)Instantiate(_tagNameToToolDict [tag], worldPosition, Quaternion.identity);

                    IToolController controller = tool.GetComponent <IToolController>();

                    if (controller != null)
                    {
                        _touchIDToolMap.Add(touch.Id, tool);
                        controller.FollowTouch(touch);
                    }
                }
                // If nothing else, search for Tweets with the tag
                else
                {
                    Debug.Log(string.Format("Instantiating tweets with tag: {0}", tag));
                    TweetManager.Instance.CreateTweets(tag, worldPosition);
                }
            }
        }
    }