예제 #1
0
        public Form1(Data data, ItemChecker ItemC, StartForm startform)
        {
            serialize = new Serialize();
            this.Data = data;
            this.Startform = startform;
            this.itemchecker = ItemC;
            this.GuiC = new GUIControl(this.itemchecker);

            InitializeComponent();
            this.Text = data.getfilename() + " - MCItemChecker";
            GuiC.UpdateListview(lvitems, itemchecker.Items);

            lvitems.ListViewItemSorter = GuiC.ColumnSorter;

            Initlvitems();
            Initlvsubitems();
            Initlvcalculateitems();

            UpdateModPackControls();
            UpdateItemTypeControls();
            cbfiltertype.SelectedItem = "-";
            cbsearchmodpack.SelectedItem = "-";
            cbsearchtype.SelectedItem = "-";

            litemid.Text = "";
            litemname.Text = "";
            litemtype.Text = "";
            lmodpack.Text = "";
        }
예제 #2
0
 /// <summary>
 /// Initialises the Form1 class.
 /// </summary>
 /// <param name="d">The Data Class</param>
 /// <param name="i">The ItemChecker Class</param>
 public void GoToMainForm(Data d, ItemChecker i)
 {
     if (d == null)
     {
         MessageBox.Show("The data file wasn't loaded properly, try restarting", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (i == null)
     {
         MessageBox.Show("The .item file wasn''t loaded properly, try re-opening", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Mainform = new Form1(data, ItemC, this);
         this.Hide();
         Mainform.Show();
     }
 }
예제 #3
0
 /// <summary>
 /// Checks if the directory and data file are available. Will attempt to create the both when missing.
 /// </summary>
 /// <returns>Returns false when either the directory or file couldn't be created</returns>
 private Boolean CheckLoad()
 {
     //Checks if the file already exists or not.
     if (!serializeData.FileExists(serializeData.DefaultDataPath))
     {
         //Checks if the directory already exists or not.
         if (!serializeData.DirectoryExists(Directory.GetCurrentDirectory() + serializeData.DefaultMap))
         {
             //Checks if the directory can be created or not.
             if (!serializeData.CreateDirectory(Directory.GetCurrentDirectory() + serializeData.DefaultMap))
             {
                 MessageBox.Show("Could not create a directory for the data file(s) needed" + Environment.NewLine + "Make sure you have enough rights to create a directory in:" + Environment.NewLine + serializeData.Dir, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return false;
             }
         }
         //Tries to create a new data file if it doesn't exist yet.
         data = new Data();
         if (!serializeData.SaveFile(data, serializeData.DefaultDataPath))
         {
             data = null;
             MessageBox.Show("Could not create a new data file" + Environment.NewLine + "Make sure you have enough rights to create this file in:" + Environment.NewLine + serializeData.Dir, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return false;
         }
     }
     else
     {
         //Tries to load the data file into the data class.
         if (serializeData.LoadData(serializeData.DefaultDataPath) != null)
         {
             data = serializeData.LoadData(serializeData.DefaultDataPath);
             return true;
         }
         return false;
     }
     return false;
 }