コピペ: OmegaChart 1銘柄だけ更新 MainFrame.cs 差し替えその1 追加する部分には//☆UpdateOneBrand

形式
Plain text
投稿日時
2019-02-06 22:27
公開期間
無期限
  1. /*
  2. * Copyright (c) Daisuke OKAJIMA All rights reserved.
  3. *
  4. * $Id$
  5. */
  6. using System;
  7. using System.Diagnostics;
  8. using System.Drawing;
  9. using System.Collections;
  10. using System.ComponentModel;
  11. using System.Windows.Forms;
  12. using Zanetti.Forms;
  13. using Zanetti.Data;
  14. using Zanetti.DataSource;
  15. using Zanetti.Indicators;
  16. using Zanetti.Commands;
  17. using Zanetti.UI;
  18. using Crownwood.Magic.Common;
  19. using Crownwood.Magic.Controls;
  20. using Crownwood.Magic.Docking;
  21. namespace Zanetti.Forms
  22. {
  23. /// <summary>
  24. /// MainFrame の概要の説明です。
  25. /// </summary>
  26. internal class MainFrame : System.Windows.Forms.Form
  27. {
  28. private DockingManager _manager;
  29. private Content _bookmarkContent;
  30. private InitialAction _initialAction;
  31. private IZModelessForm _modelessDialog;
  32. private AsyncSchemaLoader _asyncLoader;
  33. private BrandListPane _currentBrandListPane;
  34. private System.Windows.Forms.MainMenu _mainMenu;
  35. private System.Windows.Forms.StatusBar _statusBar;
  36. private ChartCanvas _chartCanvas;
  37. private ZMainMenuItem _menuFile;
  38. private ZMenuItem _menuDownload;
  39. private ZMenuItem _menuMRUDownload;
  40. private ZMenuItem _menuBarFile1;
  41. private ZMenuItem _menuInitialize;
  42. private ZMenuItem _menuBarFile2;
  43. private ZMenuItem _menuPrint;
  44. private ZMenuItem _menuBarFile3;
  45. private ZMenuItem _menuExport;
  46. private ZMenuItem _menuExportHalfDaily;
  47. private ZMenuItem _menuDownloadIndexFile;
  48. private ZMenuItem _menuBarFile4;
  49. private ZMenuItem _menuQuit;
  50. private ZMainMenuItem _menuView;
  51. private ZMenuItem _menuHalfDaily;
  52. private ZMenuItem _menuDaily;
  53. private ZMenuItem _menuWeekly;
  54. private ZMenuItem _menuMonthly;
  55. private ZMenuItem _menuYearly;
  56. private ZMenuItem _menuBarView1;
  57. private ZMenuItem _menuJump;
  58. private ZMenuItem _menuJumpHome;
  59. private ZMenuItem _menuJumpEnd;
  60. private ZMenuItem _menuBarJump;
  61. private ZMenuItem _menuJumpPrev;
  62. private ZMenuItem _menuJumpNext;
  63. private ZMenuItem _menuBarView2;
  64. private ZMenuItem _menuBookmark;
  65. private ZMenuItem _menuAddBookmark;
  66. private ZMenuItem _menuBarView3;
  67. private ZMenuItem _menuClearFreeLines;
  68. private ZMenuItem _menuBarView4;//☆UpdateOneBrand
  69. private ZMenuItem _menuUpdateOneBrand;//☆UpdateOneBrand
  70. private ZMenuItem _menuLinkToInfo;
  71. private ZMenuItem _menuLinkToYahoo;
  72. private ZMenuItem _menuLinkToNikkei;
  73. private ZMenuItem _menuLinkToInfoseek;
  74. private ZMenuItem _menuLinkToLivedoor;
  75. private ZMainMenuItem _menuMove;
  76. private ZMenuItem _menuBack;
  77. private ZMenuItem _menuFront;
  78. private ZMenuItem _menuBarMove1;
  79. private ZMenuItem _menuInputCode;
  80. private ZMenuItem _menuInputName;
  81. private ZMenuItem _menuIndices;
  82. private ZMenuItem _menuCommodities;
  83. private ZMenuItem _menuDerivedBrand;
  84. private ZMainMenuItem _menuTool;
  85. private ZMenuItem _menuStartScreening;
  86. private ZMenuItem _menuStartAutoTrading;
  87. private ZMenuItem _menuStartVerification;
  88. private ZMenuItem _menuBarTool1;
  89. private ZMenuItem _menuCustomize;
  90. private ZMenuItem _menuKeyConfig;
  91. private ZMenuItem _menuEnvironment;
  92. private ZMenuItem _menuBarTool2;
  93. private ZMenuItem _menuReloadExtensionKit;
  94. private ZMenuItem _menuListExtensionKit;
  95. private ZMenuItem _menuTestExtensionKit;
  96. private ZMainMenuItem _menuHelp;
  97. private ZMenuItem _menuOpenWeb;
  98. private ZMenuItem _menuRegisterCode;
  99. private ZMenuItem _menuBarHelp;
  100. private ZMenuItem _menuAboutBox;
  101. #if ENABLE_SUPPORT_COMMAND
  102. private ZMainMenuItem _menuSupport;
  103. private ZMenuItem _menuRebuildIndex;
  104. private ZMenuItem _menuCreateKey;
  105. //private ZMenuItem _menuSignKit;
  106. private ZMenuItem _menuReload;
  107. private ZMenuItem _menuCreateCert;
  108. private ZMenuItem _menuStatistics;
  109. private ZMenuItem _menuShrinkData;
  110. #endif
  111. /// <summary>
  112. /// 必要なデザイナ変数です。
  113. /// </summary>
  114. private System.ComponentModel.Container components = null;
  115. //Layout.Initの時点ではFrameにアクセスできないといけないので初期化を分離
  116. public MainFrame()
  117. {
  118. }
  119. public void Init()
  120. {
  121. Env.Layout.Init();
  122. _chartCanvas = new Zanetti.UI.ChartCanvas();
  123. _chartCanvas.Dock = System.Windows.Forms.DockStyle.Fill;
  124. //
  125. // Windows フォーム デザイナ サポートに必要です。
  126. //
  127. InitializeComponent();
  128. InitStatusBar();
  129. //
  130. // TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
  131. //
  132. AdjustShortcut();
  133. }
  134. public void WarmUpMagicLibrary()
  135. {
  136. Type m = typeof(DockingManager);
  137. }
  138. public InitialAction InitialAction
  139. {
  140. get
  141. {
  142. return _initialAction;
  143. }
  144. set
  145. {
  146. _initialAction = value;
  147. }
  148. }
  149. public DockingManager DockingManager
  150. {
  151. get
  152. {
  153. return _manager;
  154. }
  155. }
  156. public Content BookmarkPaneContent
  157. {
  158. get
  159. {
  160. return _bookmarkContent;
  161. }
  162. set
  163. {
  164. _bookmarkContent = value;
  165. }
  166. }
  167. public IZModelessForm CurrentModelessDialog
  168. {
  169. get
  170. {
  171. return _modelessDialog;
  172. }
  173. set
  174. {
  175. _modelessDialog = value;
  176. }
  177. }
  178. /// <summary>
  179. /// 使用されているリソースに後処理を実行します。
  180. /// </summary>
  181. protected override void Dispose(bool disposing)
  182. {
  183. if (disposing)
  184. {
  185. if (components != null)
  186. {
  187. components.Dispose();
  188. }
  189. }
  190. base.Dispose(disposing);
  191. }
  192. #region Windows フォーム デザイナで生成されたコード
  193. /// <summary>
  194. /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
  195. /// コード エディタで変更しないでください。
  196. /// </summary>
  197. private void InitializeComponent()
  198. {
  199. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainFrame));
  200. this._mainMenu = new System.Windows.Forms.MainMenu();
  201. this._menuFile = new ZMainMenuItem();
  202. this._menuDownload = new ZMenuItem();
  203. this._menuBarFile1 = new ZMenuItem();
  204. this._menuInitialize = new ZMenuItem();
  205. this._menuMRUDownload = new ZMenuItem();
  206. this._menuBarFile2 = new ZMenuItem();
  207. this._menuPrint = new ZMenuItem();
  208. this._menuBarFile3 = new ZMenuItem();
  209. this._menuExport = new ZMenuItem();
  210. this._menuExportHalfDaily = new ZMenuItem();
  211. this._menuDownloadIndexFile = new ZMenuItem();
  212. this._menuBarFile4 = new ZMenuItem();
  213. this._menuQuit = new ZMenuItem();
  214. this._menuView = new ZMainMenuItem();
  215. this._menuHalfDaily = new ZMenuItem();
  216. this._menuDaily = new ZMenuItem();
  217. this._menuWeekly = new ZMenuItem();
  218. this._menuMonthly = new ZMenuItem();
  219. this._menuYearly = new ZMenuItem();
  220. this._menuBarView1 = new ZMenuItem();
  221. this._menuJump = new ZMenuItem();
  222. this._menuJumpHome = new ZMenuItem();
  223. this._menuJumpEnd = new ZMenuItem();
  224. this._menuBarJump = new ZMenuItem();
  225. this._menuJumpPrev = new ZMenuItem();
  226. this._menuJumpNext = new ZMenuItem();
  227. this._menuBarView2 = new ZMenuItem();
  228. this._menuBookmark = new ZMenuItem();
  229. this._menuAddBookmark = new ZMenuItem();
  230. this._menuBarView3 = new ZMenuItem();
  231. this._menuClearFreeLines = new ZMenuItem();
  232. this._menuLinkToInfo = new ZMenuItem();
  233. this._menuLinkToYahoo = new ZMenuItem();
  234. this._menuLinkToInfoseek = new ZMenuItem();
  235. this._menuLinkToNikkei = new ZMenuItem();
  236. this._menuLinkToLivedoor = new ZMenuItem();
  237. this._menuBarView4 = new ZMenuItem();//☆UpdateOneBrand
  238. this._menuUpdateOneBrand = new ZMenuItem();//☆UpdateOneBrand
  239. this._menuMove = new ZMainMenuItem();
  240. this._menuBack = new ZMenuItem();
  241. this._menuFront = new ZMenuItem();
  242. this._menuBarMove1 = new ZMenuItem();
  243. this._menuInputCode = new ZMenuItem();
  244. this._menuInputName = new ZMenuItem();
  245. this._menuIndices = new ZMenuItem();
  246. this._menuCommodities = new ZMenuItem();
  247. this._menuDerivedBrand = new ZMenuItem();
  248. this._menuTool = new ZMainMenuItem();
  249. this._menuStartScreening = new ZMenuItem();
  250. this._menuStartAutoTrading = new ZMenuItem();
  251. this._menuStartVerification = new ZMenuItem();
  252. this._menuBarTool1 = new ZMenuItem();
  253. this._menuCustomize = new ZMenuItem();
  254. this._menuKeyConfig = new ZMenuItem();
  255. this._menuEnvironment = new ZMenuItem();
  256. this._menuBarTool2 = new ZMenuItem();
  257. this._menuReloadExtensionKit = new ZMenuItem();
  258. this._menuListExtensionKit = new ZMenuItem();
  259. this._menuTestExtensionKit = new ZMenuItem();
  260. this._menuHelp = new ZMainMenuItem();
  261. this._menuOpenWeb = new ZMenuItem();
  262. this._menuRegisterCode = new ZMenuItem();
  263. this._menuBarHelp = new ZMenuItem();
  264. this._menuAboutBox = new ZMenuItem();
  265. #if ENABLE_SUPPORT_COMMAND
  266. this._menuSupport = new ZMainMenuItem();
  267. this._menuRebuildIndex = new ZMenuItem();
  268. this._menuCreateKey = new ZMenuItem();
  269. this._menuReload = new ZMenuItem();
  270. this._menuStatistics = new ZMenuItem();
  271. this._menuCreateCert = new ZMenuItem();
  272. this._menuShrinkData = new ZMenuItem();
  273. #endif
  274. this._statusBar = new System.Windows.Forms.StatusBar();
  275. this.SuspendLayout();
  276. //
  277. // _mainMenu
  278. //
  279. this._mainMenu.MenuItems.AddRange(new ZMainMenuItem[] {
  280. this._menuFile,
  281. this._menuView,
  282. this._menuMove,
  283. this._menuTool,
  284. this._menuHelp,
  285. #if ENABLE_SUPPORT_COMMAND
  286. this._menuSupport
  287. #endif
  288. });
  289. //
  290. // _menuFile
  291. //
  292. this._menuFile.Index = 0;
  293. this._menuFile.MenuItems.AddRange(new ZMenuItem[] {
  294. this._menuDownload,
  295. this._menuMRUDownload,
  296. this._menuBarFile1,
  297. this._menuInitialize,
  298. this._menuBarFile2,
  299. this._menuPrint,
  300. this._menuBarFile3,
  301. this._menuExport,
  302. this._menuExportHalfDaily,
  303. this._menuDownloadIndexFile,
  304. this._menuBarFile4,
  305. this._menuQuit});
  306. this._menuFile.Text = "ファイル(&F)";
  307. this._menuFile.Popup += new System.EventHandler(this.OnAdjustFileMenu);
  308. //
  309. // _menuDownload
  310. //
  311. this._menuDownload.Index = 0;
  312. this._menuDownload.Text = "データのダウンロード(&D)...";
  313. this._menuDownload.Click += new System.EventHandler(this.OnMenu);
  314. this._menuDownload.CID = CID.ShowDownloadDialog;
  315. //
  316. // _menuMRUDownload
  317. //
  318. this._menuMRUDownload.Index = 1;
  319. this._menuMRUDownload.Text = "保存した設定でダウンロード(&S)";
  320. //
  321. // _menuBarFile1
  322. //
  323. this._menuBarFile1.Index = 2;
  324. this._menuBarFile1.Text = "-";
  325. //
  326. // _menuInitialize
  327. //
  328. this._menuInitialize.Index = 3;
  329. this._menuInitialize.Text = "データの初期化(&I)...";
  330. this._menuInitialize.Click += new System.EventHandler(this.OnMenu);
  331. this._menuInitialize.CID = CID.ShowInitializeDialog;
  332. //
  333. // _menuBarFile2
  334. //
  335. this._menuBarFile2.Index = 4;
  336. this._menuBarFile2.Text = "-";
  337. //
  338. // _menuPrint
  339. //
  340. this._menuPrint.Index = 5;
  341. this._menuPrint.Text = "印刷(&P)...";
  342. this._menuPrint.Click += new System.EventHandler(this.OnMenu);
  343. this._menuPrint.CID = CID.ShowPrintDialog;
  344. //
  345. // _menuBarFile3
  346. //
  347. this._menuBarFile3.Index = 6;
  348. this._menuBarFile3.Text = "-";
  349. //
  350. // _menuExport
  351. //
  352. this._menuExport.Index = 7;
  353. this._menuExport.Text = "データのエクスポート(&E)...";
  354. this._menuExport.Click += new System.EventHandler(this.OnMenu);
  355. this._menuExport.CID = CID.ExportBrand;
  356. //
  357. // _menuExportHalfDaily
  358. //
  359. this._menuExportHalfDaily.Index = 8;
  360. this._menuExportHalfDaily.Text = "半日足のエクスポート(&H)...";
  361. this._menuExportHalfDaily.Click += new System.EventHandler(this.OnMenu);
  362. this._menuExportHalfDaily.CID = CID.ExportHalfDaily;
  363. this._menuExportHalfDaily.Visible = false;
  364. //
  365. // _menuDownloadIndexFile
  366. //
  367. this._menuDownloadIndexFile.Index = 9;
  368. this._menuDownloadIndexFile.Text = "インデックスファイルのダウンロード(&I)";
  369. this._menuDownloadIndexFile.Click += new System.EventHandler(this.OnMenu);
  370. this._menuDownloadIndexFile.CID = CID.DownloadIndexFile;
  371. //
  372. // _menuBarFile4
  373. //
  374. this._menuBarFile4.Index = 10;
  375. this._menuBarFile4.Text = "-";
  376. //
  377. // _menuQuit
  378. //
  379. this._menuQuit.Index = 11;
  380. this._menuQuit.Text = "終了(&X)";
  381. this._menuQuit.Click += new System.EventHandler(this.OnMenu);
  382. this._menuQuit.CID = CID.Quit;
  383. //
  384. // _menuView
  385. //
  386. this._menuView.Index = 1;
  387. this._menuView.MenuItems.AddRange(new ZMenuItem[] {
  388. this._menuHalfDaily,
  389. this._menuDaily,
  390. this._menuWeekly,
  391. this._menuMonthly,
  392. this._menuYearly,
  393. this._menuBarView1,
  394. this._menuBookmark,
  395. this._menuAddBookmark,
  396. this._menuBarView2,
  397. this._menuClearFreeLines,
  398. this._menuBarView3,
  399. this._menuLinkToInfo,
  400. this._menuBarView4,//☆UpdateOneBrand
  401. this._menuUpdateOneBrand});//☆UpdateOneBrand
  402. this._menuView.Text = "表示(&V)";
  403. this._menuView.Popup += new System.EventHandler(this.OnAdjustViewMenu);
  404. //
  405. // _menuHalfDaily
  406. //
  407. this._menuHalfDaily.Index = 0;
  408. this._menuHalfDaily.Visible = false;
  409. this._menuHalfDaily.Text = "半日足(&H)";
  410. this._menuHalfDaily.Click += new System.EventHandler(this.OnMenu);
  411. this._menuHalfDaily.CID = CID.SetStyleHalfDaily;
  412. //
  413. // _menuDaily
  414. //
  415. this._menuDaily.Index = 1;
  416. this._menuDaily.Text = "日足(&D)";
  417. this._menuDaily.Click += new System.EventHandler(this.OnMenu);
  418. this._menuDaily.CID = CID.SetStyleDaily;
  419. //
  420. // _menuWeekly
  421. //
  422. this._menuWeekly.Index = 2;
  423. this._menuWeekly.Text = "週足(&W)";
  424. this._menuWeekly.Click += new System.EventHandler(this.OnMenu);
  425. this._menuWeekly.CID = CID.SetStyleWeekly;
  426. //
  427. // _menuMonthly
  428. //
  429. this._menuMonthly.Index = 3;
  430. this._menuMonthly.Text = "月足(&M)";
  431. this._menuMonthly.Click += new System.EventHandler(this.OnMenu);
  432. this._menuMonthly.CID = CID.SetStyleMonthly;
  433. //
  434. // _menuYearly
  435. //
  436. this._menuYearly.Index = 4;
  437. this._menuYearly.Text = "年足(&Y)";
  438. this._menuYearly.Click += new System.EventHandler(this.OnMenu);
  439. this._menuYearly.CID = CID.SetStyleYearly;
  440. //
  441. // _menuBarView1
  442. //
  443. this._menuBarView1.Index = 5;
  444. this._menuBarView1.Text = "-";
  445. //
  446. // _menuBookmark
  447. //
  448. this._menuBookmark.Index = 6;
  449. this._menuBookmark.Text = "お気に入りの表示(&B)";
  450. this._menuBookmark.Click += new System.EventHandler(this.OnMenu);
  451. this._menuBookmark.CID = CID.ToggleBookmarkPane;
  452. //
  453. // _menuAddBookmark
  454. //
  455. this._menuAddBookmark.Index = 7;
  456. this._menuAddBookmark.Text = "お気に入りへ追加(&A)...";
  457. this._menuAddBookmark.Click += new System.EventHandler(this.OnMenu);
  458. this._menuAddBookmark.CID = CID.ShowAddBookmarkDialog;
  459. //
  460. // _menuBarView2
  461. //
  462. this._menuBarView2.Index = 8;
  463. this._menuBarView2.Text = "-";
  464. //
  465. // _menuClearFreeLines
  466. //
  467. this._menuClearFreeLines.Index = 9;
  468. this._menuClearFreeLines.Text = "自由直線のクリア(&C)";
  469. this._menuClearFreeLines.Click += new System.EventHandler(this.OnMenu);
  470. this._menuClearFreeLines.CID = CID.ClearFreeLines;
  471. //
  472. // _menuBarView3
  473. //
  474. this._menuBarView3.Index = 10;
  475. this._menuBarView3.Text = "-";
  476. //
  477. // _menuLinkToInfo
  478. //
  479. this._menuLinkToInfo.Index = 11;
  480. this._menuLinkToInfo.MenuItems.AddRange(new ZMenuItem[] {
  481. this._menuLinkToYahoo,
  482. this._menuLinkToInfoseek,
  483. this._menuLinkToNikkei,
  484. this._menuLinkToLivedoor});
  485. this._menuLinkToInfo.Text = "企業情報へのリンク(&L)";
  486. //
  487. // _menuLinkToYahoo
  488. //
  489. this._menuLinkToYahoo.Index = 0;
  490. this._menuLinkToYahoo.Text = "Yahoo(&Y)";
  491. this._menuLinkToYahoo.Click += new System.EventHandler(this.OnMenu);
  492. this._menuLinkToYahoo.CID = CID.OpenCompanyInfoSite_Yahoo;
  493. //
  494. // _menuLinkToInfoseek
  495. //
  496. this._menuLinkToInfoseek.Index = 1;
  497. this._menuLinkToInfoseek.Text = "Infoseek(&I)";
  498. this._menuLinkToInfoseek.Click += new System.EventHandler(this.OnMenu);
  499. this._menuLinkToInfoseek.CID = CID.OpenCompanyInfoSite_Infoseek;
  500. //
  501. // _menuLinkToNikkei
  502. //
  503. this._menuLinkToNikkei.Index = 2;
  504. this._menuLinkToNikkei.Text = "日経新聞(&N)";
  505. this._menuLinkToNikkei.Click += new System.EventHandler(this.OnMenu);
  506. this._menuLinkToNikkei.CID = CID.OpenCompanyInfoSite_Nikkei;
  507. //
  508. // _menuLinkToLivedoor
  509. //
  510. this._menuLinkToLivedoor.Index = 3;
  511. this._menuLinkToLivedoor.Text = "livedoor(&L)";
  512. this._menuLinkToLivedoor.Click += new System.EventHandler(this.OnMenu);
  513. this._menuLinkToLivedoor.CID = CID.OpenCompanyInfoSite_Livedoor;
  514. //
  515. //☆UpdateOneBrand
  516. //
  517. this._menuBarView4.Index = 12;
  518. this._menuBarView4.Text = "-";
  519. //
  520. //☆UpdateOneBrand
  521. //
  522. this._menuUpdateOneBrand.Index = 13;
  523. this._menuUpdateOneBrand.Text = "この銘柄の株価更新";
  524. this._menuUpdateOneBrand.Click += new System.EventHandler(this.OnMenu);
  525. this._menuUpdateOneBrand.CID = CID.UpdateOneBrand;
  526. //
  527. // _menuMove
  528. //
  529. this._menuMove.Index = 2;
  530. this._menuMove.MenuItems.AddRange(new ZMenuItem[] {
  531. this._menuBack,
  532. this._menuFront,
  533. this._menuBarMove1,
  534. this._menuInputCode,
  535. this._menuInputName,
  536. this._menuIndices,
  537. this._menuCommodities,
  538. this._menuDerivedBrand
  539. });
  540. this._menuMove.Text = "移動(&M)";
  541. this._menuMove.Popup += new System.EventHandler(this.OnAdjustMoveMenu);
  542. //
  543. // _menuBack
  544. //
  545. this._menuBack.Index = 0;
  546. this._menuBack.Text = "戻る(&B)";
  547. this._menuBack.Click += new System.EventHandler(this.OnMenu);
  548. this._menuBack.CID = CID.Back;
  549. //
  550. // _menuFront
  551. //
  552. this._menuFront.Index = 1;
  553. this._menuFront.Text = "進む(&F)";
  554. this._menuFront.Click += new System.EventHandler(this.OnMenu);
  555. this._menuFront.CID = CID.Front;
  556. //
  557. // _menuBarTool1
  558. //
  559. this._menuBarMove1.Index = 2;
  560. this._menuBarMove1.Text = "-";
  561. //
  562. // _menuInputCode
  563. //
  564. this._menuInputCode.Index = 3;
  565. this._menuInputCode.Text = "銘柄コードを指定(&C)...";
  566. this._menuInputCode.Click += new System.EventHandler(this.OnMenu);
  567. this._menuInputCode.CID = CID.ShowInputCode;
  568. //
  569. // _menuInputName
  570. //
  571. this._menuInputName.Index = 4;
  572. this._menuInputName.Text = "名前から検索(&S)...";
  573. this._menuInputName.Click += new System.EventHandler(this.OnMenu);
  574. this._menuInputName.CID = CID.ShowSearchBrandDialog;
  575. //
  576. // _menuIndices
  577. //
  578. this._menuIndices.Index = 5;
  579. this._menuIndices.Text = "指数・為替(&I)";
  580. //
  581. // _menuCommodities
  582. //
  583. this._menuCommodities.Index = 6;
  584. this._menuCommodities.Visible = false;
  585. this._menuCommodities.Text = "商品先物(&O)";
  586. //
  587. // _menuDerivedBrand
  588. //
  589. this._menuDerivedBrand.Index = 7;
  590. this._menuDerivedBrand.Text = "派生銘柄(&U)";
  591. //
  592. // _menuTool
  593. //
  594. this._menuTool.Index = 3;
  595. this._menuTool.MenuItems.AddRange(new ZMenuItem[] {
  596. this._menuStartScreening,
  597. this._menuStartAutoTrading,
  598. this._menuStartVerification,
  599. this._menuBarTool1,
  600. this._menuCustomize,
  601. this._menuKeyConfig,
  602. this._menuEnvironment,
  603. this._menuBarTool2,
  604. this._menuReloadExtensionKit,
  605. this._menuListExtensionKit,
  606. this._menuTestExtensionKit});
  607. this._menuTool.Text = "ツール(&T)";
  608. //
  609. // _menuStartScreening
  610. //
  611. this._menuStartScreening.Index = 0;
  612. this._menuStartScreening.Text = "スクリーニング(&S)...";
  613. this._menuStartScreening.Click += new System.EventHandler(this.OnMenu);
  614. this._menuStartScreening.CID = CID.ShowScreeningDialog;
  615. //
  616. // _menuStartAutoTrading
  617. //
  618. this._menuStartAutoTrading.Index = 1;
  619. this._menuStartAutoTrading.Text = "自動売買検証(&U)...";
  620. this._menuStartAutoTrading.Click += new System.EventHandler(this.OnMenu);
  621. this._menuStartAutoTrading.CID = CID.ShowAutoTradingDialog;
  622. //
  623. // _menuStartVerification
  624. //
  625. this._menuStartVerification.Index = 2;
  626. this._menuStartVerification.Text = "セオリー検証(&V)...";
  627. this._menuStartVerification.Click += new System.EventHandler(this.OnMenu);
  628. this._menuStartVerification.CID = CID.ShowPredictionDialog;
  629. //
  630. // _menuBarTool1
  631. //
  632. this._menuBarTool1.Index = 3;
  633. this._menuBarTool1.Text = "-";
  634. //
  635. // _menuCustomize
  636. //
  637. this._menuCustomize.Index = 4;
  638. this._menuCustomize.Text = "カスタマイズ(&C)...";
  639. this._menuCustomize.Click += new System.EventHandler(this.OnMenu);
  640. this._menuCustomize.CID = CID.ShowCustomizeDialog;
  641. //
  642. // _menuKeyConfig
  643. //
  644. this._menuKeyConfig.Index = 5;
  645. this._menuKeyConfig.Text = "キー割り当て(&A)...";
  646. this._menuKeyConfig.Click += new System.EventHandler(this.OnMenu);
  647. this._menuKeyConfig.CID = CID.ShowKeyConfigDialog;
  648. //
  649. // _menuEnvironment
  650. //
  651. this._menuEnvironment.Index = 6;
  652. this._menuEnvironment.Text = "環境設定(&E)...";
  653. this._menuEnvironment.Click += new System.EventHandler(this.OnMenu);
  654. this._menuEnvironment.CID = CID.ShowEnvironmentDialog;
  655. //
  656. // _menuBarTool2
  657. //
  658. this._menuBarTool2.Index = 7;
  659. this._menuBarTool2.Text = "-";
  660. //
  661. // _menuReloadExtensionKit
  662. //
  663. this._menuReloadExtensionKit.Index = 8;
  664. this._menuReloadExtensionKit.Text = "拡張キットのリロード(&R)";
  665. this._menuReloadExtensionKit.Click += new System.EventHandler(this.OnMenu);
  666. this._menuReloadExtensionKit.CID = CID.ReloadKit;
  667. //
  668. // _menuListExtensionKit
  669. //
  670. this._menuListExtensionKit.Index = 9;
  671. this._menuListExtensionKit.Text = "拡張キットの一覧(&K)...";
  672. this._menuListExtensionKit.Click += new System.EventHandler(this.OnMenu);
  673. this._menuListExtensionKit.CID = CID.ShowExtensionKitDialog;
  674. //
  675. // _menuTestExtensionKit
  676. //
  677. this._menuTestExtensionKit.Index = 10;
  678. this._menuTestExtensionKit.Text = "拡張キットのテスト(&T)...";
  679. this._menuTestExtensionKit.Click += new System.EventHandler(this.OnMenu);
  680. this._menuTestExtensionKit.CID = CID.ShowTestKitDialog;
  681. //
  682. // _menuHelp
  683. //
  684. this._menuHelp.Index = 4;
  685. this._menuHelp.MenuItems.AddRange(new ZMenuItem[] {
  686. this._menuOpenWeb,
  687. this._menuRegisterCode,
  688. this._menuBarHelp,
  689. this._menuAboutBox});
  690. this._menuHelp.Text = "ヘルプ(&H)";
  691. //
  692. // _menuOpenWeb
  693. //
  694. this._menuOpenWeb.Index = 0;
  695. this._menuOpenWeb.Text = "OmegaChartのWebを開く(&W)";
  696. this._menuOpenWeb.Click += new System.EventHandler(this.OnMenu);
  697. this._menuOpenWeb.CID = CID.OpenWeb;
  698. //
  699. // _menuRegistCode
  700. //
  701. this._menuRegisterCode.Index = 1;
  702. this._menuRegisterCode.Text = "Contribution Certificate登録(&R)...";
  703. this._menuRegisterCode.Click += new System.EventHandler(this.OnMenu);
  704. this._menuRegisterCode.CID = CID.RegisterUserCode;
  705. //
  706. // _menuBarHelp
  707. //
  708. this._menuBarHelp.Index = 2;
  709. this._menuBarHelp.Text = "-";
  710. //
  711. // _menuAboutBox
  712. //
  713. this._menuAboutBox.Index = 3;
  714. this._menuAboutBox.Text = "バージョン情報(&A)...";
  715. this._menuAboutBox.Click += new System.EventHandler(this.OnMenu);
  716. this._menuAboutBox.CID = CID.ShowAboutBox;
  717. #if ENABLE_SUPPORT_COMMAND
  718. //
  719. // _menuSupport
  720. //
  721. this._menuSupport.Index = 5;
  722. this._menuSupport.MenuItems.AddRange(new ZMenuItem[] {
  723. this._menuRebuildIndex,
  724. this._menuCreateKey,
  725. this._menuReload,
  726. this._menuCreateCert,
  727. this._menuStatistics,
  728. this._menuShrinkData
  729. });
  730. this._menuSupport.Text = "サポート";
  731. //
  732. // _menuRebuildIndex
  733. //
  734. this._menuRebuildIndex.Index = 0;
  735. this._menuRebuildIndex.Text = "インデックス再構築";
  736. this._menuRebuildIndex.Click += new System.EventHandler(this.OnMenu);
  737. this._menuRebuildIndex.CID = CID.SupRebuildIndex;
  738. //
  739. // _menuCreateKey
  740. //
  741. this._menuCreateKey.Index = 1;
  742. this._menuCreateKey.Text = "鍵の作成(既存の鍵は消える)";
  743. this._menuCreateKey.Click += new System.EventHandler(this.OnMenu);
  744. this._menuCreateKey.CID = CID.SupCreateKey;
  745. //
  746. // _menuReload
  747. //
  748. this._menuReload.Index = 2;
  749. this._menuReload.Text = "Reload";
  750. this._menuReload.Click += new System.EventHandler(this.OnMenu);
  751. this._menuReload.CID = CID.SupReload;
  752. //
  753. // _menuCreateCert
  754. //
  755. this._menuCreateCert.Index = 3;
  756. this._menuCreateCert.Text = "Certificate生成";
  757. this._menuCreateCert.Click += new System.EventHandler(this.OnMenu);
  758. this._menuCreateCert.CID = CID.SupCreateCert;
  759. //
  760. // _menuStatistics
  761. //
  762. this._menuStatistics.Index = 4;
  763. this._menuStatistics.Text = "Statistics";
  764. this._menuStatistics.Click += new System.EventHandler(this.OnMenu);
  765. this._menuStatistics.CID = CID.SupStatistics;
  766. //
  767. // _menuShrinkData
  768. //
  769. this._menuShrinkData.Index = 4;
  770. this._menuShrinkData.Text = "データ縮小";
  771. this._menuShrinkData.Click += new System.EventHandler(this.OnMenu);
  772. this._menuShrinkData.CID = CID.SupShrinkData;
  773. #endif
  774. //
  775. // _statusBar
  776. //
  777. this._statusBar.Location = new System.Drawing.Point(0, 213);
  778. this._statusBar.Name = "_statusBar";
  779. this._statusBar.Size = new System.Drawing.Size(292, 22);
  780. this._statusBar.TabIndex = 0;
  781. this._statusBar.DoubleClick += new System.EventHandler(this.OnStatusBarDoubleClicked);
  782. //
  783. // MainFrame
  784. //
  785. this.Controls.Add(this._chartCanvas);
  786. this.Controls.Add(this._statusBar);
  787. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  788. this.Menu = this._mainMenu;
  789. this.Name = "MainFrame";
  790. this.Text = Env.Constants.AppTitle;
  791. this.ImeMode = ImeMode.Disable;
  792. this.ResumeLayout(false);
  793. }
  794. #endregion
  795. public ChartCanvas ChartCanvas
  796. {
  797. get
  798. {
  799. return _chartCanvas;
  800. }
  801. }
  802. public BrandListPane CurrentBrandListPane
  803. {
  804. get
  805. {
  806. return _currentBrandListPane;
  807. }
  808. set
  809. {
  810. _currentBrandListPane = value;
  811. }
  812. }
  813. //☆UpdateOneBrand
  814. public string SetMainFrameTxt
  815. {
  816. get
  817. {
  818. return this.Text;
  819. }
  820. set
  821. {
  822. this.Text = value;
  823. }
  824. }
  825. private void InitMenus()
  826. {
  827. //MRU
  828. InitMRUDownloadMenu();
  829. //指標を追加
  830. AddIndexMenu(BuiltInIndex.Nikkei225);
  831. AddIndexMenu(BuiltInIndex.TOPIX);
  832. AddIndexMenu(BuiltInIndex.JASDAQ);
  833. //AddIndexMenu(BuiltInIndex.LONGTERM_INTEREST); DreamVisor
  834. AddIndexMenu(BuiltInIndex.Nikkei225_F);
  835. AddIndexMenu(BuiltInIndex.TOPIX_F);
  836. Util.AddMenuBar(_menuIndices);
  837. AddIndexMenu(BuiltInIndex.JPYUSD);
  838. AddIndexMenu(BuiltInIndex.JPYEUR);
  839. Util.AddMenuBar(_menuIndices);
  840. AddIndexMenu(BuiltInIndex.Dow);
  841. AddIndexMenu(BuiltInIndex.Nasdaq);
  842. AddIndexMenu(BuiltInIndex.SP500);
  843. Util.AddMenuBar(_menuIndices);
  844. MenuItem sectors = new ZMenuItem();
  845. sectors.Text = "業種別(&S)";
  846. _menuIndices.MenuItems.Add(sectors);
  847. for (int i = (int)BuiltInIndexGroup.SectorIndexStart; i <= (int)BuiltInIndexGroup.SectorIndexEnd; i++)
  848. AddBrandMenu(sectors, Env.BrandCollection.FindBrand(i));
  849. #if DOJIMA
  850. for(int i=CommodityUtil.INDEX_START; i<=CommodityUtil.INDEX_END; i++)
  851. AddBrandMenu(_menuCommodities, Env.BrandCollection.FindBrand(i));
  852. _menuCommodities.Visible = true;
  853. _menuHalfDaily.Visible = true;
  854. _menuExportHalfDaily.Visible = true;
  855. _menuOpenWeb.Visible = false;
  856. _menuRegisterCode.Visible = false;
  857. _menuBarHelp.Visible = false;
  858. #endif
  859. ArrayList derived = Env.BrandCollection.DerivedBrands;
  860. if (derived.Count > 0)
  861. {
  862. foreach (DerivedBrand br in derived)
  863. AddBrandMenu(_menuDerivedBrand, br);
  864. }
  865. }
  866. private void AddIndexMenu(BuiltInIndex mi)
  867. {
  868. AbstractBrand br = Env.BrandCollection.FindBrand((int)mi);
  869. AddBrandMenu(_menuIndices, br);
  870. }
  871. private void AddBrandMenu(Menu parent, AbstractBrand br)
  872. {
  873. ZMenuItem menu = new ZMenuItem();
  874. menu.Text = String.Format("{0}:{1}", br.CodeAsString, br.Name.Replace("&", "&&"));
  875. menu.Index = _menuIndices.MenuItems.Count;
  876. menu.Click += new EventHandler(OnMenu);
  877. menu.CID = CID.ShowSpecifiedBrand;
  878. parent.MenuItems.Add(menu);
  879. }
  880. public void InitMRUDownloadMenu()
  881. {
  882. _menuMRUDownload.MenuItems.Clear();
  883. bool mru_found = false;
  884. for (int i = 0; i < Env.Options.DownloadOrders.Count; i++)
  885. {
  886. DownloadOrder o = Env.Options.DownloadOrders[i];
  887. ZMenuItem mi = new ZMenuItem();
  888. mi.Text = String.Format("&{0} {1}", i + 1, Env.Options.DownloadOrders.GetDescription(i));
  889. mi.Enabled = o != null;
  890. mi.Click += new EventHandler(OnMRUDownloadOrder);
  891. _menuMRUDownload.MenuItems.Add(mi);
  892. mru_found = true;
  893. }
  894. _menuMRUDownload.Enabled = mru_found;
  895. }
  896. private void OnMRUDownloadOrder(object sender, EventArgs args)
  897. {
  898. DownloadOrder o = Env.Options.DownloadOrders[((MenuItem)sender).Index];
  899. Debug.Assert(o != null);
  900. CommandExec.ShowDownloadDialog(o);
  901. }
  902. private void InitStatusBar()
  903. {
  904. StatusBarPanel mp = new StatusBarPanel();
  905. mp.Style = StatusBarPanelStyle.Text;
  906. mp.AutoSize = StatusBarPanelAutoSize.Spring;
  907. _statusBar.ShowPanels = true;
  908. _statusBar.Panels.Add(mp);
  909. }
  910. public void SetStatusBarText(string text, string tooltip)
  911. {
  912. _statusBar.Panels[0].Text = text;
  913. _statusBar.Panels[0].ToolTipText = tooltip;
  914. }
  915. private void OnStatusBarDoubleClicked(object sender, EventArgs args)
  916. {
  917. if (_modelessDialog != null)
  918. {
  919. _modelessDialog.ZShow();
  920. SetStatusBarText("", "");
  921. }
  922. }
  923. public void AdjustShortcut()
  924. {
  925. foreach (MenuItem mi in this._mainMenu.MenuItems)
  926. AdjustShortcut(mi);
  927. }
  928. private void AdjustShortcut(MenuItem mi)
  929. {
  930. ZMenuItem zmi = mi as ZMenuItem;
  931. if (zmi != null && zmi.CID != CID.None)
  932. zmi.ShortcutKey = Env.Command.Get(zmi.CID).Shortcut;
  933. foreach (MenuItem ch in mi.MenuItems)
  934. AdjustShortcut(ch);
  935. }
  936. public bool IsBookmarkPaneVisible
  937. {
  938. get
  939. {
  940. return _bookmarkContent != null && _bookmarkContent.Visible;
  941. }
  942. }
  943. private void OnMenu(object sender, EventArgs args)
  944. {
  945. try
  946. {
  947. if (_asyncLoader != null) return; //ロード中はメニュー起動しない
  948. ZMenuItem mi = (ZMenuItem)sender;
  949. if (mi.CID == CID.ShowInputCode)
  950. CommandExec.PromptInputCode(true, '\0');
  951. else if (mi.CID == CID.ShowSpecifiedBrand)
  952. CommandExec.ShowBrand(Env.BrandCollection.FindBrand(MenuItemToCode(mi)));
  953. else if (mi.CID != CID.None)
  954. Env.Command.Exec(mi.CID);
  955. else
  956. Util.Warning(this, "NOT IMPLEMENTED YET!");
  957. }
  958. catch (Exception ex)
  959. {
  960. Util.ReportCriticalError(ex);
  961. }
  962. }
  963. private void OnAdjustViewMenu(object sender, EventArgs args)
  964. {
  965. AdjustViewMenu(_menuView);
  966. }
  967. private void OnAdjustMoveMenu(object sender, EventArgs args)
  968. {
  969. _menuBack.Enabled = Env.BrandHistory.HasBack;
  970. _menuFront.Enabled = Env.BrandHistory.HasFront;
  971. }
  972. //本体とコンテキストメニューの両方があるので
  973. private void AdjustViewMenu(Menu parent)
  974. {
  975. parent.MenuItems[_menuBookmark.Index].Checked = (_bookmarkContent != null && _bookmarkContent.Visible);
  976. #if DOJIMA
  977. parent.MenuItems[_menuHalfDaily.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.HalfDaily;
  978. #endif
  979. parent.MenuItems[_menuDaily.Index].Checked = Env.CurrentIndicators.Format == ChartFormat.Daily;
  980. parent.MenuItems[_menuWeekly.Index].Checked = Env.CurrentIndicators.Format == ChartFormat.Weekly;
  981. parent.MenuItems[_menuMonthly.Index].Checked = Env.CurrentIndicators.Format == ChartFormat.Monthly;
  982. parent.MenuItems[_menuYearly.Index].Checked = Env.CurrentIndicators.Format == ChartFormat.Yearly;
  983. parent.MenuItems[_menuLinkToInfo.Index].Enabled = !_chartCanvas.GetBrand().IsBuiltIn;
  984. parent.MenuItems[_menuUpdateOneBrand.Index].Enabled = !_chartCanvas.GetBrand().IsBuiltIn;//☆UpdateOneBrand
  985. }
  986. private void OnAdjustFileMenu(object sender, EventArgs args)
  987. {
  988. _menuDownload.Enabled = _modelessDialog == null;
  989. _menuMRUDownload.Enabled = _modelessDialog == null;
  990. }
  991. public ContextMenu CreateContextMenu()
  992. {
  993. ContextMenu cm = new ContextMenu();
  994. foreach (ZMenuItem mi in _menuView.MenuItems)
  995. {
  996. MenuItem cl = mi.CloneMenu();
  997. cm.MenuItems.Add(cl);
  998. }
  999. AdjustViewMenu(cm);
  1000. return cm;
  1001. }
  1002. private void FinishAsyncLoad(IntPtr lparam)
  1003. {
  1004. Debug.Assert(_asyncLoader != null);
  1005. InitMenus();
  1006. //失敗の場合でもDockingManagerは必要
  1007. _manager = new DockingManager(this, VisualStyle.IDE);
  1008. _manager.ContentHidden += _manager_ContentHidden;
  1009. _manager.ContentShown += _manager_ContentShown;
  1010. _manager.OuterControl = _statusBar;
  1011. _manager.InnerControl = _chartCanvas;
  1012. if (lparam.ToInt32() == AsyncConst.LPARAM_FINISHED)
  1013. {
  1014. Env.CurrentIndicators = _asyncLoader.IndicatorSet;
  1015. Env.BrandCollection.ClearAllFarms();
  1016. AbstractBrand br = _chartCanvas.GetBrand();
  1017. _chartCanvas.ReloadFromPreference();
  1018. _chartCanvas.LoadBrand(br, false);
  1019. Invalidate(true);
  1020. }
  1021. else
  1022. {
  1023. Util.Warning(this, "スキーマのロード中にエラーが発生しました。\n" + _asyncLoader.ErrorMessage);
  1024. }
  1025. _asyncLoader = null;
  1026. foreach (MenuItem mi in _mainMenu.MenuItems) mi.Enabled = true;
  1027. this.Cursor = Cursors.Default;
  1028. CommandExec.ResetLayout();
  1029. #if DOJIMA
  1030. if(!Env.Options.DojimaPasswordVerified)
  1031. new Dojima.PasswordDialog().ShowDialog(this);
  1032. #endif
  1033. }
  1034. protected override void OnActivated(EventArgs e)
  1035. {
  1036. base.OnActivated(e);
  1037. if (_initialAction == null || _initialAction.Performed)
  1038. {
  1039. //if(!_chartCanvas.Focused) _chartCanvas.Focus();
  1040. return;
  1041. }
  1042. _initialAction.Performed = true;
  1043. //!!こういった処理がOnActivatedにあるのも変だが...
  1044. foreach (MenuItem mi in _mainMenu.MenuItems) mi.Enabled = false;
  1045. CommandExec.ShowBrand(Env.BrandCollection.FindBrand(_initialAction.BrandCode));
  1046. this.Cursor = Cursors.AppStarting;
  1047. _asyncLoader = new AsyncSchemaLoader(this);
  1048. _asyncLoader.AsyncLoad();
  1049. DecupleData.Decuple(); // データの10倍化
  1050. }
  1051. protected override void OnClosing(CancelEventArgs e)
  1052. {
  1053. base.OnClosing(e);
  1054. Env.Options.FrameLocation = new Rectangle(this.Location, this.Size);
  1055. Env.Options.WindowState = this.WindowState;
  1056. if (_modelessDialog != null) _modelessDialog.ZAbort();
  1057. }
  1058. protected override bool ProcessDialogKey(Keys keyData)
  1059. {
  1060. //Debug.WriteLine("ProcessDialogKey(Frame)");
  1061. return ProcessShortcut(keyData);
  1062. }
  1063. public bool IsPriorShortcutKey(Keys keyData)
  1064. {
  1065. return (Keys.D0 <= keyData && keyData <= Keys.D9) || (Keys.NumPad0 <= keyData && keyData <= Keys.NumPad9);
  1066. }
  1067. public bool ProcessShortcut(Keys keyData)
  1068. {
  1069. if (Env.Command.Exec(keyData) != CommandResult.Ignored)
  1070. return true;
  1071. else
  1072. return false;
  1073. }
  1074. protected override void OnMouseWheel(MouseEventArgs e)
  1075. {
  1076. Env.Command.ExecMouseWheel(e.Delta);
  1077. }
  1078. private int MenuItemToCode(object sender)
  1079. {
  1080. string t = ((MenuItem)sender).Text;
  1081. return Int32.Parse(t.Substring(0, t.IndexOf(':')));
  1082. }
  1083. private void _manager_ContentHidden(Content c, EventArgs cea)
  1084. {
  1085. _chartCanvas.Focus();
  1086. if (c.Control is BrandListPane)
  1087. _currentBrandListPane = null;
  1088. }
  1089. private void _manager_ContentShown(Content c, EventArgs cea)
  1090. {
  1091. if (c.Control is BrandListPane)
  1092. _currentBrandListPane = (BrandListPane)c.Control;
  1093. }
  1094. protected override void WndProc(ref Message m)
  1095. {
  1096. const int WM_SETCODE = Win32.WM_USER + 100;
  1097. const int WM_SETSPAN = Win32.WM_USER + 101;
  1098. base.WndProc(ref m);
  1099. if (m.Msg == AsyncConst.WM_ASYNCPROCESS)
  1100. FinishAsyncLoad(m.LParam);
  1101. else if (m.Msg == WM_SETCODE)
  1102. {
  1103. int code = (int)m.WParam;
  1104. AbstractBrand br = Env.BrandCollection.FindBrand(code);
  1105. if (br != null) CommandExec.ShowBrand(br);
  1106. }
  1107. else if (m.Msg == WM_SETSPAN)
  1108. {
  1109. int style = (int)m.WParam;
  1110. switch (style)
  1111. {
  1112. case 1:
  1113. CommandExec.SetChartFormat(ChartFormat.Daily);
  1114. break;
  1115. case 2:
  1116. CommandExec.SetChartFormat(ChartFormat.Weekly);
  1117. break;
  1118. case 3:
  1119. CommandExec.SetChartFormat(ChartFormat.Monthly);
  1120. break;
  1121. case 4:
  1122. CommandExec.SetChartFormat(ChartFormat.Yearly);
  1123. break;
  1124. }
  1125. }
  1126. }
  1127. }
  1128. internal interface IZModelessForm
  1129. {
  1130. void ZShow();
  1131. void ZAbort();
  1132. }
  1133. }
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト