Lampiran 3. Listing Program CIAFISH
1. Xaml Mainwindow
ribbon:RibbonWindow x:Class=Skripsi.MainWindow xmlns=http:schemas.microsoft.comwinfx2006xamlpres
entation xmlns:x=http:schemas.microsoft.comwinfx2006xaml
xmlns:ribbon=clr- namespace:Microsoft.Windows.Controls.Ribbon;assembly=
RibbonControlsLibrary Title=CIAFISH :: CALCULATION, INFORMATION
AND ANALYSIS OF FISHERIES Icon=Skripsi;componentImagesnewLogo.png
Background=White
x:Name=RibbonWindow Width=1000 Height=600
WindowStartupLocation=CenterScreen Window.CommandBindings
CommandBinding Command=NavigationCommands.GoToPage
Executed=GoToPageExecuteHandler CanExecute=GoToPageCanExecuteHandler
Window.CommandBindings Grid x:Name=LayoutRoot
Grid.RowDefinitions RowDefinition
Height=Auto RowDefinition Height= Grid.RowDefinitions ribbon:Ribbon
x:Name=Ribbon ribbon:Ribbon.ApplicationMenu
ribbon:RibbonApplicationMenu SmallImageSource=Images\Icons\table.ico
ribbon:RibbonApplicationMenuItem Header=New File ImageSource=Skripsi;componentImagesIconsnote.ico
x:Name=newFile ribbon:RibbonApplicationSplitMenuItem Header=New
File Pertumbuhan ImageSource=Skripsi;componentImagesIconstable.ico
ribbon:RibbonApplicationSplitMenuItem ribbon:RibbonApplicationSplitMenuItem Header=New
File Model Surplus Produksi ImageSource=Skripsi;componentImagesIconstable.ico
ribbon:RibbonApplicationSplitMenuItem ribbon:RibbonApplicationMenuItem
ribbon:RibbonApplicationMenuItem ImageSource=Skripsi;componentImagesIconssave.ico
Header=Save File ribbon:RibbonApplicationSplitMenuItem Header=Save
file pertumbuhan x:Name=saveFileP Click=saveFileP_Click
ImageSource=Images\Icons\save.icoribbon:RibbonAp plicationSplitMenuItem
ribbon:RibbonApplicationSplitMenuItem Header=Save file model surplus x:Name=saveFileM
Click=saveFileM_Click ImageSource=Images\Icons\save.icoribbon:RibbonAp
plicationSplitMenuItem ribbon:RibbonApplicationMenuItem
ribbon:RibbonApplicationMenuItem ImageSource=Skripsi;componentImagesIconsopen.ico
Header=Open File ribbon:RibbonApplicationSplitMenuItem
Header=Open file pertumbuhan x:Name=openFileP Click=openFileP_Click
ImageSource=Images\Icons\open.icoribbon:RibbonAp plicationSplitMenuItem
ribbon:RibbonApplicationSplitMenuItem Header=Open file model surplus x:Name=openFileM
Click=openFileM_Click ImageSource=Images\Icons\open.icoribbon:RibbonAp
plicationSplitMenuItem ribbon:RibbonApplicationMenuItem
ribbon:RibbonApplicationMenuItem Header=Close
x:Name=closeApps Click=closeApps_Click
ImageSource=Images\Icons\close.ico ribbon:RibbonApplicationMenu
ribbon:Ribbon.ApplicationMenu ribbon:RibbonTab x:Name=HomeTab
Header=Home ribbon:RibbonGroup x:Name=Pertumbuhan
Header=Pertumbuhan ribbon:RibbonButton x:Name=btnFormPertumbuhan
LargeImageSource=Skripsi;componentImagesIconstable .ico
Label=Form Pertumbuhan Command=NavigationCommands.GoToPage
CommandParameter=PagePagePertumbuhan.xaml CommandTarget={Binding ElementName=frmContent}
ribbon:RibbonGroup ribbon:RibbonGroup Header=Surplus Produksi
ribbon:RibbonButton LargeImageSource=Skripsi;componentImagesIconstable
.ico Label=Form Model Surplus Command=NavigationCommands.GoToPage
CommandParameter=PagePageModelSurplusProduksi.xa ml CommandTarget={Binding
ElementName=frmContent} ribbon:RibbonButton
ribbon:RibbonGroup ribbon:RibbonGroup x:Name=Bantuangroup
Header=Bantuan ribbon:RibbonButton x:Name=BtnHelp
LargeImageSource=Skripsi;componentImagesIconshelp. ico
Command=NavigationCommands.GoToPage CommandParameter=PagePageBantuan.xaml
CommandTarget={Binding ElementName=frmContent} ribbon:RibbonButton
ribbon:RibbonGroup ribbon:RibbonGroup x:Name=Informasi
Header=Informasi ribbon:RibbonButton x:Name=btnDeskripsi
Label=Deskripsi Aplikasi LargeImageSource=Skripsi;componentImagesIconsnote.
ico Command=NavigationCommands.GoToPage
CommandParameter=PagePageDeskripsi.xaml CommandTarget={Binding ElementName=frmContent}
ribbon:RibbonButton ribbon:RibbonButton x:Name=btnTentangPembuat
Label=Tentang Pengembang LargeImageSource=Skripsi;componentImagesIconsAbo
ut.ico Command=NavigationCommands.GoToPage
CommandParameter=PagePageTentang.xaml CommandTarget={Binding ElementName=frmContent}
ribbon:RibbonButton ribbon:RibbonGroup
ribbon:RibbonTab ribbon:Ribbon ScrollViewer x:Name=scrView
HorizontalScrollBarVisibility=Auto VerticalScrollBarVisibility=Auto Margin=0,136,0,0
Grid.RowSpan=2 Frame NavigationUIVisibility=Hidden
Name=frmContent Grid.RowSpan=2 Navigated=frmContent_Navigated Grid.Column=1
Lampiran 3. Listing Program CIAFISH lanjutan
ScrollViewer Grid
ribbon:RibbonWindow 2.
Mainwindow.xaml,cs
using System; using System.Collections.Generic;
using System.Globalization; using System.Linq;
using System.Text; using System.Windows;
using System.Windows.Controls; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Xml;
using Microsoft.Windows.Controls.Ribbon; using MessageBox = System.Windows.MessageBox;
using Microsoft.Win32; using System.Xml.Linq;
namespace Skripsi {
summary Interaction logic for MainWindow.xaml
summary public partial class MainWindow : RibbonWindow
{ public MainWindow
{ InitializeComponent;
this.Loaded += new RoutedEventHandlerMainWindow_Loaded;
Insert code required on object creation below this point.
} void MainWindow_Loadedobject sender,
RoutedEventArgs e {
frmContent.NavigationService.Navigatenew UriPagePageUtama.xaml, UriKind.Relative;
} private void GoToPageExecuteHandlerobject sender,
ExecutedRoutedEventArgs e { frmContent.NavigationService.Navigatenew
Uristringe.Parameter, UriKind.Relative; }
private void GoToPageCanExecuteHandlerobject sender, CanExecuteRoutedEventArgs e
{ e.CanExecute = true;
} private void frmContent_Navigatedobject sender,
NavigationEventArgs e {
} private void closeApps_Clickobject sender,
RoutedEventArgs e {
if MessageBox.Showapakah anda ingin keluar dari aplikasi ?,
konfirmasi, MessageBoxButton.YesNo == MessageBoxResult.Yes
{ this.Close;
} else
{} }
private void saveFileP_Clickobject sender, RoutedEventArgs e
{ Microsoft.Win32.SaveFileDialog save = new
Microsoft.Win32.SaveFileDialog; save.Filter = File .xml|.xml;
Nullablebool result = save.ShowDialog; Process open file dialog box results
if result == true { System.Xml.XmlTextWriter xmlwriter =
new System.Xml.XmlTextWritersave.FileName, null; xmlwriter.Formatting = Formatting.Indented;
xmlwriter.Indentation = 1; xmlwriter.IndentChar = \t;
xmlwriter.WriteStartDocument; xmlwriter.WriteCommentpertumbuhan +
DateTime.Now; xmlwriter.WriteStartElementdataroot;
AddDataAnotherxmlwriter; xmlwriter.WriteEndElement;
xmlwriter.Close; }
} public void AddDataAnotherXmlWriter xmlwriter
{ foreach Track item in DataAll.listDataPertumbuhan
{ xmlwriter.WriteStartElementpertumbuhan;
xmlwriter.WriteStartElementID; xmlwriter.WriteStringitem.ID.ToStringCultureInfo.Invaria
ntCulture.NumberFormat; xmlwriter.WriteEndElement; xmlwriter.WriteStartElementWaktu;
xmlwriter.WriteStringitem.Waktu; xmlwriter.WriteEndElement
xmlwriter.WriteStartElementNama_peneliti; xmlwriter.WriteStringitem.NamaPeneliti;
xmlwriter.WriteEndElement; xmlwriter.WriteStartElementNama_ikan;
xmlwriter.WriteStringitem.NamaIkan; xmlwriter.WriteEndElement;
xmlwriter.WriteStartElementPanjang; xmlwriter.WriteStringitem.Panjang.ToStringCultureInfo.In
variantCulture.NumberFormat; xmlwriter.WriteEndElement;
xmlwriter.WriteStartElementBerat; xmlwriter.WriteStringitem.Berat.ToStringCultureInfo.Inva
riantCulture.NumberFormat; xmlwriter.WriteEndElement;
xmlwriter.WriteStartElementJenis_kelamin; xmlwriter.WriteStringitem.Jenis_Kelamin;
xmlwriter.WriteEndElement; } MessageBox.ShowSave Complete;
} private void saveFileM_Clickobject sender,
RoutedEventArgs e {
Microsoft.Win32.SaveFileDialog save = new Microsoft.Win32.SaveFileDialog;
save.Filter = File .xml|.xml; Nullablebool result = save.ShowDialog;
Process open file dialog box results if result == true
{
Lampiran 3. Listing Program CIAFISH lanjutan
System.Xml.XmlTextWriter xmlwriter = new System.Xml.XmlTextWritersave.FileName, null;
xmlwriter.Formatting = Formatting.Indented; xmlwriter.Indentation = 1;
xmlwriter.IndentChar = \t; xmlwriter.WriteStartDocument;
xmlwriter.WriteCommentsurplusProduksi + DateTime.Now;
xmlwriter.WriteStartElementdataroot; AddDataAnotherxmlwriter;
xmlwriter.WriteEndElement; xmlwriter.Close; }
} public void AddDataAnotherMSPXmlWriter
xmlwriter {
foreach TrackMSP item in DataAll.listDataMSP
{ xmlwriter.WriteStartElementsurplusProduksi;
xmlwriter.WriteStartElementID; xmlwriter.WriteStringitem.ID.ToStringCultureInfo.Invaria
ntCulture.NumberFormat; xmlwriter.WriteEndElement;
xmlwriter.WriteStartElementNama_peneliti; xmlwriter.WriteStringitem.NamaPeneliti;
xmlwriter.WriteEndElement; xmlwriter.WriteStartElementNama_ikan;
xmlwriter.WriteStringitem.NamaIkan; xmlwriter.WriteEndElement;
xmlwriter.WriteStartElementTahun; xmlwriter.WriteStringitem.Tahun;
xmlwriter.WriteEndElement; xmlwriter.WriteStartElementCatch;
xmlwriter.WriteStringitem.Catch.ToStringCultureInfo.Inva riantCulture.NumberFormat;
xmlwriter.WriteEndElement; xmlwriter.WriteStartElementEffort;xmlwriter.WriteStrin
gitem.Effort.ToStringCultureInfo.InvariantCulture.Number Format; xmlwriter.WriteEndElement;
} }
private void openFileP_Clickobject sender, RoutedEventArgs e
{ Create OpenFileDialo
string filename; Microsoft.Win32.OpenFileDialog dlg = new
Microsoft.Win32.OpenFileDialog; Set filter for file extension and default file
extension dlg.DefaultExt = .xml;
dlg.Filter = XML Format CIAFISH .xml|.xml; Display OpenFileDialog by calling ShowDialog
method Nullablebool result = dlg.ShowDialog;
Get the selected file name and display in a TextBox
if result == true {
Open document filename = dlg.FileName;
XDocument doc = XDocument.Loadfilename; var data = from p in doc.Descendantspertumbuhan
let xElement = p.ElementID where xElement = null
let xElement3 = p.ElementWaktu where xElement3 = null
let element = p.ElementPanjang where element = null
let xElement1 = p.ElementBerat where xElement1 = null
let element1 = p.ElementTKG where element1 = null
let xElement2 = p.ElementJenis_kelamin where xElement2 = null
let element2 = p.ElementNama_peneliti where element2 = null
let element3 = p.ElementNama_ikan where element3 = null
select new Track {
ID = Convert.ToInt32xElement.Value, NamaPeneliti = element2.Value,
NamaIkan = element3.Value, Panjang = Double.Parseelement.Value,
CultureInfo.InvariantCulture.NumberFormat, Berat = Double.ParsexElement1.Value,
CultureInfo.InvariantCulture.NumberFormat, Waktu = xElement3.Value,
waktuDate = Convert.ToDateTimexElement3.Value, Jenis_Kelamin = xElement2.Value
}; DataAll.listDataPertumbuhan = data.ToList;
frmContent.NavigationService.Navigatenew UriPagePagePertumbuhan.xaml, UriKind.Relative;
} }
private void openFileM_Clickobject sender, RoutedEventArgs e
{ Create OpenFileDialo
string filename; Microsoft.Win32.OpenFileDialog dlg = new
Microsoft.Win32.OpenFileDialog; Set filter for file extension and default file
extension dlg.DefaultExt = .xml;
dlg.Filter = XML Format CIAFISH .xml|.xml; Display OpenFileDialog by calling ShowDialog
method Nullablebool result = dlg.ShowDialog;
Get the selected file name and display in a TextBox
if result == true {
Open document filename = dlg.FileName;
XDocument doc = XDocument.Loadfilename; var dataMSP = from p in
doc.DescendantssurplusProduksi let xElement = p.ElementID
where xElement = null let xElement4 = p.ElementNamaPeneliti
where xElement4 = null let xElement5 = p.ElementNamaIkan
where xElement5 = null let xElement3 = p.ElementTahun
where xElement3 = null let xElement2 = p.ElementCatch
where xElement2 = null let xElement1 = p.ElementEffort
where xElement1 = null select new TrackMSP {
ID = Convert.ToInt32xElement.Value, NamaPeneliti = xElement4.Value,
NamaIkan = xElement5.Value, Tahun = xElement3.Value, Catch
= Convert.ToDoublexElement2.Value, CultureInfo.InvariantCulture.NumberFormat,
Effort = Convert.ToDoublexElement1.Value, CultureInfo.InvariantCulture.NumberFormat,
}; taAll.listDataMSP = dataMSP.ToList;
frmContent.NavigationService.Navigatenew UriPagePageModelSurplusProduksi.xaml,
UriKind.Relative; }
} }
}
3. XAML Form Pertumbuhan