indexing description : "Wizard Final Step" author : "Generated by the Wizard wizard" revision : "1.0.0" class WIZARD_FINAL_STATE inherit WIZARD_FINAL_STATE_WINDOW redefine build, pixmap_location end create make feature -- Redefinition build is -- do the normal build but then start project creation process. local system: APPLICATION do Precursor system ?= current_application system.first_window.unlock_update -- allow window to update build_finish process_info system.first_window.lock_update -- lock window again end feature {NONE} -- Implementation build_finish is -- Build user entries. -- -- Note: You can remove this feature if you don't need -- a progress bar. --local --h1: EV_HORIZONTAL_BOX do choice_box.wipe_out choice_box.set_border_width (10) create progress progress.set_minimum_height(20) progress.set_minimum_width(100) create progress_text choice_box.extend(create {EV_CELL}) choice_box.extend(progress) choice_box.disable_item_expand(progress) choice_box.extend(progress_text) choice_box.extend(create {EV_CELL}) choice_box.set_background_color (white_color) progress.set_background_color (white_color) progress_text.set_background_color (white_color) end process_info is -- Process the wizard information -- connect to emu server, -- try to create new project local sock: NETWORK_STREAM_SOCKET system: APPLICATION rescued: BOOLEAN start_time, current_time: TIME msg: EMU_MESSAGE msg_ok: PROJECT_OK msg_error: PROJECT_ERROR do if not rescued then successful := False system ?= current_application total := 3 iteration := 0 system.process_events notify_user ("connecting to emu server...") system.process_events create sock.make_client_by_port (system.server_port, system.server_host) sock.connect if sock.is_open_write then notify_user ("creating emu project...") sock.independent_store (create {PROJECT_CREATE}.make (system.project_name, system.project_password)) from create current_time.make_now create start_time.make_now until (current_time.relative_duration(start_time)).seconds_count > 10 or else sock.readable loop current_time.make_now system.process_events end if sock.readable then -- server has sent an answer. msg ?= sock.retrieved if msg /= Void then msg_ok ?= msg if msg_ok /= Void then notify_user (msg_ok.ok_message) successful := True else msg_error ?= msg if msg_error /= Void then notify_user ("ERROR: " + msg_error.error_message) end end else notify_user ("ERROR: unknown server response!") end else -- timeout has reached, server has not answered. notify_user ("ERROR: server response timed out!") end else iteration := 0 notify_user ("ERROR: could not connect to the server!") end sock.cleanup else iteration := 0 notify_user ("EXCEPTION: connection or transmission failed!") end rescue rescued := True retry end display_state_text is -- Set the messages for this state. local system: APPLICATION do system ?= current_application title.set_text ("Completing the%Nnew EMU Project Wizard") message.set_text ("Project creation in progess using following settings: %N%N%N"+ "server host: %T" + system.server_host + "%N" + "server port: %T" + system.server_port.out + "%N%N" + "project name: %T%T" + system.project_name + "%N" + "project password: %T" + system.project_password) end final_message: STRING is do end pixmap_location: FILE_NAME is -- Pixmap location once create Result.make_from_string ("emu_wizard") Result.add_extension (pixmap_extension) end pixmap_icon_location: FILE_NAME is -- Icon for the Eiffel Store Wizard once create Result.make_from_string ("emu_icon_01.png") end -- can_go_next: BOOLEAN is -- -- can wizard finish? -- do -- Result := not successful -- end feature -- Attributes successful: BOOLEAN -- indicates that the project creation was successful. -- if True, the wizard may close normally. end -- class WIZARD_FINAL_STATE