コード例 #1
0
ファイル: Form1.cs プロジェクト: jomarko/FinanceManager
        public MainWindow()
        {
            InitializeComponent();
            manager = new ItemManager();
            listViewItems.ListViewItemSorter = new LVIComparator();

            filter = null;
            filename = null;
            ChangesSaved(true);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: jomarko/FinanceManager
 private void ClearAll()
 {
     balance = 0;
     manager = new ItemManager();
     filter = null;
     filename = null;
     ChangesSaved(false);
     txtDescription.Text = "";
     FilterLVI();
     chart1.Visible = false;
     toolStrip1.Items[5].Enabled = false; // edit
     toolStrip1.Items[6].Enabled = false; // remove
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: jomarko/FinanceManager
        private void OpenFileProcess()
        {
            DialogResult res = DialogResult.No;

            if (!changesSaved) res = MessageBox.Show("All changes will bee lost, continue?", "Open file", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (res == DialogResult.Yes || changesSaved)
            {
                openFileDialog.InitialDirectory = Directory.GetCurrentDirectory();
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    ItemManager manBackup = manager;
                    ItemFilter filtBackup = filter;
                    bool savedBackup = changesSaved;
                    String fileBackup = filename;
                    ClearAll();
                    if (manager.LoadItems(openFileDialog.FileName))
                    {
                        filename = openFileDialog.FileName;
                        ChangesSaved(true);
                    }
                    else
                    {
                        MessageBox.Show("Wrong input file", "Wrong file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        manager = manBackup;
                        filter = filtBackup;
                        if (filter != null) sStripFiltLab.Text = "Filter: active";
                        filename = fileBackup;
                        ChangesSaved(savedBackup);
                    }

                    ClearAndFillLVI();
                    FilterLVI();
                }
            }
        }