Changeset 43 for trunk/Forms/UFormMain.pas
- Timestamp:
- Mar 9, 2012, 1:09:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r42 r43 9 9 StdCtrls, ActnList, Menus, ExtCtrls, USqlDatabase, DOM, XMLRead, XMLWrite, 10 10 UPersistentForm, UTreeState, SpecializedList, SpecializedDictionary, 11 URegistry, U System, UFormItemList;11 URegistry, UCoolTranslator, USystem, UFormItemList; 12 12 13 13 type … … 112 112 UFormItemView, UFormItemEdit, UFormItemAdd, UFormLogin, UFormSetting, UApplicationInfo, 113 113 UCore, UFormImportStructure, UFormAbout, UFormLoginProfile, UChronisClientDirect, 114 UChronisClient ;114 UChronisClient, UChronisClientMySQL, UChronisClientXMLRPC; 115 115 116 116 {$R *.lfm} … … 155 155 procedure TMainForm.UpdateInterface; 156 156 begin 157 ADisconnect.Enabled := Core.System.Client.Connected;158 AConnect.Enabled := not Core.System.Client.Connected;159 AImportStructure.Enabled := Core.System.Client.Connected;157 ADisconnect.Enabled := Assigned(Core.Client) and Core.Client.Connected; 158 AConnect.Enabled := Assigned(Core.Client) and not Core.Client.Connected; 159 AImportStructure.Enabled := Assigned(Core.Client) and Core.Client.Connected; 160 160 if Assigned(MainPanelForm) then 161 161 Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name 162 else Caption := 162 else Caption := ApplicationInfo.Name; 163 163 Application.Title := Caption; 164 if Assigned(Core. System.Client) then165 with Core. System.Client do164 if Assigned(Core.Client) then 165 with Core.Client do 166 166 StatusBar1.Panels[0].Text := User + '@' + Host + ':' + IntToStr(Port) + '/' + Schema; 167 167 end; … … 258 258 procedure TMainForm.AImportStructureExecute(Sender: TObject); 259 259 begin 260 ImportStructureForm.ShowModal; 260 try 261 ImportStructureForm := TImportStructureForm.Create(MainForm); 262 ImportStructureForm.ShowModal; 263 finally 264 ImportStructureForm.Free; 265 end; 261 266 end; 262 267 … … 268 273 if LoginForm.ShowModal = mrOK then begin 269 274 with TConnectProfile(Core.Profiles[Core.LastProfile]) do begin 275 FreeAndNil(Core.Client); 276 if Protocol = cpMySQL then Core.Client := TChronisClientMySQL.Create 277 else if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create 278 else if Protocol = cpXMLRPC then Core.Client := TChronisClientXMLRPC.Create; 279 Core.System.Client := Core.Client; 270 280 Core.System.Client.Host := HostName; 271 281 Core.System.Client.Schema := Database; … … 273 283 Core.System.Client.Password := Core.LastPassword; 274 284 Core.System.Client.Port := Port; 275 if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create;276 285 end; 277 286 try … … 292 301 procedure TMainForm.ADisconnectExecute(Sender: TObject); 293 302 begin 303 if Assigned(Core.System.Client) then 294 304 if Core.System.Client.Connected then begin 295 305 Core.System.Client.Disconnect;
Note:
See TracChangeset
for help on using the changeset viewer.