Advertisement
believe_me

Untitled

May 19th, 2022
1,380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit StartUnit;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Menus, EditUnit, Vcl.Themes, Vcl.Styles,
  8.   Vcl.Samples.Spin, ShowUnit;
  9.  
  10. type
  11.   TStartForm = class(TForm)
  12.     ShowModeButton: TButton;
  13.     EditModeButton: TButton;
  14.     MainMenu: TMainMenu;
  15.     InstructionMenu: TMenuItem;
  16.     DeveloperMenu: TMenuItem;
  17.     CostSpinEdit: TSpinEdit;
  18.     ModeLabel: TLabel;
  19.     ColorLabel: TLabel;
  20.     LightRButton: TRadioButton;
  21.     DarkRButton: TRadioButton;
  22.     CostLabel: TLabel;
  23.     procedure DeveloperMenuClick(Sender: TObject);
  24.     procedure EditModeButtonClick(Sender: TObject);
  25.     procedure ShowModeButtonClick(Sender: TObject);
  26.     procedure FormCreate(Sender: TObject);
  27.     procedure LightRButtonClick(Sender: TObject);
  28.     procedure DarkRButtonClick(Sender: TObject);
  29.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  30.     procedure InstructionMenuClick(Sender: TObject);
  31.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  32.     procedure FormKeyPress(Sender: TObject; var Key: Char);
  33.   private
  34.     { Private declarations }
  35.   public
  36.     { Public declarations }
  37.   end;
  38.  
  39. var
  40.     StartForm: TStartForm;
  41.     ServiceCost: integer;
  42.  
  43. implementation
  44.  
  45. {$R *.dfm}
  46.  
  47. uses
  48.     WriteUnit;
  49.  
  50. const
  51.     LIGHT_SKIN = 'Smokey Quartz Kamri';
  52.     DARK_SKIN = 'Charcoal Dark Slate';
  53.  
  54. procedure TStartForm.DeveloperMenuClick(Sender: TObject);
  55. begin
  56.     MessageDlg('Student: Ravodin Alexander Dmitrievich.' + #13#10 + 'Group: 151002.'
  57.                + #13#10 + #13#10 + 'Contacts:' + #13#10 + 'VKontakte: ' +
  58.                'https://vk.com/ushouldbelieveme' + #13#10 +'E-mail: ' +
  59.                'telephonedatabasedev@gmail.com', MtInformation, [mbOk], 0);
  60. end;
  61.  
  62. procedure TStartForm.InstructionMenuClick(Sender: TObject);
  63. begin
  64.     MessageDlg('This is the start window. It includes next functions:' + #13#10 +
  65.               '1. Сhoosing a work mod;' + #13#10 + '2. Choosing a color mod;' +
  66.               #13#10 + '3. Provider cost setting.' + #13#10 + #13#10 + 'First' +
  67.               ' option includes two modes:' + #13#10 + '- Show mode: allows' +
  68.               'you just to see subscribers using searching and sorting tools.'
  69.               + #13#10 + '- Edit mode: includes 3 more functions:' + #13#10 +
  70.               'a) Adding subscribers;' + #13#10 + 'b) Editing current ' +
  71.               'subscriber''s data;' + #13#10 + 'c) Deleting subscribers;' +
  72.               #13#10 + #13#10 + 'Color mode allow you to switch between ligth' +
  73.               ' and dark themes.' + #13#10 + #13#10 + 'Setting a provider cost' +
  74.               ' will determine the way of payment calсulation:' + #13#10 +
  75.               'You enter 30-days provider cost in dollars and new payments' +
  76.               ' will be counted according to in.' + #13#10 + 'Press "ctrl + i"'
  77.               + ' to open instruction;' + #13#10 +  'Press "esc" to exit program.',
  78.               MtInformation, [mbOk], 0);
  79. end;
  80.  
  81. procedure TStartForm.EditModeButtonClick(Sender: TObject);
  82. begin
  83.     EditForm.show();
  84.     StartForm.Enabled := false;
  85.     ServiceCost := CostSpinEdit.value;
  86. end;
  87.  
  88. procedure TStartForm.FormClose(Sender: TObject; var Action: TCloseAction);
  89. begin
  90.     removeDeleters;
  91. end;
  92.  
  93. procedure TStartForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  94. begin
  95.     CanClose := false;
  96.     if MessageDlg('Are you sure if you want to exit?', mtConfirmation, mbYESNO, 0) = mrYES then
  97.     begin
  98.         CanClose := true;
  99.     end;
  100. end;
  101.  
  102. procedure TStartForm.FormCreate(Sender: TObject);
  103. begin
  104.     TStyleManager.TrySetStyle(LIGHT_SKIN);
  105.     LightRButton.Checked := true;
  106. end;
  107.  
  108. procedure TStartForm.FormKeyPress(Sender: TObject; var Key: Char);
  109. begin
  110.     if key = #27 then
  111.         StartForm.Close()
  112. end;
  113.  
  114. procedure TStartForm.LightRButtonClick(Sender: TObject);
  115. begin
  116.     TStyleManager.TrySetStyle(LIGHT_SKIN);
  117. end;
  118.  
  119. procedure TStartForm.DarkRButtonClick(Sender: TObject);
  120. begin
  121.     TStyleManager.TrySetStyle(DARK_SKIN);
  122. end;
  123.  
  124. procedure TStartForm.ShowModeButtonClick(Sender: TObject);
  125.  
  126. begin;
  127.     ServiceCost := CostSpinEdit.value;
  128.     StartForm.Enabled := false;
  129.     ShowForm.show();
  130. end;
  131.  
  132. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement