Студопедия

Главная страница Случайная страница

КАТЕГОРИИ:

АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника






Програмування графічного користувацького інтерфейсу






Код для інтерфейсу:

Private Sub ButtonPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPrev.Click

DataGrid2.UnSelect(cManager.Position)

cManager.Position -= 1

DataGrid2.Select(cManager.Position)

current_P()

current_objects()

End Sub

Case 1

M.Id = nMaxId + 1

M.IdNmb = Me.CmbType.SelectedIndex + 1

M.NameOfModel = Me.TxtModel.Text

M.TypeOfTool = Me.CmbType.SelectedItem

M.Cost = Me.TxtCost.Text

M.Amount = Me.TxtAmount.Text

M.Country = Me.TxtCountry.Text

M.PictureM = Me.TxtPictureM.Text

arrModel.Add(New Model(M.Id, M.IdNmb, M.NameOfModel, M.TypeOfTool, M.Cost, M.Amount, M.Country, M.PictureM))

cManager.Position = arrModel.Count - 1

nMaxId = nMaxId + 1

Case 2

M.Id = CurrentModelNumber

M.IdNmb = Me.CmbType.SelectedIndex + 1

M.NameOfModel = Me.TxtModel.Text

M.TypeOfTool = Me.CmbType.SelectedItem

M.Cost = Me.TxtCost.Text

M.Amount = Me.TxtAmount.Text

M.Country = Me.TxtCountry.Text

M.PictureM = Me.TxtPictureM.Text

Dim Ab As New Model(M.Id, M.IdNmb, M.NameOfModel, M.TypeOfTool, M.Cost, M.Amount, M.Country, M.PictureM)

arrModel.Item(CurrentIndex) = Ab

End Select

RefreshObjects()

current_P()

current_objects()

ShowBoxes(False)

SaveAllToFile()

MsgBox(" Записи збережено")

End Sub

Private Sub SaveAllToFile()

Dim BW As BinaryWriter

Dim FS As FileStream

Dim aListEnum As IEnumerator

FS = New FileStream(".\officeequipment.dat", FileMode.Create, FileAccess.Write)

BW = New BinaryWriter(FS)

BW.BaseStream.Seek(0, SeekOrigin.Begin)

aListEnum = arrModel.GetEnumerator

While aListEnum.MoveNext

SaveRecord(BW, aListEnum.Current)

End While

BW.Close()

FS.Close()

FS = Nothing

End Sub

Private Sub SaveRecord(ByVal writer As BinaryWriter, ByVal record As Model)

writer.Write(record.Id)

writer.Write(record.IdNmb)

writer.Write(record.NameOfModel)

writer.Write(record.TypeOfTool)

writer.Write(record.Cost)

writer.Write(record.Amount)

writer.Write(record.Country)

writer.Write(record.PictureM)

End Sub

Private Sub BtnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFind.Click

Me.TxtSearchModel.Focus()

If bShowSearch = False Then

bShowSearch = True

BtnFind.Text = " Завершити пошук"

Me.GroupBoxForSerch.Enabled = True

Else

bShowSearch = False

BtnFind.Text = " Пошук"

Me.GroupBoxForSerch.Enabled = False

End If

RadioButton1.Checked = True

TxtSearchModel.Text = " "

TxtSearchCost.Text = " "

TxtSearchCountry.Text = " "

End Sub

Private Sub BtnDoSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDoSearch.Click

DataGrid2.UnSelect(cManager.Position)

If RadioButton1.Checked = True Then

nPos = Search(1, (Trim(Me.TxtSearchModel.Text)).ToUpper)

If Me.TxtSearchModel.Text = " " Then

MsgBox(" Не введено жодного значення для пошуку! ", MsgBoxStyle.Information, " УВАГА!!! ")

End If

End If

If RadioButton2.Checked = True Then

nPos = Search(2, (Trim(Me.TxtSearchCost.Text)).ToUpper)

If Me.TxtSearchCost.Text = " " Then

MsgBox(" Не введено жодного значення для пошуку! ", MsgBoxStyle.Information, " УВАГА!!! ")

End If

End If

If RadioButton3.Checked = True Then

nPos = Search(3, (Trim(Me.TxtSearchCountry.Text)).ToUpper)

If Me.TxtSearchCountry.Text = " " Then

MsgBox(" Не введено жодного значення для пошуку! ", MsgBoxStyle.Information, " УВАГА!!! ")

End If

End If

If nPos > = 0 Then

cManager.Position = nPos

DataGrid2.Focus()

DataGrid2.Select(nPos)

Else

MsgBox(" Запис не знайдено! ", MsgBoxStyle.Information, " УВАГА!!! ")

End If

End Sub

Private Function Search(ByVal bField As Integer, ByVal sStr As String) As Integer

Dim itm As Object, i As Integer

Dim CurA As New Model(0, 0, " ", " ", " ", 0, " ", " ")

Search = -1

i = -1

If bField = 1 Then

For Each itm In arrModel

i += 1

CurA = itm

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

TxtSearchModel.Enabled = True

TxtSearchModel.Focus()

TxtSearchCost.Enabled = False

TxtSearchCountry.Enabled = False

TxtSearchCost.Text = " "

TxtSearchCountry.Text = " "

End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

TxtSearchCost.Enabled = True

TxtSearchCost.Focus()

TxtSearchModel.Enabled = False

TxtSearchCountry.Enabled = False

TxtSearchCountry.Text = " "

TxtSearchModel.Text = " "

End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged

TxtSearchCountry.Enabled = True

TxtSearchCountry.Focus()

TxtSearchModel.Enabled = False

TxtSearchCost.Enabled = False

TxtSearchModel.Text = " "

TxtSearchCost.Text = " "

End Sub

Private Sub TxtAmount_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TxtAmount.Validating

If Not IsNumeric(TxtAmount.Text) Then

MsgBox(" У це поле слід вводити число! ")

TxtAmount.Text = " 1"

End If

End Sub

Private Sub DataGrid2_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles DataGrid2.Navigate

End Sub

(New ToolType(S.Id, S.TypeOfTool))

End While

Private Sub showbuttons(ByVal lAdd As Boolean, ByVal lDel As Boolean, ByVal lFind As Boolean, ByVal lEdit As Boolean, _

ByVal lSave As Boolean, ByVal lCancel As Boolean)

Me.BtnAdd.Enabled = lAdd

Me.BtnDel.Enabled = lDel

Me.BtnFind.Enabled = lFind

Me.BtnEdit.Enabled = lEdit

Me.BtnSave.Enabled = lSave

Me.BtnCancel.Enabled = lCancel

End Sub

Private Sub ButtonFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonFirst.Click

DataGrid1.UnSelect(cManager.Position)

cManager.Position = 0

DataGrid1.Select(cManager.Position)

current_P()

Current_objects()

End Sub

Private Sub ButtonPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPrev.Click

DataGrid1.UnSelect(cManager.Position)

cManager.Position -= 1

DataGrid1.Select(cManager.Position)

current_P()

Current_objects()

End Sub

Private Sub ButtonNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNext.Click

DataGrid1.UnSelect(cManager.Position)

cManager.Position += 1

DataGrid1.Select(cManager.Position)

current_P()

Current_objects()

End Sub

Private Sub ButtonLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLast.Click

DataGrid1.UnSelect(cManager.Position)

cManager.Position = arrTypes.Count - 1

DataGrid1.Select(cManager.Position)

current_P()

Current_objects()

End Sub

Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click

showbuttons(False, False, False, False, True, True)

DataGrid1.Enabled = False

Me.PlnNavigate.Enabled = False

nAddEdit = 1

ClearBoxes()

ShowBoxes(True)

Me.TxtTypeOfTool.Focus()

End Sub

Private Sub ShowBoxes(ByVal lShow)

Me.TxtTypeOfTool.ReadOnly = Not lShow

End Sub

Private Sub ClearBoxes()

Me.TxtId.Text = " "

Me.TxtTypeOfTool.Text = " "

End Sub

Private Sub ReturnOldContentsBoxes()

Current_objects()

End Sub

Private Sub BtnDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDel.Click

If MsgBox(" Поточний вид " + S.TypeOfTool + " буде видалено з файлу." + vbCrLf + " Продовжити? ", _

MsgBoxStyle.YesNo + MsgBoxStyle.Question, " Видалення виду") = MsgBoxResult.Yes Then

arrTypes.RemoveAt(CurrentIndex)

RefreshObjects()

If arrTypes.Count = 0 Then

S.Id = 1

S.TypeOfTool = " "

arrTypes.Add(New ToolType(S.Id, S.TypeOfTool))

Dim Ab As New ToolType(S.Id, S.TypeOfTool)

CurrentIndex = arrTypes.IndexOf(Ab)

CurrentTypeNumber = S.Id

End If

SaveAllToFile()

cManager.Position = 0

Current_objects()

MsgBox(" Запис видалено")

End If

End Sub

Private Sub RefreshObjects()

DataGrid1.DataSource = Nothing

DataGrid1.DataSource = arrTypes

cManager = CType(DataGrid1.BindingContext(arrTypes), CurrencyManager)

End Sub

Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSave.Click

If Len(Me.TxtTypeOfTool.Text) = 0 Then

MsgBox(" Не введено назви! ", MsgBoxStyle.Information, " Увага! ")

Me.TxtTypeOfTool.Focus()

Exit Sub

End If

showbuttons(True, True, True, True, False, False)

DataGrid1.Enabled = True

Me.PlnNavigate.Enabled = True

SaveToArrayList(nAddEdit)

nAddEdit = 0

End Sub

Private Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click

showbuttons(False, False, False, False, True, True)

DataGrid1.Enabled = False

Me.PlnNavigate.Enabled = False

nAddEdit = 2

ShowBoxes(True)

Me.TxtTypeOfTool.Focus()

End Sub

Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click

Current_objects()

End Sub

Private Sub SaveToArrayList(ByVal nAddEdit As Byte)

Select Case nAddEdit

Case 1

S.Id = nMaxId + 1

S.TypeOfTool = Me.TxtTypeOfTool.Text

arrTypes.Add(New ToolType(S.Id, S.TypeOfTool))

cManager.Position = arrTypes.Count - 1

nMaxId = nMaxId + 1

Case 2

S.Id = CurrentTypeNumber

S.TypeOfTool = Me.TxtTypeOfTool.Text

Me.TxtId.Text = S.Id

Me.TxtTypeOfTool.Text = S.TypeOfTool

Dim Ab As New ToolType(S.Id, S.TypeOfTool)

arrTypes.Item(CurrentIndex) = Ab

End Select

RefreshObjects()

current_P()

Current_objects()

ShowBoxes(False)

SaveAllToFile()

MsgBox(" Записи збережено")

End Sub

Private Sub SaveAllToFile()

Dim BW As BinaryWriter

Dim FS As FileStream

Dim aListEnum As IEnumerator

FS = New FileStream(".\Types.dat", System.IO.FileMode.Create, System.IO.FileAccess.Write)

BW = New BinaryWriter(FS)

BW.BaseStream.Seek(0, SeekOrigin.Begin)

aListEnum = arrTypes.GetEnumerator()

While aListEnum.MoveNext

SaveRecord(BW, aListEnum.Current)

End While

BW.Close()

FS.Close()

FS = Nothing

End Sub

Private Sub SaveRecord(ByVal writer As BinaryWriter, ByVal record As ToolType)

writer.Write(record.Id)

writer.Write(record.TypeOfTool)

End Sub

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged

current_P()

Current_objects()

End Sub

Private Sub BtnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFind.Click

If bShowSearch = False Then

GroupBoxForSerch.Enabled = True

bShowSearch = True

BtnFind.Text = " Завершити пошук"

Else

GroupBoxForSerch.Enabled = False

bShowSearch = False

BtnFind.Text = " Пошук"

End If

Me.TxtSearchTypeOfTool.Text = " "

Me.TxtSearchTypeOfTool.Focus()

End Sub

Private Sub BtnDoSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDoSearch.Click

DataGrid1.UnSelect(cManager.Position)

If Len(Me.TxtSearchTypeOfTool.Text) > 0 Then

nPos = Search(Trim((Me.TxtSearchTypeOfTool.Text).ToUpper))

If nPos > = 0 Then

cManager.Position = nPos

DataGrid1.Focus()

DataGrid1.Select(nPos)

Else

MsgBox(" Запис не знайдено", MsgBoxStyle.Information, " Увага! ")

End If

Else

MsgBox(" Не введено жодного значення" + " для пошуку", MsgBoxStyle.Information, " Увага! ")

End If

End Sub

Private Function Search(ByVal sStr As String) As Integer

Dim itm As Object, i As Integer

Dim CurA As New ToolType(0, " ")

Search = -1

i = -1

For Each itm In arrTypes

i += 1

CurA = itm

If String.Compare(sStr, 0, (CurA.TypeOfTool).ToUpper, 0, Len(sStr), False) = 0 Then

Search = i

Exit Function

End If

Next

End Function

Private Sub BtnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExit.Click

Me.Close()

End Sub

Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles DataGrid1.Navigate

End Sub

End Class

Висновки: У даній курсовій роботі я розробила систему автоматизації роботи меблевого магазину. Перед розробкою я знайшла декілька схожих систем. Я проаналізувала її, знайшла ряд переваг і недоліків, яких в першу чергу намагалась уникнути у своїй розробці - це, хоч красивий, але заплутаний і не приємний для щоденної роботи інтерфейс, та найгірше - це низька швидкодія системи. Потім я склала декілька моделей системи: спрощену, концептуальну. Після цього відповідно до представлених функціональних і не функціональних вимог була спроектована моя система, де були вказані основні модулі системи і їх функції.

Звичайно це ще не готовий для встановлення продукт, його потрібно вдосконалювати спеціалістам.

 

 

Список використаної літератури:

1. Рекомендации по преподаванию программной инженерии и информатики в университетах.–Computing Curricula-2001: Computer Science.–Пер. с англ. – Интернет– Ун. информац. технологий, М.: 2007.–462с.

2. Бабенко Л.П., Лавріщева К.М. Основи програмної інженерії.– Навч. посібник.–К.: Знання, 2001. –269 с.

3. Лаврищева Е.М., Грищенко В.Н. Области знаний программной инженерии – SWEBOK и подход к обучению этой дисциплине// Управляющие системы и машины.–2005. – №1.– С.38–54.

4. Pfleeger S.L. Software Engineering. Theory and practice. – Printice Hall: Upper Saddenle River, New Jersey, 1998. – 576 p.

5. Jacobson I. Object-Oriented Software Engineering. A use Case Driven Approach, Revised Printing. – New York: Addison-Wesley Publ. Co., 1994. – 529 p.

6. Иан Соммервил. Инженерия программного обеспечения. 6-е издание. – М.; Спб. – Киев, 2002. – 623 с.

7. Сайт: https://meblevysvit.com.ua/

 


Поделиться с друзьями:

mylektsii.su - Мои Лекции - 2015-2024 год. (0.032 сек.)Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав Пожаловаться на материал