コード例 #1
0
        public FormMainHeb()
        {
            InitializeComponent();

            //set localization strings
            AdvancedDataGridView.SetTranslations(AdvancedDataGridView.LoadTranslationsFromFile("heb.json"));
            AdvancedDataGridViewSearchToolBar.SetTranslations(AdvancedDataGridViewSearchToolBar.LoadTranslationsFromFile("heb.json"));

            //set filter and sort saved
            _filtersaved.Add(0, "");
            _sortsaved.Add(0, "");
            comboBox_filtersaved.DataSource    = new BindingSource(_filtersaved, null);
            comboBox_filtersaved.DisplayMember = "Key";
            comboBox_filtersaved.ValueMember   = "Value";
            comboBox_filtersaved.SelectedIndex = -1;
            comboBox_sortsaved.DataSource      = new BindingSource(_sortsaved, null);
            comboBox_sortsaved.DisplayMember   = "Key";
            comboBox_sortsaved.ValueMember     = "Value";
            comboBox_sortsaved.SelectedIndex   = -1;

            //initialize dataset
            _dataTable = new DataTable();
            _dataSet   = new DataSet();

            //initialize bindingsource
            bindingSource_main.DataSource = _dataSet;

            //initialize datagridview
            advancedDataGridView_main.SetDoubleBuffered();
            advancedDataGridView_main.DataSource = bindingSource_main;

            //set bindingsource
            SetTestData();
        }
コード例 #2
0
        public FormMain()
        {
            InitializeComponent();

            //set localization strings
            Dictionary <string, string> translations = new Dictionary <string, string>();

            foreach (KeyValuePair <string, string> translation in AdvancedDataGridView.Translations)
            {
                if (!translations.ContainsKey(translation.Key))
                {
                    translations.Add(translation.Key, "." + translation.Value);
                }
            }
            foreach (KeyValuePair <string, string> translation in AdvancedDataGridViewSearchToolBar.Translations)
            {
                if (!translations.ContainsKey(translation.Key))
                {
                    translations.Add(translation.Key, "." + translation.Value);
                }
            }
            if (_testtranslations)
            {
                AdvancedDataGridView.SetTranslations(translations);
                AdvancedDataGridViewSearchToolBar.SetTranslations(translations);
            }
            if (_testtranslationsFromFile)
            {
                AdvancedDataGridView.SetTranslations(AdvancedDataGridView.LoadTranslationsFromFile("lang.json"));
                AdvancedDataGridViewSearchToolBar.SetTranslations(AdvancedDataGridViewSearchToolBar.LoadTranslationsFromFile("lang.json"));
            }

            //set filter and sort saved
            _filtersaved.Add(0, "");
            _sortsaved.Add(0, "");
            comboBox_filtersaved.DataSource    = new BindingSource(_filtersaved, null);
            comboBox_filtersaved.DisplayMember = "Key";
            comboBox_filtersaved.ValueMember   = "Value";
            comboBox_filtersaved.SelectedIndex = -1;
            comboBox_sortsaved.DataSource      = new BindingSource(_sortsaved, null);
            comboBox_sortsaved.DisplayMember   = "Key";
            comboBox_sortsaved.ValueMember     = "Value";
            comboBox_sortsaved.SelectedIndex   = -1;

            //initialize dataset
            _dataTable = new DataTable();
            _dataSet   = new DataSet();

            //initialize bindingsource
            bindingSource_main.DataSource = _dataSet;

            //initialize datagridview
            advancedDataGridView_main.SetDoubleBuffered();
            advancedDataGridView_main.DataSource = bindingSource_main;

            //set bindingsource
            SetTestData();
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: zainadan/dentned
        /// <summary>
        /// Load handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMain_Load(object sender, EventArgs e)
        {
            //perform the first connection
            try
            {
                DentneDModel dentnedModel = new DentneDModel();
                dentnedModel.Doctors.Find(-1);
            }
            catch
            {
                MessageBox.Show("Database connection error. This application will be closed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }

            //clean temporary folder
            if (Convert.ToBoolean(ConfigurationManager.AppSettings["cleanTmpdirAtStartup"]))
            {
                string[] messages = new string[] { };
                string[] errors   = new string[] { };
                try
                {
                    CleanDir.CleanTmpdir(ConfigurationManager.AppSettings["tmpdir"], false, -4, ref messages, ref errors);
                }
                catch { }
            }

            //set startup size
            try
            {
                Match sizeOnStartup = Regex.Match(ConfigurationManager.AppSettings["sizeOnStartup"], @"^(?<w>\d*)x(?<h>\d*)(?<m>M*)$");
                if (sizeOnStartup.Success)
                {
                    int width  = Convert.ToInt16(sizeOnStartup.Groups[1].Value);
                    int height = Convert.ToInt16(sizeOnStartup.Groups[2].Value);
                    if (width > Screen.PrimaryScreen.WorkingArea.Width)
                    {
                        width = Screen.PrimaryScreen.WorkingArea.Width - 5;
                    }
                    if (height > Screen.PrimaryScreen.WorkingArea.Height)
                    {
                        height = Screen.PrimaryScreen.WorkingArea.Height - 5;
                    }
                    this.Size = new Size(width, height);
                    this.CenterToScreen();
                    if (!String.IsNullOrEmpty(sizeOnStartup.Groups[3].Value))
                    {
                        this.WindowState = FormWindowState.Maximized;
                    }
                }
            }
            catch { }

            //set AdvancedDataGridView translations
            AdvancedDataGridView.SetTranslations(AdvancedDataGridView.LoadTranslationsFromFile(Program.uighfApplication.LanguageFilename));
            AdvancedDataGridViewSearchToolBar.SetTranslations(AdvancedDataGridViewSearchToolBar.LoadTranslationsFromFile(Program.uighfApplication.LanguageFilename));
        }
コード例 #4
0
ファイル: FormMain.cs プロジェクト: zainadan/dentned
        /// <summary>
        /// Add additional language
        /// </summary>
        public override void SetAdditionalLanguage()
        {
            //set models languages
            DentneDModel dentnedModel = new DentneDModel();

            dentnedModel.LanguageHelper.LoadFromFile(Program.uighfApplication.LanguageFilename);
            LanguageHelper.AddAdditionalLanguage(dentnedModel.LanguageHelper.Get());
            //set AdvancedDataGridView languages
            LanguageHelper.AddAdditionalLanguage(AdvancedDataGridView.LoadTranslationsFromFile(Program.uighfApplication.LanguageFilename));
            LanguageHelper.AddAdditionalLanguage(AdvancedDataGridViewSearchToolBar.LoadTranslationsFromFile(Program.uighfApplication.LanguageFilename));
        }