1 /*
2  *  "GEDKeeper", the personal genealogical database editor.
3  *  Copyright (C) 2009-2018 by Sergey V. Zhdanovskih.
4  *
5  *  This file is part of "GEDKeeper".
6  *
7  *  This program is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 using System;
22 using GKCore;
23 using GKCore.Controllers;
24 using GKCore.Interfaces;
25 using GKCore.MVP.Views;
26 using GKUI.Components;
27 
28 namespace GKUI.Forms
29 {
30     public sealed partial class TTPlacesManagerDlg : CommonDialog, IPlacesManagerDlg
31     {
32         private readonly PlacesManagerController fController;
33 
34         private GKListView ListPlaces;
35 
36         #region View Interface
37 
38         IListViewEx IPlacesManagerDlg.PlacesList
39         {
40             get { return ListPlaces; }
41         }
42 
43         #endregion
44 
TTPlacesManagerDlg(IBaseWindow baseWin)45         public TTPlacesManagerDlg(IBaseWindow baseWin)
46         {
47             InitializeComponent();
48 
49             btnClose.Image = UIHelper.LoadResourceImage("Resources.btn_cancel.gif");
50 
51             fController = new PlacesManagerController(this);
52             fController.Init(baseWin);
53 
54             ListPlaces = new GKListView();
55             ListPlaces.MouseDoubleClick += ListPlaces_DblClick;
56             ListPlaces.AddColumn(LangMan.LS(LSID.LSID_Place), 400, false);
57             ListPlaces.AddColumn(LangMan.LS(LSID.LSID_LinksCount), 100, false);
58             panPlacesContainer.Content = ListPlaces;
59 
60             SetLocale();
61         }
62 
Dispose(bool disposing)63         protected override void Dispose(bool disposing)
64         {
65             if (disposing) {
66                 fController.Clear();
67             }
68             base.Dispose(disposing);
69         }
70 
SetLocale()71         public void SetLocale()
72         {
73             Title = LangMan.LS(LSID.LSID_ToolOp_9);
74             pagePlaceManage.Text = LangMan.LS(LSID.LSID_ToolOp_9);
75             btnClose.Text = LangMan.LS(LSID.LSID_DlgClose);
76             btnIntoList.Text = LangMan.LS(LSID.LSID_InsertIntoBook);
77             btnAnalysePlaces.Text = LangMan.LS(LSID.LSID_Analyze);
78         }
79 
btnAnalysePlaces_Click(object sender, EventArgs e)80         private void btnAnalysePlaces_Click(object sender, EventArgs e)
81         {
82             fController.CheckPlaces();
83         }
84 
btnIntoList_Click(object sender, EventArgs e)85         private void btnIntoList_Click(object sender, EventArgs e)
86         {
87             fController.CreateLocationRecord(ListPlaces.GetSelectedItems());
88         }
89 
ListPlaces_DblClick(object sender, EventArgs e)90         private void ListPlaces_DblClick(object sender, EventArgs e)
91         {
92             fController.CreateLocationRecord(ListPlaces.GetSelectedItems());
93         }
94     }
95 }
96