function doDataImport($event) { $dialog = new wxFileDialog($this, '開啟檔案...', '', '', 'CSV 檔案 (*.csv)|*.csv', wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (wxID_OK != $dialog->ShowModal()) { return; } $selected_path = $dialog->GetPath(); $selected_folder = dirname($selected_path); echo "select: {$selected_path} at {$selected_folder}.\n"; $this->loadCSVFile($selected_path); }
function NotificationsCheckout($event) { foreach ($this->messages as $message) { $client_position = $message[0]; $action = $message[1]; $data = $message[2]; switch ($action) { case "file_transfer": if (wxMessageBox("Accept {$data}?", "File Transfer", wxYES_NO) == wxYES) { $fileDialog = new wxFileDialog($this, "Select output file", "", "", "All Files(*.*)|*.*", wxFD_SAVE); $fileDialog->SetFilename($data); $fileDialog->ShowModal(); $this->files_to_store[$client_position] = $fileDialog->GetPath(); $message = "accept_file,"; socket_write($this->m_user_sockets[$client_position], $message, strlen($message)); } else { $message = "cancel_file,"; socket_write($this->m_user_sockets[$client_position], $message, strlen($message)); } break; } } $this->messages = array(); }
function onBackupCompany($event) { $fileDialog = new \wxFileDialog($this, _("Backup to output file"), "", "", "Xiaris Company File|*.xia", wxFD_SAVE); if ($fileDialog->ShowModal() != wxID_CANCEL) { $path = str_ireplace(".xia", "", $fileDialog->GetPath()); $fileDialog->Destroy(); $path .= ".xia"; if (file_exists($path)) { if (wxMessageBox(_("The file already exists. Do you want to overwrite it?"), _("Warning!"), wxYES_NO) != wxYES) { print "test"; return; } } copy($this->company->GetFilePath(), $path); } }