Jump to content

My Uniprogressbar update problem


yhackup

Recommended Posts

hello sorry for my english.

I am using MYDac TMyDump component in one of my projects.
While backing up the database, I can track the progress from the BackupProgress event, but not on unigui

form image

unit BackupUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, uniGUITypes, uniGUIAbstractClasses,
  uniGUIClasses, uniGUIForm, DataModules, uniMemo, uniGUIBaseClasses,
  uniProgressBar, DADump, MyDump, uniButton,
  uniBitBtn, uniSpeedButton, uniPanel, ServerModule, uniTimer, uniThreadTimer,
  Data.DB, uniBasicGrid, uniDBGrid,
  dxmdaset;

type
  TBackupForm = class(TUniForm)
    MyDump1: TMyDump;
    UniProgressBar1: TUniProgressBar;
    UniPanel1: TUniPanel;
    UniSpeedButton1: TUniSpeedButton;
    UniMemo1: TUniMemo;
    procedure MyDump1BackupProgress(Sender: TObject; ObjectName: string;
      ObjectNum, ObjectCount, Percent: Integer);
    procedure UniSpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function BackupForm: TBackupForm;

implementation

{$R *.dfm}

uses
  MainModule, uniGUIApplication;

function BackupForm: TBackupForm;
begin
  Result := TBackupForm(UniMainModule.GetFormInstance(TBackupForm));
end;

procedure TBackupForm.MyDump1BackupProgress(Sender: TObject; ObjectName: string;
  ObjectNum, ObjectCount, Percent: Integer);
begin
  UniProgressBar1.Max := ObjectCount * 100;
  UniProgressBar1.Position := ObjectNum * Percent;
  UniSession.Synchronize;
end;

procedure TBackupForm.UniSpeedButton1Click(Sender: TObject);
begin
  if not DirectoryExists(UniServerModule.FilesFolderPath + 'backup\') then
    CreateDir(UniServerModule.FilesFolderPath + 'backup\');

  MyDump1.BackupToFile(UniServerModule.FilesFolderPath + 'backup\' +
    formatdatetime('hh_nn_ss_dd_mm_yyyy', Now) + '.sql');
end;

end.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...