예제 #1
0
 public ListViewUserControl(WindowState state)
 {
     InitializeComponent();
     State  = state;
     source = new ListViewDataSource(State);
     State.BindFile(GotFile);
     listView.DataSource = listBindingSource;
     listView.DataBindings.Add("SelectedIndex", source, "SelectedIndex");
 }
예제 #2
0
 public EditViewUserControl(WindowState state)
 {
     InitializeComponent();
     State  = state;
     source = new EditViewDataSource(state);
     State.BindFile(GotFile);
     State.BindFrontCard(GotCard);
     cardIndexListBox.DisplayMember = "Index";
     cardIndexListBox.DataSource    = listBindingSource;
     cardIndexListBox.DataBindings.Add(new Binding("SelectedIndex", source, "SelectedIndex", false, DataSourceUpdateMode.OnPropertyChanged));
 }
예제 #3
0
        public MainForm()
        {
            InitializeComponent();
            Settings.Default.Reload();

            State = new WindowState(this);
            views = new Dictionary <ViewMode, ViewInfo>()
            {
                { ViewMode.Card, new ViewInfo("CardView", new CardViewUserControl(State)) },
                { ViewMode.Edit, new ViewInfo("EditView", new EditViewUserControl(State)) },
                { ViewMode.File, new ViewInfo("AttachmentView", new FileViewUserControl(State)) },
                { ViewMode.List, new ViewInfo("ListView", new ListViewUserControl(State)) }
            };
            NewFile();

            Language.LanguageChanged += Localization_LanguageChanged;
            State.PropertyChanged    += State_PropertyChanged;
            State.FileClosed         += State_FileClosed;
            AddBindings();
            foreach (ViewInfo uc in views.Values)
            {
                uc.Control.Visible = false;
                uc.Control.Dock    = DockStyle.Fill;
                viewPanel.Controls.Add(uc.Control);
            }

            indexDialog                     = new IndexDialog();
            optionsDialog                   = new OptionsDialog();
            goToDialog                      = new GoToDialog();
            customPageSetupDialog           = new CustomPageSetupDialog();
            openSearchDialogs               = new Dictionary <Cardfile, SearchDialog>();
            searchFile                      = null;
            openDialog                      = new OpenFileDialog();
            saveDialog                      = new SaveFileDialog();
            importAttachmentDialog          = new OpenFileDialog();
            exportAttachmentDialog          = new SaveFileDialog();
            openDialog.FileName             = "";
            saveDialog.FileName             = "";
            importAttachmentDialog.FileName = "";
            saveDialog.Title                = Language.GetMenuText("fileSaveAsToolStripMenuItem.Text");
            findRtfBox                      = new RichTextBox();

            printDocument = new PrintDocument();
            printPreviewDialog.Document         = printDocument;
            pageSetupDialog.Document            = printDocument;
            printDocument.BeginPrint           += PrintDocument_BeginPrint;
            printDocument.PrintPage            += PrintDocument_PrintPage;
            customPageSetupDialog.DefaultDialog = pageSetupDialog;

            ApplySettings();
            State.BindFile(GotFile);
            cardPrinter = new CardPrinter(State, false);
        }
예제 #4
0
 public FileViewUserControl(WindowState state)
 {
     InitializeComponent();
     State           = state;
     fileUpdatePairs = new Dictionary <string, Card>();
     State.BindFile(GotFile);
     State.BindFrontCard(GotCard);
     panelFilePreview.Resize += PanelFilePreview_Resize;
     iconImageList.Images.Add(SystemIcons.WinLogo);
     Disposed         += OnDispose;
     textBoxIndex.Font = new Font(FontFamily.GenericMonospace, textBoxIndex.Font.Size);
     fileUpdateDialog.UpdateRequest       += FileUpdateDialog_UpdateRequest;
     fileSystemWatcher.EnableRaisingEvents = false;
     fileSystemWatcher.NotifyFilter        = NotifyFilters.LastWrite | NotifyFilters.Size;
     listViewFile.Resize += (s, e) => RecenterIcon();
 }
예제 #5
0
 public CardViewUserControl(WindowState state)
 {
     InitializeComponent();
     State        = state;
     cardControls = new List <CardUserControl>();
     State.BindFile(GotFile);
     this.Resize        += (s, e) => OnResize();
     this.DoubleBuffered = true;
     FullLayout();
     OptionHandler.OptionsUpdated += (s, e) => {
         foreach (CardUserControl uc in cardControls)
         {
             uc.ResizeTo(OptionHandler.CardWidth, OptionHandler.CardHeight);
         }
         FullCardMove();
     };
 }