source: extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.cs @ 31945

Last change on this file since 31945 was 30536, checked in by kenl, 9 years ago

Version 1.4

File size: 4.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using System.Globalization;
10using System.Threading;
11
12namespace Picasa2Piwigo
13{
14    using Picasa2PiwigoCommonFunctions;
15    public partial class OptionsForm : Form
16    {       
17        public OptionsForm()
18        {
19            CultureInfo ci;
20            ci = new CultureInfo(Thread.CurrentThread.CurrentCulture.Name);
21            Thread.CurrentThread.CurrentUICulture = ci;
22            Thread.CurrentThread.CurrentCulture = ci;
23            if (Picasa2PiwigoConstants.constants.DEBUG_LOCALE)
24            {
25#pragma warning disable 0162
26                Thread.CurrentThread.CurrentUICulture = new CultureInfo(Picasa2PiwigoConstants.constants.SET_LOCALE);
27#pragma warning restore 0162
28            }
29                InitializeComponent();         
30        }
31
32        private void OptionsForm_Load(object sender, EventArgs e)
33        {
34            this.ACancelButton.Text = WinFormStrings.OFCancelButtonStrRes;
35            this.Text = WinFormStrings.OFCaption;
36            this.label1.Text = WinFormStrings.OFlabel1StrRes;
37            this.label2.Text = WinFormStrings.OFlabel2StrRes;
38            this.label3.Text = WinFormStrings.OFlabel3StrRes;
39            this.label8.Text = WinFormStrings.OFlabel8StrRes;
40            this.OKButton.Text = WinFormStrings.OFOKButtonStrRes;
41            this.SetContactPathBtn.Text = WinFormStrings.OFSetContactPathBtn;           
42           
43            PiwigoURLTextbox.Text = FormSettings.Default.PiwigoUrlSetting;
44            PiwigoUserNameTextBox.Text = FormSettings.Default.PiwigoUserName;
45            PiwigoPasswordTextBox.Text = FormSettings.Default.PiwigoPassword;
46            PicasaContactsFileTextBox.Text = FormSettings.Default.PicasaContactsLocation;
47            DebugtextBox.Text = FormSettings.Default.DebugFileLocation;
48            LogEnabled.Checked = FormSettings.Default.DebugEnabled;
49
50
51            LabelAdjust AdjustLabelClass = new LabelAdjust();
52            AdjustLabelClass.AdjustLabelSize(label1);
53            AdjustLabelClass.AdjustLabelSize(label2);
54            AdjustLabelClass.AdjustLabelSize(label3);
55            AdjustLabelClass.AdjustLabelSize(label8);
56            AdjustLabelClass.AdjustButtonSize(OKButton);
57            AdjustLabelClass.AdjustButtonSize(ACancelButton);
58            AdjustLabelClass.AdjustButtonSize(SetContactPathBtn);
59        }
60
61        private void OKButton_Click(object sender, EventArgs e)
62        {
63            FormSettings.Default.PiwigoUrlSetting = PiwigoURLTextbox.Text;
64            FormSettings.Default.PiwigoUserName = PiwigoUserNameTextBox.Text;
65            FormSettings.Default.PiwigoPassword = PiwigoPasswordTextBox.Text;
66            FormSettings.Default.PicasaContactsLocation = PicasaContactsFileTextBox.Text;
67            FormSettings.Default.DebugFileLocation = DebugtextBox.Text;
68            FormSettings.Default.DebugEnabled = LogEnabled.Checked;
69            FormSettings.Default.Save();
70            this.DialogResult = DialogResult.OK;
71            this.Close();
72        }
73
74        private void ACancelButton_Click(object sender, EventArgs e)
75        {
76            this.DialogResult = DialogResult.No;
77            this.Close();
78        }
79
80        private void SetContactPathBtn_Click(object sender, EventArgs e)
81        {
82            OpenFileDialog openFile1 = new OpenFileDialog();
83            openFile1.Filter = "XML Files|*.xml";
84            if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
85            {
86                PicasaContactsFileTextBox.Text = openFile1.FileName;               
87            }
88        }
89
90        private void SetDebugPathBtn_Click(object sender, EventArgs e)
91        {
92            SaveFileDialog openFile1 = new SaveFileDialog();
93            openFile1.Filter = "Text Files|*.txt";
94            if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
95            {
96                DebugtextBox.Text = openFile1.FileName;
97            }
98
99        }
100    }
101}
Note: See TracBrowser for help on using the repository browser.