public static void CreateASystemLayout(Control parent, ContextMenuStrip textEditorContextStrip) { LayoutPanel SystemLayout = new Layout.LayoutPanel(CoreUtilities.Constants.BLANK, true); SystemLayout.NewLayout("system", false, textEditorContextStrip); SystemLayout.BackColor = System.Drawing.Color.Wheat; SystemLayout.SetName(Loc.Instance.GetString("system")); SystemLayout.Parent = parent; SystemLayout.Visible = true; NoteDataXML_Panel sidedockpanel = new NoteDataXML_Panel(800, 300); sidedockpanel.GuidForNote = LayoutDetails.SIDEDOCK; //"system_sidedock"; SystemLayout.AddNote(sidedockpanel); sidedockpanel.CreateParent(SystemLayout); sidedockpanel.BringToFrontAndShow(); sidedockpanel.Dock = DockStyle.Left; // //------Subpanel // NoteDataXML_Panel subpanel = new NoteDataXML_Panel(100, 100); //subpanel.Save(); //sidedockpanel.Save(); //* important subpanel.GuidForNote = LayoutDetails.TABLEGUID; subpanel.Caption = Loc.Instance.GetString("Tables"); sidedockpanel.AddNote(subpanel); subpanel.CreateParent(sidedockpanel.GetPanelsLayout()); NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2] { new ColumnDetails("id", 100), new ColumnDetails("tables", 100) }); randomTables.Caption = LayoutDetails.SYSTEM_RANDOM_TABLES; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), new appframe.ColumnDetails("tables",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2] { "1", "example|colors" }); randomTables.AddRow(new object[2] { "2", "example|colorPROMPTS" }); SystemLayout.SaveLayout(); randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3] { new ColumnDetails("id", 100), new ColumnDetails("notebooks", 100), new ColumnDetails("sections", 200) }); randomTables.Caption = LayoutDetails.SYSTEM_NOTEBOOKS; // randomTables.Columns = new appframe.ColumnDetails[3]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("notebooks",100), // new appframe.ColumnDetails("sections",200)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[3] { "1", Loc.Instance.GetString("Writing"), Loc.Instance.GetString("All|Advice|Characters|Markets|Projects|Scenes") }); randomTables.AddRow(new object[3] { "2", Loc.Instance.GetString("Research"), Loc.Instance.GetString("All|Historical|Science") }); randomTables.AddRow(new object[3] { "3", Loc.Instance.GetString("All"), Loc.Instance.GetString("All") }); /// /// -- STATUS /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2] { new ColumnDetails("id", 100), new ColumnDetails("status", 100) }); randomTables.Caption = LayoutDetails.SYSTEM_STATUS; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("status",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2] { "1", Loc.Instance.GetString("0 Not Started") }); randomTables.AddRow(new object[2] { "2", Loc.Instance.GetString("1 Planning") }); randomTables.AddRow(new object[2] { "3", Loc.Instance.GetString("2 Writing") }); randomTables.AddRow(new object[2] { "4", Loc.Instance.GetString("3 Rewriting") }); randomTables.AddRow(new object[2] { "5", Loc.Instance.GetString("4 Complete") }); randomTables.AddRow(new object[2] { "6", Loc.Instance.GetString("5 Accepted") }); randomTables.AddRow(new object[2] { "7", Loc.Instance.GetString("6 Published") }); randomTables.AddRow(new object[2] { "8", Loc.Instance.GetString("7 Republished on personal site") }); randomTables.AddRow(new object[2] { "9", Loc.Instance.GetString("8 Selfpublished") }); // NewMessage.Show (randomTables.RowCount().ToString ()); randomTables.AddRow(new object[2] { "10", Loc.Instance.GetString("9 Retired") }); // NewMessage.Show (randomTables.RowCount().ToString ()); /// /// -- SUBTYPES /// /// /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2] { new ColumnDetails("id", 100), new ColumnDetails("subtype", 100) }); randomTables.Caption = LayoutDetails.SYSTEM_SUBTYPE; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("subtype",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2] { "1", Loc.Instance.GetString("Article") }); randomTables.AddRow(new object[2] { "2", Loc.Instance.GetString("Idea") }); randomTables.AddRow(new object[2] { "3", Loc.Instance.GetString("Novel") }); randomTables.AddRow(new object[2] { "4", Loc.Instance.GetString("Play") }); randomTables.AddRow(new object[2] { "5", Loc.Instance.GetString("Story") }); /// /// -- KEYWORDS /// /// /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2] { new ColumnDetails("id", 100), new ColumnDetails("keyword", 100) }); randomTables.Caption = LayoutDetails.SYSTEM_KEYWORDS; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("keyword",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2] { "1", Loc.Instance.GetString("Brainstorm") }); randomTables.AddRow(new object[2] { "2", Loc.Instance.GetString("Horror") }); randomTables.AddRow(new object[2] { "3", Loc.Instance.GetString("Fantasy") }); randomTables.AddRow(new object[2] { "4", Loc.Instance.GetString("SciFi") }); randomTables.AddRow(new object[2] { "5", Loc.Instance.GetString("WhatIf?") }); /// /// -- WORKLOG /// /// /// // randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), // new ColumnDetails("category",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_WORKLOGCATEGORY; // // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("category",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Writing")}); // randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("Editing")}); // randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("Planning")}); /// /// -- Grammar /// /// /// // randomTables = new NoteDataXML_Table(100, 100 , new ColumnDetails[4]{new ColumnDetails("id",100), // new ColumnDetails("pattern",100), new ColumnDetails("advice",100), new ColumnDetails("overused",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_GRAMMAR; // // randomTables.Columns = new appframe.ColumnDetails[4]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("pattern",100), new appframe.ColumnDetails("advice",100), new appframe.ColumnDetails("overused",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[4]{ // "1", "1.0", @"The first row of this table is a version number. Feel free to edit it when major changes are made to this list. On each Layout you can record the last grammar version you have checked it against.", "0"} // ); // // randomTables.AddRow(new object[4]{ // "2", "Among", @"When more than two things or persons are involved, among is usually called for.", "0"} // ); // randomTables.AddRow(new object[4]{ // "3", "As to whether", @"Whether is sufficient.", "1"} // ); /// /// -- Queries /// /// /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3] { new ColumnDetails("id", 100), new ColumnDetails("name", 100), new ColumnDetails("query", 100) }); randomTables.GuidForNote = "systemqueries"; randomTables.Caption = LayoutDetails.SYSTEM_QUERIES; // randomTables.Columns = new appframe.ColumnDetails[3]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("name",100), new appframe.ColumnDetails("query",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[3] { "1", "All", @"" } ); randomTables.AddRow(new object[3] { "2", "WritingProjects", @"notebook='Writing' and section='Projects'" } ); // be created by those AddIns. /// /// -- SUBMISSION -- most submission stuff needs to be in Submission AddIn but these two (for load reasons) are here. Sorry. /// /// /// /// 1. Publish Types (electronic or print) /// /// // randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), // new ColumnDetails("category",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_PUBLISHTYPES; // // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("category",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Both")}); // randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("Electronic")}); // randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("None")}); // randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("Print")}); /// /// 2. Market Types (pay category) /// /// // randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), // new ColumnDetails("category",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_MARKETTYPES; // // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("category",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Non Paying")}); // randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("None")}); // randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("Semi-Pro")}); // randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("Small Press (Token)")}); // randomTables.AddRow(new object[2]{"5", Loc.Instance.GetString("Pro Market")}); SystemLayout.SaveLayout(); // note list needs to be at the end March 2013 but creatio happens earlier so it is the defautl viewed note // so we build it later NoteDataXML_NoteList list = new NoteDataXML_NoteList(); list.GuidForNote = "notelist"; sidedockpanel.AddNote(list); list.CreateParent(sidedockpanel.GetPanelsLayout()); list.Mode = NoteDataXML_NoteList.Modes.LAYOUTS; list.Dock = DockStyle.Fill; SystemLayout.SaveLayout(); list.Refresh(); SystemLayout.Dispose(); }
public void GetValuesForTable() { _SetupForLayoutPanelTests(); Form form = new Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); form.Controls.Add(panel); // needed else DataGrid does not initialize form.Visible = false; form.Show(); //NOTE: For now remember that htis ADDS 1 Extra notes panel.NewLayout("mynewpanel", true, null); NoteDataXML_Table test = new NoteDataXML_Table(425, 380); test.GuidForNote = "thisguid1"; test.Caption = "note1"; test.Columns = new ColumnDetails[3] { new ColumnDetails("snakes", 109), new ColumnDetails("fish", 90), new ColumnDetails("goobers", 11111) }; test.AddRow(new object[3] { "1", "value1", "testA" }); test.AddRow(new object[3] { "2", "value2", "testB" }); test.AddRow(new object[3] { "3", "value3", "testC" }); panel.AddNote(test); test.CreateParent(panel); panel.SaveLayout(); List <string> cols = test.GetValuesForColumn(1, "*"); for (int i = 0; i < 3; i++) { switch (i) { case 0: Assert.AreEqual(cols[i], "value1"); break; case 1: Assert.AreEqual(cols[i], "value2"); break; case 2: Assert.AreEqual(cols[i], "value3"); break; } } cols = test.GetValuesForColumn(2, "*"); for (int i = 0; i < 3; i++) { switch (i) { case 0: Assert.AreEqual(cols[i], "testA"); break; case 1: Assert.AreEqual(cols[i], "testB"); break; case 2: Assert.AreEqual(cols[i], "testC"); break; } } }
protected override void DoBuildChildren(LayoutPanelBase Layout) { // Unable to BUILD A SYSTEM TABLE here. It is a copy, not a link to the actual table // and hence does not work. // Instead I will try under Register; see my logic for why, there // We create the table when registering type. // The LOGIC I am using is that this will be called when the user // clicks the FIRST TIME to register the type. Meaning the table is created. // WHERE IT FAILS: If the user deletes the table manually, it will never attempt to recreate it, unless // Addin deregistered and reregisetered string TableName = SYSTEM_WORKLOGCATEGORY; LayoutPanels.NoteDataXML_Panel PanelContainingTables = LayoutPanel.GetPanelToAddTableTo (TableName); BringToFrontAndShow (); // can't use TableLayout because its not the actual tablelayout (its a copy) if (PanelContainingTables != null) { // create the note NoteDataXML_Table randomTables = new NoteDataXML_Table (100, 100, new ColumnDetails[2]{new ColumnDetails ("id", 100), new ColumnDetails ("category", 100)}); randomTables.Caption = TableName; PanelContainingTables.AddNote (randomTables); randomTables.CreateParent (PanelContainingTables.GetPanelsLayout ()); randomTables.AddRow (new object[2]{"1", Loc.Instance.GetString ("Writing")}); randomTables.AddRow (new object[2]{"2", Loc.Instance.GetString ("Editing")}); randomTables.AddRow (new object[2]{"3", Loc.Instance.GetString ("Planning")}); // LayoutDetails.Instance.TableLayout.SaveLayout(); PanelContainingTables.GetPanelsLayout ().SaveLayout (); //NewMessage.Show("Making new"); // now we reload the system version LayoutDetails.Instance.TableLayout.LoadLayout (LayoutDetails.TABLEGUID, true, null); BringToFrontAndShow (); } base.DoBuildChildren (Layout); properties.DropDownItems.Add (new ToolStripSeparator ()); CaptionLabel.Dock = DockStyle.Top; Journal = new JournalPanel(this.Layout.GUID, BringFrontWrapper); Journal.Dock = DockStyle.Fill; //Journal.Click+= (object sender, EventArgs e) => BringToFrontAndShow(); ParentNotePanel.Controls.Add (Journal); Journal.BringToFront(); Journal.RefreshPanels(""); }
/// <summary> /// Creates the example layout. For new users. /// </summary> /// <returns> /// The example layout. /// </returns> /// <param name='parent'> /// Parent. /// </param> public static void CreateExampleLayout(Control parent, ContextMenuStrip TextEditMenuStrip) { LayoutPanel exampleLayout = new Layout.LayoutPanel(CoreUtilities.Constants.BLANK, true); exampleLayout.NewLayout("example", false, TextEditMenuStrip); exampleLayout.Parent = parent; exampleLayout.Visible = true; exampleLayout.SetName(Loc.Instance.GetString("example")); const int columns = 3; NoteDataXML_Table randomTables = new NoteDataXML_Table(); randomTables.Columns = new ColumnDetails[columns] { new ColumnDetails(TableWrapper.Roll, 100), new ColumnDetails(TableWrapper.Result, 100) , new ColumnDetails(TableWrapper.NextTable, 100) }; exampleLayout.SaveLayout(); exampleLayout.AddNote(randomTables); randomTables.CreateParent(exampleLayout); randomTables.Caption = "colors"; randomTables.TableCaption = "COLORS: "; randomTables.AddRow(new object[columns] { "1", "red", "" }); randomTables.AddRow(new object[columns] { "2", "blue", "" }); randomTables.AddRow(new object[columns] { "3", "yellow", "" }); // 2nd table randomTables = new NoteDataXML_Table(); randomTables.TableCaption = "COLORS AS PROMPT: "; randomTables.Columns = new ColumnDetails[columns] { new ColumnDetails(TableWrapper.Roll, 100), new ColumnDetails(TableWrapper.Result, 100), new ColumnDetails(TableWrapper.NextTable, 100) }; randomTables.Caption = "colorprompts"; randomTables.AddRow(new object[columns] { "1", "red", "" }); randomTables.AddRow(new object[columns] { "2", "blue", "" }); randomTables.AddRow(new object[columns] { "3", "yellow", "" }); exampleLayout.AddNote(randomTables); randomTables.CreateParent(exampleLayout); exampleLayout.SaveLayout(); exampleLayout.Dispose(); }
public void CopyNoteTest() { _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms .Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panelToUse = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panelToUse); // needed else DataGrid does not initialize form.Show (); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form,null); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panelToUse.NewLayout (panelname,true, null); LayoutDetails.Instance.AddToList (typeof(FAKE_NoteDataXML_Panel), "testingpanel"); _w.output ("herefirst"); Timer SaveTimer= new Timer(); SaveTimer.Interval = 300; SaveTimer.Tick+= HandleSaveTimerTick; SaveTimer.Start (); // ADD 1 of each type foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) { for (int i = 0; i < 2; i++) { NoteDataInterface note = (NoteDataInterface)Activator.CreateInstance (t); panelToUse.AddNote (note); note.CreateParent(panelToUse); note.UpdateAfterLoad(); panelToUse.CopyNote(note); panelToUse.PasteNote(); } } panelToUse.SaveLayout(); //int propercount= 4 * LayoutDetails.Instance.ListOfTypesToStoreInXML().Length; Assert.AreEqual (46, panelToUse.CountNotes()); // // Now we test pasting one of our notes onto another Layout // string panelname2 = System.Guid.NewGuid().ToString(); FAKE_LayoutPanel PanelOtherGuy= new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); PanelOtherGuy.NewLayout (panelname2,true, null); PanelOtherGuy.SaveLayout(); form.Controls.Add(PanelOtherGuy); Assert.AreEqual( 2, PanelOtherGuy.CountNotes(), "count1"); // ADD 1 of each type //foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) { for (int i = 0; i < 10; i++) { NoteDataInterface note = new NoteDataXML_RichText(); PanelOtherGuy.AddNote (note); note.CreateParent(PanelOtherGuy); note.UpdateAfterLoad(); } } Assert.AreEqual( 12, PanelOtherGuy.CountNotes(), "count2"); PanelOtherGuy.PasteNote(); Assert.AreEqual( 13, PanelOtherGuy.CountNotes(), "count2"); PanelOtherGuy.SaveLayout(); FAKE_NoteDataXML_Text Noter = new FAKE_NoteDataXML_Text(); Noter.Caption ="Hello there"; PanelOtherGuy.AddNote (Noter); Noter.GetRichTextBox().Text ="bear"; PanelOtherGuy.SaveLayout (); PanelOtherGuy.CopyNote(Noter); NoteDataXML_RichText CopyOfTextNote = (NoteDataXML_RichText)PanelOtherGuy.PasteNote(); Assert.AreEqual ("Hello there",CopyOfTextNote.Caption); Assert.AreEqual ("bear", CopyOfTextNote.GetRichTextBox().Text); // // // Table Copy Test // // NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100,new ColumnDetails[2]{new ColumnDetails("id",100), new ColumnDetails("tables",100)} ); randomTables.Caption = LayoutDetails.SYSTEM_RANDOM_TABLES; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), new appframe.ColumnDetails("tables",100)}; PanelOtherGuy.AddNote(randomTables); //randomTables.CreateParent(PanelOtherGuy); randomTables.AddRow(new object[2]{"1", "example|colors"}); randomTables.AddRow(new object[2]{"2", "example|colorPROMPTS"}); PanelOtherGuy.SaveLayout (); PanelOtherGuy.CopyNote(randomTables); NoteDataXML_Table CopyOfTable = (NoteDataXML_Table)PanelOtherGuy.PasteNote(); Assert.AreEqual (2, CopyOfTable.RowCount()); }
public void TableSearch() { // the way filters work for tables is weird // and becaue it is weird I might tweak it later and this is a bad idea // so I'm writing this test to stop me from doing that _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms .Form form = new System.Windows.Forms.Form(); // needed else DataGrid does not initialize form.Show (); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form,null); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname2 = System.Guid.NewGuid().ToString(); FAKE_LayoutPanel PanelOtherGuy= new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); PanelOtherGuy.NewLayout (panelname2,true, null); form.Controls.Add (PanelOtherGuy); PanelOtherGuy.SaveLayout(); Assert.AreEqual( 2, PanelOtherGuy.CountNotes(), "count1"); // ADD 1 of each type //foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) NoteDataXML_Table table = new NoteDataXML_Table(100, 100,new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("tables",100), new ColumnDetails("values",220)} ); table.GuidForNote="thetable"; table.Caption="thettable2"; PanelOtherGuy.AddNote (table); table.CreateParent(PanelOtherGuy); // table.UpdateAfterLoad(); table.AddRow(new object[3] {"0", "table1", "value1"}); table.AddRow(new object[3] {"0", "table2", "value2"}); table.AddRow(new object[3] {"0", "table3", "value3"}); table.AddRow(new object[3] {"0", "table4", "value4"}); PanelOtherGuy.SaveLayout(); Assert.AreEqual( 3, PanelOtherGuy.CountNotes(), "count2"); string ToSearchFor = "table3"; // looks in row 1 for the value and will return the value from row 2 List<string> results = PanelOtherGuy.GetListOfStringsFromSystemTable("thettable2", 2, String.Format ("1|{0}", ToSearchFor)); Assert.NotNull(results); Assert.AreEqual (1, results.Count); Assert.AreEqual ("value3", results[0]); ToSearchFor ="bacon"; results = PanelOtherGuy.GetListOfStringsFromSystemTable("thettable2", 2, String.Format ("1|{0}", ToSearchFor)); Assert.NotNull(results); Assert.AreEqual (0, results.Count); ToSearchFor ="0"; results = PanelOtherGuy.GetListOfStringsFromSystemTable("thettable2", 1, String.Format ("0|{0}", ToSearchFor)); Assert.NotNull(results); Assert.AreEqual (4, results.Count); }
public void CopyNoteTest() { _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panelToUse = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); form.Controls.Add(panelToUse); // needed else DataGrid does not initialize form.Show(); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form, null); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panelToUse.NewLayout(panelname, true, null); LayoutDetails.Instance.AddToList(typeof(FAKE_NoteDataXML_Panel), "testingpanel"); _w.output("herefirst"); Timer SaveTimer = new Timer(); SaveTimer.Interval = 300; SaveTimer.Tick += HandleSaveTimerTick; SaveTimer.Start(); // ADD 1 of each type foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) { for (int i = 0; i < 2; i++) { NoteDataInterface note = (NoteDataInterface)Activator.CreateInstance(t); panelToUse.AddNote(note); note.CreateParent(panelToUse); note.UpdateAfterLoad(); panelToUse.CopyNote(note); panelToUse.PasteNote(); } } panelToUse.SaveLayout(); //int propercount= 4 * LayoutDetails.Instance.ListOfTypesToStoreInXML().Length; Assert.AreEqual(46, panelToUse.CountNotes()); // // Now we test pasting one of our notes onto another Layout // string panelname2 = System.Guid.NewGuid().ToString(); FAKE_LayoutPanel PanelOtherGuy = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); PanelOtherGuy.NewLayout(panelname2, true, null); PanelOtherGuy.SaveLayout(); form.Controls.Add(PanelOtherGuy); Assert.AreEqual(2, PanelOtherGuy.CountNotes(), "count1"); // ADD 1 of each type //foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) { for (int i = 0; i < 10; i++) { NoteDataInterface note = new NoteDataXML_RichText(); PanelOtherGuy.AddNote(note); note.CreateParent(PanelOtherGuy); note.UpdateAfterLoad(); } } Assert.AreEqual(12, PanelOtherGuy.CountNotes(), "count2"); PanelOtherGuy.PasteNote(); Assert.AreEqual(13, PanelOtherGuy.CountNotes(), "count2"); PanelOtherGuy.SaveLayout(); FAKE_NoteDataXML_Text Noter = new FAKE_NoteDataXML_Text(); Noter.Caption = "Hello there"; PanelOtherGuy.AddNote(Noter); Noter.GetRichTextBox().Text = "bear"; PanelOtherGuy.SaveLayout(); PanelOtherGuy.CopyNote(Noter); NoteDataXML_RichText CopyOfTextNote = (NoteDataXML_RichText)PanelOtherGuy.PasteNote(); Assert.AreEqual("Hello there", CopyOfTextNote.Caption); Assert.AreEqual("bear", CopyOfTextNote.GetRichTextBox().Text); // // // Table Copy Test // // NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2] { new ColumnDetails("id", 100), new ColumnDetails("tables", 100) }); randomTables.Caption = LayoutDetails.SYSTEM_RANDOM_TABLES; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), new appframe.ColumnDetails("tables",100)}; PanelOtherGuy.AddNote(randomTables); //randomTables.CreateParent(PanelOtherGuy); randomTables.AddRow(new object[2] { "1", "example|colors" }); randomTables.AddRow(new object[2] { "2", "example|colorPROMPTS" }); PanelOtherGuy.SaveLayout(); PanelOtherGuy.CopyNote(randomTables); NoteDataXML_Table CopyOfTable = (NoteDataXML_Table)PanelOtherGuy.PasteNote(); Assert.AreEqual(2, CopyOfTable.RowCount()); }
public void TableSearch() { // the way filters work for tables is weird // and becaue it is weird I might tweak it later and this is a bad idea // so I'm writing this test to stop me from doing that _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); // needed else DataGrid does not initialize form.Show(); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form, null); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname2 = System.Guid.NewGuid().ToString(); FAKE_LayoutPanel PanelOtherGuy = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); PanelOtherGuy.NewLayout(panelname2, true, null); form.Controls.Add(PanelOtherGuy); PanelOtherGuy.SaveLayout(); Assert.AreEqual(2, PanelOtherGuy.CountNotes(), "count1"); // ADD 1 of each type //foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) NoteDataXML_Table table = new NoteDataXML_Table(100, 100, new ColumnDetails[3] { new ColumnDetails("id", 100), new ColumnDetails("tables", 100), new ColumnDetails("values", 220) }); table.GuidForNote = "thetable"; table.Caption = "thettable2"; PanelOtherGuy.AddNote(table); table.CreateParent(PanelOtherGuy); // table.UpdateAfterLoad(); table.AddRow(new object[3] { "0", "table1", "value1" }); table.AddRow(new object[3] { "0", "table2", "value2" }); table.AddRow(new object[3] { "0", "table3", "value3" }); table.AddRow(new object[3] { "0", "table4", "value4" }); PanelOtherGuy.SaveLayout(); Assert.AreEqual(3, PanelOtherGuy.CountNotes(), "count2"); string ToSearchFor = "table3"; // looks in row 1 for the value and will return the value from row 2 List <string> results = PanelOtherGuy.GetListOfStringsFromSystemTable("thettable2", 2, String.Format("1|{0}", ToSearchFor)); Assert.NotNull(results); Assert.AreEqual(1, results.Count); Assert.AreEqual("value3", results[0]); ToSearchFor = "bacon"; results = PanelOtherGuy.GetListOfStringsFromSystemTable("thettable2", 2, String.Format("1|{0}", ToSearchFor)); Assert.NotNull(results); Assert.AreEqual(0, results.Count); ToSearchFor = "0"; results = PanelOtherGuy.GetListOfStringsFromSystemTable("thettable2", 1, String.Format("0|{0}", ToSearchFor)); Assert.NotNull(results); Assert.AreEqual(4, results.Count); }
/// <summary> /// Creates the example layout. For new users. /// </summary> /// <returns> /// The example layout. /// </returns> /// <param name='parent'> /// Parent. /// </param> public static void CreateExampleLayout(Control parent, ContextMenuStrip TextEditMenuStrip) { LayoutPanel exampleLayout = new Layout.LayoutPanel (CoreUtilities.Constants.BLANK, true); exampleLayout.NewLayout ("example" ,false, TextEditMenuStrip); exampleLayout.Parent = parent; exampleLayout.Visible = true; exampleLayout.SetName (Loc.Instance.GetString("example")); const int columns = 3; NoteDataXML_Table randomTables = new NoteDataXML_Table(); randomTables.Columns = new ColumnDetails[columns]{new ColumnDetails(TableWrapper.Roll,100), new ColumnDetails(TableWrapper.Result,100) ,new ColumnDetails(TableWrapper.NextTable, 100)}; exampleLayout.SaveLayout (); exampleLayout.AddNote(randomTables); randomTables.CreateParent(exampleLayout); randomTables.Caption = "colors"; randomTables.TableCaption = "COLORS: "; randomTables.AddRow(new object[columns]{"1", "red",""}); randomTables.AddRow(new object[columns]{"2", "blue",""}); randomTables.AddRow(new object[columns]{"3", "yellow",""}); // 2nd table randomTables = new NoteDataXML_Table(); randomTables.TableCaption = "COLORS AS PROMPT: "; randomTables.Columns = new ColumnDetails[columns]{new ColumnDetails(TableWrapper.Roll,100), new ColumnDetails(TableWrapper.Result,100),new ColumnDetails(TableWrapper.NextTable, 100)}; randomTables.Caption = "colorprompts"; randomTables.AddRow(new object[columns]{"1", "red",""}); randomTables.AddRow(new object[columns]{"2", "blue",""}); randomTables.AddRow(new object[columns]{"3", "yellow",""}); exampleLayout.AddNote(randomTables); randomTables.CreateParent(exampleLayout); exampleLayout.SaveLayout (); exampleLayout.Dispose(); }
public static void CreateASystemLayout(Control parent, ContextMenuStrip textEditorContextStrip) { LayoutPanel SystemLayout = new Layout.LayoutPanel (CoreUtilities.Constants.BLANK, true); SystemLayout.NewLayout ("system" ,false, textEditorContextStrip); SystemLayout.BackColor = System.Drawing.Color.Wheat; SystemLayout.SetName (Loc.Instance.GetString("system")); SystemLayout.Parent = parent; SystemLayout.Visible = true; NoteDataXML_Panel sidedockpanel = new NoteDataXML_Panel(800,300); sidedockpanel.GuidForNote = LayoutDetails.SIDEDOCK; //"system_sidedock"; SystemLayout.AddNote(sidedockpanel); sidedockpanel.CreateParent(SystemLayout); sidedockpanel.BringToFrontAndShow(); sidedockpanel.Dock = DockStyle.Left; // //------Subpanel // NoteDataXML_Panel subpanel = new NoteDataXML_Panel(100,100); //subpanel.Save(); //sidedockpanel.Save(); //* important subpanel.GuidForNote = LayoutDetails.TABLEGUID; subpanel.Caption = Loc.Instance.GetString("Tables"); sidedockpanel.AddNote(subpanel); subpanel.CreateParent(sidedockpanel.GetPanelsLayout()); NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100,new ColumnDetails[2]{new ColumnDetails("id",100), new ColumnDetails("tables",100)} ); randomTables.Caption = LayoutDetails.SYSTEM_RANDOM_TABLES; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), new appframe.ColumnDetails("tables",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2]{"1", "example|colors"}); randomTables.AddRow(new object[2]{"2", "example|colorPROMPTS"}); SystemLayout.SaveLayout (); randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("notebooks",100), new ColumnDetails("sections",200)}); randomTables.Caption = LayoutDetails.SYSTEM_NOTEBOOKS; // randomTables.Columns = new appframe.ColumnDetails[3]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("notebooks",100), // new appframe.ColumnDetails("sections",200)}; subpanel.AddNote(randomTables); randomTables.CreateParent (subpanel.GetPanelsLayout ()); randomTables.AddRow(new object[3]{"1", Loc.Instance.GetString("Writing"), Loc.Instance.GetString("All|Advice|Characters|Markets|Projects|Scenes")}); randomTables.AddRow(new object[3]{"2", Loc.Instance.GetString("Research"), Loc.Instance.GetString("All|Historical|Science")}); randomTables.AddRow(new object[3]{"3", Loc.Instance.GetString("All"), Loc.Instance.GetString("All")}); /// /// -- STATUS /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), new ColumnDetails("status",100)}); randomTables.Caption = LayoutDetails.SYSTEM_STATUS; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("status",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("0 Not Started")}); randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("1 Planning")}); randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("2 Writing")}); randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("3 Rewriting")}); randomTables.AddRow(new object[2]{"5", Loc.Instance.GetString("4 Complete")}); randomTables.AddRow(new object[2]{"6", Loc.Instance.GetString("5 Accepted")}); randomTables.AddRow(new object[2]{"7", Loc.Instance.GetString("6 Published")}); randomTables.AddRow(new object[2]{"8", Loc.Instance.GetString("7 Republished on personal site")}); randomTables.AddRow(new object[2]{"9", Loc.Instance.GetString("8 Selfpublished")}); // NewMessage.Show (randomTables.RowCount().ToString ()); randomTables.AddRow(new object[2]{"10", Loc.Instance.GetString("9 Retired")}); // NewMessage.Show (randomTables.RowCount().ToString ()); /// /// -- SUBTYPES /// /// /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), new ColumnDetails("subtype",100)}); randomTables.Caption = LayoutDetails.SYSTEM_SUBTYPE; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("subtype",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout()); randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Article")}); randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("Idea")}); randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("Novel")}); randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("Play")}); randomTables.AddRow(new object[2]{"5", Loc.Instance.GetString("Story")}); /// /// -- KEYWORDS /// /// /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), new ColumnDetails("keyword",100)}); randomTables.Caption = LayoutDetails.SYSTEM_KEYWORDS; // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("keyword",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout ()); randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Brainstorm")}); randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("Horror")}); randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("Fantasy")}); randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("SciFi")}); randomTables.AddRow(new object[2]{"5", Loc.Instance.GetString("WhatIf?")}); /// /// -- WORKLOG /// /// /// // randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), // new ColumnDetails("category",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_WORKLOGCATEGORY; // // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("category",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Writing")}); // randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("Editing")}); // randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("Planning")}); /// /// -- Grammar /// /// /// // randomTables = new NoteDataXML_Table(100, 100 , new ColumnDetails[4]{new ColumnDetails("id",100), // new ColumnDetails("pattern",100), new ColumnDetails("advice",100), new ColumnDetails("overused",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_GRAMMAR; // // randomTables.Columns = new appframe.ColumnDetails[4]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("pattern",100), new appframe.ColumnDetails("advice",100), new appframe.ColumnDetails("overused",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[4]{ // "1", "1.0", @"The first row of this table is a version number. Feel free to edit it when major changes are made to this list. On each Layout you can record the last grammar version you have checked it against.", "0"} // ); // // randomTables.AddRow(new object[4]{ // "2", "Among", @"When more than two things or persons are involved, among is usually called for.", "0"} // ); // randomTables.AddRow(new object[4]{ // "3", "As to whether", @"Whether is sufficient.", "1"} // ); /// /// -- Queries /// /// /// randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("name",100), new ColumnDetails("query",100)}); randomTables.GuidForNote ="systemqueries"; randomTables.Caption = LayoutDetails.SYSTEM_QUERIES; // randomTables.Columns = new appframe.ColumnDetails[3]{new appframe.ColumnDetails("id",100), // new appframe.ColumnDetails("name",100), new appframe.ColumnDetails("query",100)}; subpanel.AddNote(randomTables); randomTables.CreateParent(subpanel.GetPanelsLayout ()); randomTables.AddRow(new object[3]{ "1", "All", @""} ); randomTables.AddRow(new object[3]{ "2", "WritingProjects", @"notebook='Writing' and section='Projects'"} ); // be created by those AddIns. /// /// -- SUBMISSION -- most submission stuff needs to be in Submission AddIn but these two (for load reasons) are here. Sorry. /// /// /// /// 1. Publish Types (electronic or print) /// /// // randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), // new ColumnDetails("category",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_PUBLISHTYPES; // // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("category",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Both")}); // randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("Electronic")}); // randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("None")}); // randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("Print")}); /// /// 2. Market Types (pay category) /// /// // randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[2]{new ColumnDetails("id",100), // new ColumnDetails("category",100)}); // randomTables.Caption = LayoutDetails.SYSTEM_MARKETTYPES; // // randomTables.Columns = new appframe.ColumnDetails[2]{new appframe.ColumnDetails("id",100), // // new appframe.ColumnDetails("category",100)}; // subpanel.AddNote(randomTables); // randomTables.CreateParent(subpanel.GetPanelsLayout ()); // // randomTables.AddRow(new object[2]{"1", Loc.Instance.GetString("Non Paying")}); // randomTables.AddRow(new object[2]{"2", Loc.Instance.GetString("None")}); // randomTables.AddRow(new object[2]{"3", Loc.Instance.GetString("Semi-Pro")}); // randomTables.AddRow(new object[2]{"4", Loc.Instance.GetString("Small Press (Token)")}); // randomTables.AddRow(new object[2]{"5", Loc.Instance.GetString("Pro Market")}); SystemLayout.SaveLayout (); // note list needs to be at the end March 2013 but creatio happens earlier so it is the defautl viewed note // so we build it later NoteDataXML_NoteList list = new NoteDataXML_NoteList(); list.GuidForNote = "notelist"; sidedockpanel.AddNote(list); list.CreateParent(sidedockpanel.GetPanelsLayout()); list.Mode = NoteDataXML_NoteList.Modes.LAYOUTS; list.Dock = DockStyle.Fill; SystemLayout.SaveLayout (); list.Refresh(); SystemLayout.Dispose (); }
private void CreateSubmissionTypeTable() { NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("name",100), new ColumnDetails("code",100)} ); randomTables.Caption = SubmissionMaster.TABLE_SubmissionTypes; randomTables.GuidForNote = SubmissionMaster.TABLE_SubmissionTypes; randomTables.Columns = new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("name",100), new ColumnDetails("code",100)}; Layout.AddNote(randomTables); randomTables.CreateParent(Layout); randomTables.AddRow(new object[3]{"1", "Submission", @"submission"}); randomTables.AddRow(new object[3]{"2", "Invalid", @"invalid"}); randomTables.AddRow(new object[3]{"3", "Contest Entry", @"submission"}); randomTables.AddRow(new object[3]{"4", "Query", @"none"}); randomTables.AddRow(new object[3]{"5", "Followup Call", @"none"}); randomTables.AddRow(new object[3]{"6", "Email Contest", @"submission"}); randomTables.AddRow(new object[3]{"7", "Followup Letter", @"none"}); randomTables.AddRow(new object[3]{"8", "Proposal", @"none"}); // removed because only I need it for legacy work // randomTables.AddRow(new object[3]{"9", "Destination",SubmissionMaster.CODE_DESTINATION }); }
private void CreateReplyTypeTable() { NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("name",100), new ColumnDetails("code",100)} ); randomTables.Caption = SubmissionMaster.TABLE_ReplyTypes; randomTables.GuidForNote = SubmissionMaster.TABLE_ReplyTypes; // randomTables.Columns = Layout.AddNote(randomTables); randomTables.CreateParent(Layout); randomTables.AddRow(new object[3]{"1", "Invalid",SubmissionMaster.CODE_NO_REPLY_YET}); randomTables.AddRow(new object[3]{"2", "Closed", @"rejection"}); randomTables.AddRow(new object[3]{"3", "Accepted", SubmissionMaster.CODE_ACCEPTANCE}); randomTables.AddRow(new object[3]{"4", "No Response", @"rejection"}); randomTables.AddRow(new object[3]{"5", "Query Rejected", @"rejection"}); randomTables.AddRow(new object[3]{"6", "Rejection", @"rejection"}); randomTables.AddRow(new object[3]{"7", "Request For Rewrite", SubmissionMaster.CODE_NO_REPLY_YET}); randomTables.AddRow(new object[3]{"8", "Work Requested", @"rejection"}); }
private void CreateReplyFeedbackTable() { NoteDataXML_Table randomTables = new NoteDataXML_Table(100, 100, new ColumnDetails[3]{new ColumnDetails("id",100), new ColumnDetails("name",100), new ColumnDetails("code",100)} ); randomTables.Caption = SubmissionMaster.TABLE_ReplyFeedback; randomTables.GuidForNote = SubmissionMaster.TABLE_ReplyFeedback; // randomTables.Columns = Layout.AddNote(randomTables); randomTables.CreateParent(Layout); randomTables.AddRow(new object[3]{"1", "Form", SubmissionMaster.CODE_FEEDBACK1}); randomTables.AddRow(new object[3]{"2", "Personal", SubmissionMaster.CODE_FEEDBACK2}); randomTables.AddRow(new object[3]{"3", "Encouraging",SubmissionMaster.CODE_FEEDBACK3}); randomTables.AddRow(new object[3]{"4", "Almost",SubmissionMaster.CODE_FEEDBACK4}); }
public void GetValuesForTable() { _SetupForLayoutPanelTests (); Form form = new Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panel); // needed else DataGrid does not initialize form.Visible = false; form.Show (); //NOTE: For now remember that htis ADDS 1 Extra notes panel.NewLayout ("mynewpanel", true, null); NoteDataXML_Table test = new NoteDataXML_Table (425, 380); test.GuidForNote = "thisguid1"; test.Caption = "note1"; test.Columns = new ColumnDetails[3] { new ColumnDetails ("snakes", 109), new ColumnDetails ("fish", 90), new ColumnDetails ("goobers", 11111) }; test.AddRow(new object[3] {"1", "value1", "testA"}); test.AddRow(new object[3] {"2", "value2", "testB"}); test.AddRow(new object[3] {"3", "value3", "testC"}); panel.AddNote (test); test.CreateParent (panel); panel.SaveLayout (); List<string> cols = test.GetValuesForColumn (1,"*"); for (int i = 0; i <3; i++) { switch (i) { case 0: Assert.AreEqual(cols[i], "value1"); break; case 1:Assert.AreEqual(cols[i], "value2"); break; case 2: Assert.AreEqual(cols[i], "value3"); break; } } cols = test.GetValuesForColumn (2,"*"); for (int i = 0; i <3; i++) { switch (i) { case 0: Assert.AreEqual(cols[i], "testA"); break; case 1:Assert.AreEqual(cols[i], "testB"); break; case 2: Assert.AreEqual(cols[i], "testC"); break; } } }
protected override void DoBuildChildren(LayoutPanelBase Layout) { base.DoBuildChildren (Layout); CaptionLabel.Dock = DockStyle.Top; if (TableCreated == false) { Width = 500; Height = 200; ParentNotePanel.Width = Width; ParentNotePanel.Height = Height; TimelineStartDate = DateTime.Today; // A. Create the Table NoteDataXML_Table myTable = new NoteDataXML_Table (100, 100, new ColumnDetails[7]{ new ColumnDetails ("Date", 50), new ColumnDetails ("Type", 50), new ColumnDetails ("Data", 50), new ColumnDetails ("Data2", 50), new ColumnDetails ("Data3", 50), new ColumnDetails ("Data4", 50), new ColumnDetails ("icon", 50)}); string GuidOfTable = this.GuidForNote + "table"; myTable.GuidForNote = GuidOfTable; myTable.Caption = Loc.Instance.GetStringFmt ("Table for Timeline"); Layout.AddNote (myTable); // we do not need to call CreateParent because AddNote does it for us //myTable.CreateParent (Layout); Save (); myTable.AddRow (new object[7]{DateTime.Today.ToString (), "100", "Example Description", "Example Title", "", "", 2}); TableCreated = true; Save (); // B. Populate it with example Row } Timeline = new NotePanelTimeline (this); Timeline.Dock = DockStyle.Fill; ParentNotePanel.Controls.Add (Timeline); Timeline.dayPanelWidth = DayPanelWidth; Timeline.BringToFront (); RowFilterStrip = LayoutDetails.BuildMenuPropertyEdit (Loc.Instance.GetString ("Row Filter: {0}"), RowFilter, Loc.Instance.GetString ("Filter via the columns on the table associated with this timeline."), HandleRowFilterChange); ToolStripSeparator sep = new ToolStripSeparator (); ToolStripComboBox dropper = new ToolStripComboBox (); dropper.ToolTipText = Loc.Instance.GetString ("Set the type of timeline you want by selecting an appropriate calendar."); dropper.DropDownStyle = ComboBoxStyle.DropDownList; foreach (Calendar.calendertype calendertype in Enum.GetValues (typeof(Calendar.calendertype))) { dropper.Items.Add (calendertype.ToString ()); } dropper.Text = MCalendarType.ToString (); dropper.SelectedIndexChanged += HandleSelectedIndexCalendarPickerChanged; // Icons Per Column. We had the edit to a ToolStrip Host and add the Host to the toolstrip NumericUpDown numbers = new NumericUpDown (); Panel numbersPanel = new Panel (); numbersPanel.BackColor = dropper.BackColor; Label numbersLabel = new Label (); numbersLabel.Left = 0; //numbersLabel.Dock = DockStyle.Left; numbersLabel.Text = Loc.Instance.GetString ("Icons/Column: "); numbersLabel.AutoSize = false; numbersLabel.Width = 85; numbers.Left = 90; numbers.Width = 45; //numbersLabel.AutoSize = true; //numbers.Dock = DockStyle.Right; numbersPanel.Controls.Add (numbersLabel); numbersPanel.Controls.Add (numbers); numbersLabel.BringToFront (); //numbersPanel.Dock = DockStyle.Fill; numbers.Value = IconsPerColumn; numbers.ValueChanged += HandleIconsPerColumnValueChanged; numbers.Minimum = 1; numbers.Maximum = 20; ToolStripControlHost iconsPerColumn = new ToolStripControlHost (numbersPanel); // Day Width ToolStripControlHost setDayWidth = BuildDayWidth(dropper.BackColor); DateTimePicker dates = new DateTimePicker (); dates.Width = 125; try { dates.Value = this.TimelineStartDate; } catch (Exception) { dates.Value = DateTime.Today; } dates.ValueChanged += HandleValueCurrentdateChanged; ToolStripControlHost dateToolStrip = new ToolStripControlHost (dates); dateToolStrip.ToolTipText = Loc.Instance.GetString ("Select a date to center the timeline on that date."); properties.DropDownItems.Add (sep); properties.DropDownItems.Add (dropper); properties.DropDownItems.Add (iconsPerColumn); properties.DropDownItems.Add (setDayWidth); properties.DropDownItems.Add (RowFilterStrip); properties.DropDownItems.Add (dateToolStrip); // add hjistory to RowFilterStrip foreach (string history in RowHistory) { ToolStripMenuItem test = new ToolStripMenuItem (history); test.Click += delegate(object sender, EventArgs e){ RowFilter = RowFilterStrip.Text = test.Text; Timeline.Refresh();}; RowFilterStrip.DropDownItems.Add (test); } // // // Hide ZOom Panel // // ToolStripButton HideMonths = new ToolStripButton(); HideMonths.Text = Loc.Instance.GetString("Hide Months Panel"); HideMonths.CheckOnClick = true; HideMonths.Checked = this.HideZoomOutPanel; HideMonths.Click+= HandleHideMonthsClick; properties.DropDownItems.Add (HideMonths); // Adjust panel as needed; also add this to the menu too Timeline.HideZoomPanel(this.HideZoomOutPanel); }