コード例 #1
0
ファイル: MainForm.cs プロジェクト: lp6m/SSLand
        private void AddSecondStreetItemPanel(SecondStreetListItem item)
        {
            SecondStreetItemPanel panel = new SecondStreetItemPanel(item);

            panel.Tag     = item;
            panel.TabStop = false;
            this.flowLayoutPanel1.Controls.Add(panel);
            this.flowLayoutPanel1.AutoScrollPosition = new Point(0, 0);
            if (SettingForm.getAutoScroll())
            {
                panel.SetFocusBuyButton();
                this.flowLayoutPanel1.AutoScrollPosition = new Point(0, 0);
                nowfocus = 0;
            }
            else
            {
                nowfocus++;
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: lp6m/SSLand
        private async void MainWindow_Load(object sender, EventArgs e)
        {
            AdjustGUISize();
            SecondStreetItemPanel.setMainFormInstance(this);
            new SettingsDBHelper().onCreate();
            string stringValue = (string)Microsoft.Win32.Registry.GetValue(MainForm.Registry_Path, "Expire", "");
            string datestr     = DateTime.Now.AddDays(7).ToString();

            if (string.IsNullOrEmpty(stringValue))
            {
                Microsoft.Win32.Registry.SetValue(Registry_Path, "Expire", datestr);
            }
            string licensekey = (string)Microsoft.Win32.Registry.GetValue(MainForm.Registry_Path, "LicenseKey", "");

            if (string.IsNullOrEmpty(licensekey))
            {
                new LicenseForm().Show();
            }
            if (await Task.Run(() => SecondStreetMaster.init()) == false)
            {
                MessageBox.Show("セカンドストリートからデータの読み込みに失敗しました.プログラムを終了します.\nインターネット環境を確認してください", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: lp6m/SSLand
 private void MainForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == System.Windows.Forms.Keys.Home)
     {
         this.flowLayoutPanel1.AutoScrollPosition = new Point(0, 0);
         int panel_cnt = this.flowLayoutPanel1.Controls.Count;
         if (panel_cnt <= 0)
         {
             return;
         }
         try
         {
             SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 1];
             //panel.SetFocusBuyButton();
             nowfocus = 0;
         }
         catch (Exception ex)
         {
         }
     }
     if (e.KeyCode == System.Windows.Forms.Keys.PageUp)
     {
         this.flowLayoutPanel1.AutoScrollPosition = new Point(-this.flowLayoutPanel1.AutoScrollPosition.X, -this.flowLayoutPanel1.AutoScrollPosition.Y - 120);
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.PageDown)
     {
         this.flowLayoutPanel1.AutoScrollPosition = new Point(-this.flowLayoutPanel1.AutoScrollPosition.X, -this.flowLayoutPanel1.AutoScrollPosition.Y + 120);
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.Tab && e.Shift != true)
     {
         int old = nowfocus;
         nowfocus++;
         if (nowfocus >= bindlist.Count)
         {
             nowfocus = 0;
         }
         try
         {
             //フォーカスする
             int panel_cnt = this.flowLayoutPanel1.Controls.Count;
             SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 1 - nowfocus];
             //panel.SetFocusBuyButton();
         }
         catch (Exception ex)
         {
             //失敗したので戻す
             nowfocus = old;
         }
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.Tab && e.Shift == true)
     {
         int old = nowfocus;
         nowfocus--;
         if (nowfocus < 0)
         {
             nowfocus = 0;
         }
         if (nowfocus >= bindlist.Count)
         {
             nowfocus = 0;
         }
         try
         {
             //フォーカスする
             int panel_cnt = this.flowLayoutPanel1.Controls.Count;
             SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 1 - nowfocus];
             //panel.SetFocusBuyButton();
         }
         catch (Exception ex)
         {
             //失敗したので戻す
             nowfocus = old;
         }
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.F1)
     {
         //bool execute = SettingForm.getf1f4Enable();
         //if (execute)
         //{
         //int panel_cnt = this.flowLayoutPanel1.Controls.Count;
         //if (panel_cnt >= 1)
         //{
         //    SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 1];
         //    SecondStreetItem item = (SecondStreetItem)panel.Tag;
         //    ExecuteBuyItem(item, true);
         //}
         //}
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.F2)
     {
         //bool execute = SettingForm.getf1f4Enable();
         //if (execute)
         //{
         //    int panel_cnt = this.flowLayoutPanel1.Controls.Count;
         //    if (panel_cnt >= 2)
         //    {
         //        SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 2];
         //        SecondStreetItem item = (SecondStreetItem)panel.Tag;
         //        ExecuteBuyItem(item, true);
         //    }
         //}
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.F3)
     {
         //bool execute = SettingForm.getf1f4Enable();
         //if (execute)
         //{
         //    int panel_cnt = this.flowLayoutPanel1.Controls.Count;
         //    if (panel_cnt >= 3)
         //    {
         //        SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 3];
         //        SecondStreetItem item = (SecondStreetItem)panel.Tag;
         //        ExecuteBuyItem(item, true);
         //    }
         //}
     }
     else if (e.KeyCode == System.Windows.Forms.Keys.F4)
     {
         //bool execute = SettingForm.getf1f4Enable();
         //if (execute)
         //{
         //    int panel_cnt = this.flowLayoutPanel1.Controls.Count;
         //    if (panel_cnt >= 4)
         //    {
         //        SecondStreetItemPanel panel = (SecondStreetItemPanel)this.flowLayoutPanel1.Controls[panel_cnt - 4];
         //        SecondStreetItem item = (SecondStreetItem)panel.Tag;
         //        ExecuteBuyItem(item, true);
         //    }
         //}
     }
 }