Changeset 45 for trunk/Forms/UFormMain.pas
- Timestamp:
- Mar 12, 2012, 10:23:40 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r44 r45 61 61 Splitter1: TSplitter; 62 62 StatusBar1: TStatusBar; 63 ToolBar1: TToolBar; 64 ToolButton1: TToolButton; 65 ToolButton2: TToolButton; 66 ToolButton3: TToolButton; 67 ToolButton4: TToolButton; 68 ToolButton5: TToolButton; 63 69 TreeView1: TTreeView; 64 70 procedure AAboutExecute(Sender: TObject); … … 69 75 procedure AObjectEditExecute(Sender: TObject); 70 76 procedure AObjectGroupAddGroupExecute(Sender: TObject); 77 procedure AObjectGroupDeleteExecute(Sender: TObject); 71 78 procedure AObjectGroupEditExecute(Sender: TObject); 72 79 procedure ASettingsExecute(Sender: TObject); … … 154 161 155 162 procedure TMainForm.UpdateInterface; 156 begin 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; 163 var 164 I: Integer; 165 begin 166 ADisconnect.Enabled := Core.System.Active; 167 AConnect.Enabled := not Core.System.Active; 168 AImportStructure.Enabled := Core.System.Active; 160 169 if Assigned(MainPanelForm) then 161 170 Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name 162 171 else Caption := ApplicationInfo.Name; 163 172 Application.Title := Caption; 164 if Assigned(Core.Client)then165 with Core. Client do173 if Core.System.Active then 174 with Core.System.Client do 166 175 StatusBar1.Panels[0].Text := User + '@' + Host + ':' + IntToStr(Port) + '/' + Schema; 176 177 for I := 0 to ToolBar1.ButtonCount - 1 do 178 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption; 167 179 end; 168 180 … … 201 213 202 214 procedure TMainForm.AObjectGroupAddGroupExecute(Sender: TObject); 215 begin 216 217 end; 218 219 procedure TMainForm.AObjectGroupDeleteExecute(Sender: TObject); 203 220 begin 204 221 … … 270 287 try 271 288 LoginForm := TLoginForm.Create(MainForm); 272 Core.Profiles.LoadFromRegistry(Core.RegistryRootKey, Core.RegistryKey); 273 if LoginForm.ShowModal = mrOK then begin 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; 280 Core.System.Client.Host := HostName; 281 Core.System.Client.Schema := Database; 282 Core.System.Client.User := Core.LastUserName; 283 Core.System.Client.Password := Core.LastPassword; 284 Core.System.Client.Port := Port; 289 Core.Profiles.LoadFromRegistry(Core.RegistryRootKey, Core.RegistryKey); 290 if LoginForm.ShowModal = mrOK then begin 291 with TConnectProfile(Core.Profiles[Core.LastProfile]) do begin 292 FreeAndNil(Core.System.Client); 293 if Protocol = cpMySQL then Core.System.Client := TChronisClientMySQL.Create 294 else if Protocol = cpDirect then Core.System.Client := TChronisClientDirect.Create 295 else if Protocol = cpXMLRPC then Core.System.Client := TChronisClientXMLRPC.Create; 296 Core.System.Client.Host := HostName; 297 Core.System.Client.Schema := Database; 298 Core.System.Client.User := Core.LastUserName; 299 Core.System.Client.Password := Core.LastPassword; 300 Core.System.Client.Port := Port; 301 end; 302 try 303 Core.System.Active := True; 304 LoadTree; 305 except 306 on E: Exception do ShowMessage(E.Message); 307 end; 285 308 end; 286 try287 Core.System.Client.Connect;288 if Core.System.IsDatabaseEmpty then Core.System.ModuleSystem.Install;289 Core.System.LoadTypes;290 LoadTree;291 UpdateInterface;292 except293 on E: Exception do ShowMessage(E.Message);294 end;295 end;296 309 finally 297 310 LoginForm.Free; 311 UpdateInterface; 298 312 end; 299 313 end; … … 302 316 begin 303 317 if Assigned(Core.System.Client) then 304 if Core.System. Client.Connectedthen begin305 Core.System. Client.Disconnect;318 if Core.System.Active then begin 319 Core.System.Active := False; 306 320 TreeView1.Items.Clear; 307 Core.System.Types.Clear;308 FreeAndNil(Core.Client);309 Core.System.Client := Core.Client;310 321 end; 311 322 UpdateInterface;
Note:
See TracChangeset
for help on using the changeset viewer.