示例#1
0
 private void mOpenProfileButton_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult nResult = this.mOpenFileDialog.ShowDialog();
         if (nResult == DialogResult.OK)
         {
             Profile nProfile = Serializer.GetObjectFromFile <Profile>(this.mOpenFileDialog.FileName);
             nProfile.Filename = this.mOpenFileDialog.FileName;
             ProfileController.getInstance().Init(nProfile);
             RegistryController.Add(this.mOpenFileDialog.FileName);
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
     catch (IOException)
     {
     }
 }
示例#2
0
        private void mRecentListview_ItemActivate(object sender, EventArgs e)
        {
            ListViewItem item = ((ListView)sender).FocusedItem;

            if (File.Exists(item.Text))
            {
                Profile nProfile = Serializer.GetObjectFromFile <Profile>(item.Text);
                nProfile.Filename = item.Text;
                ProfileController.getInstance().Init(nProfile);
                RegistryController.Add(this.mOpenFileDialog.FileName);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                RegistryController.Remove(item.Text);
                PopulateRecents();
            }
        }
示例#3
0
        private bool SaveFile(bool aSaveAs = false)
        {
            try
            {
                if (this.mTransactionOLV.Items.Count <= 0)
                {
                    MessageBox.Show("Nothing to save!");
                    return(false);
                }

                if (String.IsNullOrEmpty(this.Profile.Filename) || aSaveAs)
                {
                    DialogResult nResult = this.mSaveFileDialog.ShowDialog();
                    if (nResult == DialogResult.OK)
                    {
                        this.Profile.Filename = this.mSaveFileDialog.FileName;
                    }
                    else
                    {
                        return(false);
                    }
                }

                ProfileController.getInstance().SaveRecords(this.RecordModel);
                ProfileController.getInstance().SaveCodes(this.CodeModel);
                ProfileController.getInstance().Save(this.Profile.Filename);
                RegistryController.Add(this.Profile.Filename);
                this.mStatusLabel.Text = "Saved";

                return(true);
            }
            catch (IOException)
            {
                return(false);
            }
        }