|
-
Aug 5th, 2004, 03:58 PM
#1
Thread Starter
Junior Member
saving information in a binary file
I am having trouble creating a binary file that will contain information that will load up when the application is loaded up. Basically, the idea is that you select a Heuristic Set in the combo box. Then that set has rules that make that set up and show up in the listbox. Now, when each rule is highlighted or selected in the listbox, a description of it and some research info is to be seen in text boxes. So far I have this code. I don't know if this is enough info, but here it is right now.
Public Class HeuristicEditorForm
Inherits System.Windows.Forms.Form
Private fileModified As Boolean
Private heuristicEditor As HeuristicEditorForm
Private openingForm As OpeningForm
Private researchForm As ResearchForm
Private Projects As ArrayList
Private currProject As Integer
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
heuristicEditor = New HeuristicEditorForm
openingForm = New OpeningForm
openingForm.Owner = Me
'openingForm.ShowDialog()
researchForm = New ResearchForm
fileModified = False
Projects = New ArrayList
Projects.Add(New Project("Project 1"))
'Add any initialization after the InitializeComponent() call
cmboHeuristics.SelectedIndex = 1
ListBox1.SelectedIndex = 0
currProject = 0
'----------------------------------------------------
'Test out save and load
' just for testing purposes, this will be taken out later
Dim p As Project = New Project("Google")
Dim index As Integer
Dim h As New Heuristic
h.Name = "Visibility of System Status"
h.IsSelected = True
h.Description = "You should be able to see stuff....."
h.Research = "They researched junk on visibility....woo hoo."
p.AddHeuristic("Nielsen's", h)
h = New Heuristic
h.Name = "Match Between System and the Real World"
h.IsSelected = False
h.Description = "The system should speak the users' language, with words, " & _
"phrases, and concepts familiar to the user, rather than " & _
"system-oriented terms. Follow real-world conventions, " & _
"making information appear in a natural and logical order."
h.Research = "Larson, K., & Czerwinski, M. (1998). Web page design: Implications " & _
"of memory, structure, and scent for information retrieval" & Environment.NewLine & _
"http://www.research.microsoft.com/users/marycz/chi981.htm"
p.AddHeuristic("Nielsen's", h)
h = New Heuristic
h.Name = "User Control and Freedom"
h.IsSelected = False
h.Description = "User should have lots of control and freedom..."
h.Research = "yup...research."
p.AddHeuristic("Test", h)
p.Save("test.het")
Projects.Add(p)
currProject = 1
Debug.WriteLine("done loading")
' done with testing
'--------------------------------------------------
End Sub
Private createNew As New createNew
Private editHeuristic As New editHeuristic
Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDone.Click
Me.Hide()
End Sub
Private Sub btnDeleteSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteSet.Click
MessageBox.Show("Are you sure you want to delete the set of heuristics and all associated details?", "Heuristic Evaluation Tool", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
End Sub
Private Sub btnCreateSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateSet.Click
createNew.ShowDialog()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
editHeuristic.ShowDialog()
End Sub
Public Function GetCurrentProject() As Project
If currProject > NumProjects Then
Return Nothing
End If
Return CType(Projects(currProject), Project)
End Function
Public Property NumProjects()
Get
Return Projects.Count
End Get
Set(ByVal Value)
If Value = 0 Then
Projects.Clear()
Else
Dim p(Value - 1) As Project
Projects = New ArrayList(p)
End If
End Set
End Property
Private Sub cmboHeuristics_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmboHeuristics.SelectedIndexChanged
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim name As String = ListBox1.SelectedIndex.ToString()
If cmboHeuristics.SelectedIndex >= GetCurrentProject().NumHeuristicSets Then
Exit Sub
End If
With GetCurrentProject().GetHeuristicSet(cmboHeuristics.SelectedIndex)
For i As Integer = 0 To .NumHeuristics - 1
If name = .GetHeuristic(i).Name Then
txtDescription.Text = .GetHeuristic(i).Description
txtHeuristicName.Text = .GetHeuristic(i).Name
txtResearch.Text = .GetHeuristic(i).Research
End If
Next
End With
'txtHeuristicName.Text = ListBox1.SelectedItem()
End Sub
Thanks for anyone who can take the time and look through this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|