Exemplo n.º 1
0
        public void TestAddItemsToStoryboard()
        {
            _w.output("START");
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            _TestSingleTon.Instance._SetupForLayoutPanelTests();

            FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);

            form.Controls.Add(panel);
            form.Show();

            //NOTE: For now remember that htis ADDS 1 Extra notes
            panel.NewLayout("mynewpanel", true, null);
            NoteDataXML basicNote = new NoteDataXML();

            basicNote.Caption = "note1";

            panel.AddNote(basicNote);
            //basicNote.CreateParent(panel);


            NoteDataXML_GroupEm StoryBoard = new NoteDataXML_GroupEm();

            panel.AddNote(StoryBoard);

            //panel.MoveNote(
            // create four panels A and B at root level. C inside A. D inside C
            FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel();

            panelA.Caption = "PanelA";
            panel.AddNote(panelA);               // 1



            StoryBoard             = new NoteDataXML_GroupEm();
            StoryBoard.GuidForNote = "storyboard2";
            StoryBoard.Caption     = "storyboard";
            panelA.AddNote(StoryBoard);
            StoryBoard.CreateParent(panelA.GetPanelsLayout());

            Assert.AreEqual(0, StoryBoard.CountStoryBoardItems());


            CoreUtilities.Links.LinkTableRecord record = new CoreUtilities.Links.LinkTableRecord();
            record.sFileName = "PanelA";            //StoryBoard.GuidForNote;
            record.sKey      = "*";
            record.sText     = "*";
            record.sSource   = StoryBoard.GuidForNote;
            panel.GetLinkTable().Add(record);
            Assert.AreEqual(1, panel.GetLinkTable().Count());
            StoryBoard.Refresh();
            Assert.AreEqual(1, StoryBoard.CountStoryBoardItems());
        }
        /// <summary>
        /// Handles the story board click item. Goes to the note
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        string HandleStoryBoardClickItem(object sender)
        {
            string TextToSearchFor = Constants.BLANK;

            CoreUtilities.Links.LinkTableRecord record = (CoreUtilities.Links.LinkTableRecord)sender;
            if (record != null)
            {
                TextToSearchFor = record.sText;
                if (TextToSearchFor.IndexOf(";") > -1)
                {
                    // clean up text
                    TextToSearchFor = TextToSearchFor.Replace("\t", "");
                    TextToSearchFor = TextToSearchFor.Replace("\n", "");
                    TextToSearchFor = TextToSearchFor.Replace("\r", "");
                    // just grab SECOND string of semicolon (first is the number
                    string[] found = TextToSearchFor.Split(new char[1] {
                        ';'
                    });
                    if (found != null)
                    {
                        TextToSearchFor = found[1];
                        if (TextToSearchFor == "" && found[0] != "")
                        {
                            TextToSearchFor = found[0];
                        }
                    }
                    TextToSearchFor = TextToSearchFor.Trim();
                }
                else
                {
                    TextToSearchFor = Constants.BLANK;
                }



                if (General.IsGraphicFile(record.sFileName))
                {
                    //NewMessage.Show ("image");

                    Layout.GetNoteOnSameLayout(record.ExtraField, true);
                }
                else
                {
                    Layout.GetNoteOnSameLayout(record.sFileName, true, TextToSearchFor);
                }
            }
            return("");
        }
        public void TestAddItemsToStoryboard()
        {
            _w.output ("START");
            System.Windows.Forms .Form form = new System.Windows.Forms.Form ();
            _TestSingleTon.Instance._SetupForLayoutPanelTests ();

            FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false);
            form.Controls.Add (panel);
            form.Show ();

            //NOTE: For now remember that htis ADDS 1 Extra notes
            panel.NewLayout ("mynewpanel", true, null);
            NoteDataXML basicNote = new NoteDataXML ();
            basicNote.Caption = "note1";

            panel.AddNote (basicNote);
            //basicNote.CreateParent(panel);

            NoteDataXML_GroupEm StoryBoard = new NoteDataXML_GroupEm();
            panel.AddNote (StoryBoard);

            //panel.MoveNote(
            // create four panels A and B at root level. C inside A. D inside C
            FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel ();
            panelA.Caption = "PanelA";
            panel.AddNote (panelA);  // 1

            StoryBoard = new NoteDataXML_GroupEm();
            StoryBoard.GuidForNote = "storyboard2";
            StoryBoard.Caption = "storyboard";
            panelA.AddNote (StoryBoard);
            StoryBoard.CreateParent(panelA.GetPanelsLayout());

            Assert.AreEqual (0, StoryBoard.CountStoryBoardItems());

            CoreUtilities.Links.LinkTableRecord record = new CoreUtilities.Links.LinkTableRecord();
            record.sFileName = "PanelA";//StoryBoard.GuidForNote;
            record.sKey = "*";
            record.sText="*";
            record.sSource = StoryBoard.GuidForNote;
            panel.GetLinkTable().Add (record);
            Assert.AreEqual (1,panel.GetLinkTable ().Count());
            StoryBoard.Refresh();
            Assert.AreEqual (1, StoryBoard.CountStoryBoardItems());
        }