private void btnThucHien_Click(object sender, EventArgs e)
        {
            if (XL2.KiemtraKetnoiCSDL() == false)
            {
                return;
            }

            var thang = dtpThang.Value;

            #region confirm trước khi kết công
            if (MessageBox.Show(string.Format(Resources.Text_ConfirmKetCongBoPhan, thang.ToString("MM/yyyy")), Resources.Caption_XacNhan, MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }
            #endregion

            string filePath = string.Empty;
            saveFileDialog.ShowDialog();
            if (saveFileDialog.FileName != string.Empty)
            {
                filePath = saveFileDialog.FileName;
            }
            else
            {
                ACMessageBox.Show("Vui lòng nhập tên file.", Resources.Caption_ThongBao, 2000);
                return;
            }
            string tenNVLapBieu = tbTenNVLapbieu.Text;
            string tenTrgBP     = tbTenTrgBP.Text;
            XL.SaveSetting(lastTenNVLapBieuChamCong: tenNVLapBieu, lastTenTruongBP: tenTrgBP);

            try             //general try catch
            {
                #region lấy ds phòng ban 1. được thao tác, 2.check kết công
                List <cPhongBan> dsphongban = new List <cPhongBan>();
                // đưa về root node trước khi thực hiện
                var root = treePhongBan.TopNode;
                GetTopLevelNode(ref root);                // mỗi lần duyệt node sẽ làm root node chuyển về parent của node cuối nên phải trả về node gốc để duyệt từ đầu
                while (root.PrevNode != null)
                {
                    root = root.PrevNode;
                }
                GetNode_DuocThaotac_CheckKetcong(root, dsphongban);
                #endregion

                WaitWindow.Show(this.ThucHienKetCong, "Đang kết công, bạn vui lòng đợi trong giây lát...", new object[] { thang, dsphongban });
                WaitWindow.Show(this.XuatBBChamCong, "Đang xuất báo biểu, bạn vui lòng đợi trong giây lát...", new object[] { filePath, tenNVLapBieu, tenTrgBP, thang, dsphongban });
                //kết công xong thì đóng form
                Close();
            } catch (Exception ex)             //general try catch
            {
                lg.Error(string.Format("[{0}]_[{1}]\n", this.Name, System.Reflection.MethodBase.GetCurrentMethod().Name), ex);
                MessageBox.Show(Resources.Text_CoLoi, Resources.Caption_Loi);
            }
        }
Пример #2
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (dtpFecIni.Value == null && dtpFecFin.Value == null)
            {
                MessageBox.Show("Debe ingresar el rango de fechas a consultar ...", "Aviso al usuario", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                cmbPerPago.Focus();
                return;
            }

            int    option   = 0;
            string sql      = "";
            string rptName  = "";
            string rptTable = "";
            string ntext    = "Atenciones En" + (cmbConsultorio.SelectedIndex == -1 ? "" : " " + cmbConsultorio.SelectedText + ", ");

            ntext = ntext + " Consultorio " + cmbBus.SelectedText + ", Periodo " + cmbPerPago.SelectedText;
            ntext = ntext + "\t" + Operativo.id_oper + " - '" + Operativo.descripcion + "'";

            if (rbRecibos.Checked)
            {
                sql      = sqlResultado + "Order By CB.Fecha_Atencion,T.Nro_Ticket,Pr.Descripcion";
                option   = 1;
                rptName  = "rptRepTerDet";
                rptTable = "RepTerDet";
            }

            if (rbProductos.Checked)
            {
                sql      = "SELECT X.producto, SUM(X.cantidad) AS cantidad FROM (" + sqlResultado + ") X GROUP BY X.producto ORDER BY X.producto";
                option   = 2;
                rptName  = "rptRepTerRes";
                rptTable = "RepTerRes";
            }

            if (rbFechas.Checked)
            {
                sql      = sqlResumen;
                option   = 3;
                rptName  = "rptRepTerResDia";
                rptTable = "RepTerResDia";
            }

            object result = WaitWindow.Show(WorkerMethodRPT, "Procesando el reporte...", new object[] { option, sql, rptName, rptTable, ntext });

            if (result == null)
            {
                MessageBox.Show("No se pudo procesar el reporte.");
                return;
            }

            //llama al formulario que muestra el reporte
            frmCRViewer frg = new frmCRViewer(rpt);

            frg.ShowDialog();
        }
Пример #3
0
        private void OsirtGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewColumn newColumn = Columns[e.ColumnIndex];

            if (newColumn.HeaderText != "print")
            {
                return;
            }

            WaitWindow.Show(UncheckAll, "Working... Please Wait");
        }
Пример #4
0
 private void UiTabbedBrowserControl_ScreenshotComplete(object sender, EventArgs e)
 {
     //uiTabbedBrowserControl.CurrentTab.Browser.Enabled = false;
     if (RuntimeSettings.EnableWebDownloadMode && isDownloadingPage)
     {
         string savedDirectory = (string)WaitWindow.Show(SavePage, "Saving page... Please Wait");
         isDownloadingPage = false;
         Process.Start(savedDirectory);
     }
     uiBrowserToolStrip.Enabled        = true;
     uiBookmarkHelperToolStrip.Enabled = true;
 }
Пример #5
0
        private void DownloadQueueFile()
        {
            while (true)
            {
                if (!_downloadItems.Any())
                {
                    return;
                }

                var fileDirectoryInfo = _downloadItems.Dequeue();

                if (fileDirectoryInfo.IsDirectory)
                {
                    return;
                }

                if (_processWindow != null)
                {
                    _processWindow.Close(true);
                }

                _downloadedChangesCount = 250;
                var path = fileDirectoryInfo.Adress;
                var uri  = new Uri(path);
                _fileSize = _ftpClient.GetFileSize(fileDirectoryInfo.Adress);

                var newFile = Path.Combine(_neededDownloadDirectoryPath, fileDirectoryInfo.Name);

                if (File.Exists(newFile))
                {
                    if (
                        MessageBox.Show(
                            string.Format("Файл '{0}' уже существует в указанной папке, заменить файл?",
                                          fileDirectoryInfo.Name), "Предупреждение", MessageBoxButton.YesNo,
                            MessageBoxImage.Warning) != MessageBoxResult.Yes)
                    {
                        continue;
                    }
                }

                _processWindow = new WaitWindow {
                    Text = "Загрузка файла..."
                };
                _processWindow.Show(Window.GetWindow(this), true);

                _ftpClient.DownloadFileCompleted += OnFtpClientDownloadFileCompleted;
                _ftpClient.DownloadFileAsync(uri, newFile);
                break;
            }
        }
        private void uiNextButton_Click(object sender, EventArgs e)
        {
            bool isValid = AreValidEntries();

            if (!isValid)
            {
                return;
            }


            Dictionary <string, string> caseDetails = GetCaseDetails();

            WaitWindow.Show(CreateCase, Resources.strings.creating_case_wait, caseDetails);
            NextClick?.Invoke(this, e);
        }
Пример #7
0
        private void btnExportar_Click(object sender, EventArgs e)
        {
            //genera reporte y carga los datos
            object result = WaitWindow.Show(WorkerMethodRPT, "Generando el reporte...");

            if (result == null)
            {
                MessageBox.Show("No se pudo procesar el reporte.");
                return;
            }

            //llama al formulario que muestra el reporte
            frmCRViewer frg = new frmCRViewer(rpt);

            frg.ShowDialog();
        }
Пример #8
0
        protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
        {
            if (!m_CanDown)
            {
                return;
            }

            int row = (int)e.GetPosition(this).Y / StoneSize;
            int col = (int)e.GetPosition(this).X / StoneSize;

            if (NextOne(row, col))
            {
                m_CanDown = false;
                m_WaitWindow.Show();
            }
        }
Пример #9
0
        private void uiOpenCaseButton_Click(object sender, EventArgs e)
        {
            string enteredPassword   = uiPasswordTextBox.Text;
            bool   isCorrectPassword = (bool)WaitWindow.Show(VerifyPassword, "Verifying password... Please Wait", enteredPassword);

            if (isCorrectPassword)
            {
                WaitWindow.Show(LoadCase, "Extracting case... Please Wait", enteredPassword);
                PasswordCheckClick?.Invoke(this, e);
            }
            else
            {
                uiInvalidPasswordLabel.Visible = true;
                uiPasswordTextBox.Focus();
            }
        }
Пример #10
0
        private void NotificationMessageReceived(NotificationMessageEx message)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                if (message.Notification == MsgDestination.WindowApiExtension) // Csak akkor foglalkozunk az özenettel, ha nekünk szól
                {
                    switch (message.Command)
                    {
                    case MsgCommand.CloseWindow:
                        this.Close();
                        break;

                    case MsgCommand.ShowDialogQuestion:
                        DialogMessageEx dialogMessageEx = (DialogMessageEx)message.Parameters[0];

                        var result = MessageBox.Show(dialogMessageEx.Content, dialogMessageEx.Caption, MessageBoxButton.OKCancel, MessageBoxImage.Question);
                        dialogMessageEx.Callback.Invoke(result);
                        break;

                    case MsgCommand.ShowWaitWindow:

                        if (waitWindow != null)
                        {
                            waitWindow.Close();
                        }
                        waitWindow         = new WaitWindow("Loading please wait...");
                        waitWindow.Closed += waitWindow_Closed;
                        waitWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                        waitWindow.Owner = this;
                        waitWindow.Show();

                        break;

                    case MsgCommand.CloseWaitWindow:

                        if (waitWindow != null)
                        {
                            waitWindow.Closed -= waitWindow_Closed;
                            waitWindow.Close();
                            waitWindow = null;
                        }

                        break;
                    }
                }
            }));
        }
Пример #11
0
        private void WorkerFilesRow_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (StaffListBox.SelectedItem == null)
            {
                return;
            }

            var selectedFile = ((DataRowView)WorkerFilesList.SelectedItem)["FileName"].ToString();
            var workerPath   = GetWorkerPath(Convert.ToInt32(StaffListBox.SelectedValue));

            if (workerPath == null)
            {
                return;
            }

            var tempPath = Path.Combine(App.TempFolder, selectedFile);

            if (File.Exists(tempPath))
            {
                Process.Start(tempPath);
                return;
            }

            if (_ftpClient.IsBusy)
            {
                MessageBox.Show("В данный момент невозможно выполнить загрузку. Попробуйте позже");
                return;
            }

            _neededOpeningFilePath = tempPath;
            var filePath = string.Concat(_basicDirectory, workerPath, "/", selectedFile);
            var uri      = new Uri(filePath);

            if (_processWindow != null)
            {
                _processWindow.Close(true);
            }

            _processWindow = new WaitWindow {
                Text = "Загрузка файла..."
            };
            _processWindow.Show(Window.GetWindow(this), true);

            _fileSize = _ftpClient.GetFileSize(filePath);
            _ftpClient.DownloadFileCompleted += OnFtpClientDownloadFileCompleted;
            _ftpClient.DownloadFileAsync(uri, tempPath);
        }
Пример #12
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Desea imprimir los resultados seleccionados ... ?", "Aviso al usuario", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                //genera reporte y carga los datos
                object result = WaitWindow.Show(WorkerMethodRPT, "Generando el reporte...");
                if (result == null)
                {
                    MessageBox.Show("No se pudo procesar el reporte.");
                    return;
                }

                //llama al formulario que muestra el reporte
                frmCRViewer frg = new frmCRViewer(rpt);
                frg.ShowDialog();
            }
        }
Пример #13
0
        private void frmAutoUpdate_Load(object sender, EventArgs e)
        {
            var result = WaitWindow.Show(WorkerMethod, "正在更新");

            _blnFlag = bool.Parse(result.ToString());
            if (!_blnFlag)
            {
                label1.Text = @"更新出错,请联系系统管理员";
            }
            else
            {
                if (File.Exists(GetFilePath("image", "warning.png")))
                {
                    pictureBox1.Image = Image.FromFile(GetFilePath("image", "warning.png"));
                }
            }
        }
Пример #14
0
        void exportar()
        {
            generateSQL();

            //genera reporte y carga los datos
            object result = WaitWindow.Show(WorkerMethodRPT, "Generando el reporte...");

            if (result == null)
            {
                MessageBox.Show("No se pudo procesar el reporte.");
                return;
            }

            //llama al formulario que muestra el reporte
            frmCRViewer frg = new frmCRViewer(rpt);

            frg.ShowDialog();
        }
Пример #15
0
        private void uiExportAsPDFToolStripButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.Filter           = "PDF files|*.pdf";
            saveDialog.AddExtension     = true;
            saveDialog.RestoreDirectory = true;

            if (saveDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string file = saveDialog.FileName;

            WaitWindow.Show(CreatePDF, "Generating PDF. Please wait...", file);
            System.Diagnostics.Process.Start(file); //TODO: have as an option
        }
Пример #16
0
        private void UploadQueueFile()
        {
            while (true)
            {
                if (!_uploadItems.Any())
                {
                    return;
                }

                if (_processWindow != null)
                {
                    _processWindow.Close(true);
                }

                _uploadedChangesCount = 250;
                var filePath = _uploadItems.Dequeue();
                var adress   = string.Concat(_neededUploadDirectoryPath, Path.GetFileName(filePath));
                var uri      = new Uri(adress);

                if (_ftpClient.FileExist(adress))
                {
                    if (
                        MessageBox.Show(
                            string.Format("Файл '{0}' уже существует в указанной папке, заменить файл?",
                                          Path.GetFileName(filePath)), "Предупреждение", MessageBoxButton.YesNo,
                            MessageBoxImage.Warning) != MessageBoxResult.Yes)
                    {
                        continue;
                    }
                }

                _processWindow = new WaitWindow {
                    Text = "Загрузка файла..."
                };
                _processWindow.Show(Window.GetWindow(this), true);

                _ftpClient.UploadFileCompleted += OnFtpClientUploadFileCompleted;
                _ftpClient.UploadFileAsync(uri, "STOR", filePath);
                break;
            }

            Thread.Sleep(200);
            FillViews(_ftpClient.CurrentPath);
        }
Пример #17
0
 private void Download()
 {
     try
     {
         var dir = (string)WaitWindow.Show(DownloadWorker, @"Downloading update file(s)");
         var msg = MessageBox.Show(@"Done! Open download location?", @"Question",
                                   MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (msg == DialogResult.Yes)
         {
             Process.Start(dir);
         }
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Error downloading your update files\n{ex}", @"Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #18
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (this.VTot_Users.Count == 0)
            {
                MessageBox.Show("'No hay resultados a imprimir ...", "Aviso al usuario");
                return;
            }

            object result = WaitWindow.Show(WorkerMethodRpt, "Generando el reporte...", new string[] { "SOP" });

            if (result == null)
            {
                MessageBox.Show("No se pudo procesar el reporte.");
                return;
            }

            frmCRViewer frg = new frmCRViewer(rpt);

            frg.ShowDialog();
        }
Пример #19
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            string fi = dtpicFInicial.Value.ToShortDateString();
            string ff = dtpFFinal.Value.ToShortDateString();
            string us = cmbUsuario.SelectedIndex == -1 ? "" : usTal[cmbUsuario.SelectedIndex]["Id_Us"];
            string op = cmbOperativo.SelectedIndex == -1 ? "" : cmbOperativo.SelectedValue.ToString();

            //genera reporte y carga los datos
            object result = WaitWindow.Show(WorkerMethodRPT, "Generando el reporte...", new string[] { fi, ff, us, op });

            if (result == null)
            {
                MessageBox.Show("No se pudo procesar el reporte.", "Aviso al usuario", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return;
            }

            //llama al formulario que muestra el reporte
            frmCRViewer frg = new frmCRViewer(rpt);

            frg.ShowDialog();
        }
Пример #20
0
        private void btnXuatBangChiTiet_Click(object sender, EventArgs e)
        {
            if (XL.Kiemtra(m_Thang.Date, MyUtility.LastDayOfMonth(m_Thang)) == false)
            {
                MessageBox.Show(string.Format("Tháng {0} chưa kết lương!", m_Thang.ToString("MM/yyyy")), Resources.Caption_ThongBao);
                return;
            }

            if (saveFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            if (saveFileDialog.FileName == string.Empty)
            {
                return;
            }

            string saveFileName = saveFileDialog.FileName;

            WaitWindow.Show(this.XuatBangChiTiet, "Đang xuất bảng chi tiết. Bạn vui lòng đợi...", saveFileName);
        }
Пример #21
0
        private void OpenFile(FtpFileDirectoryInfo fileDirectoryInfo)
        {
            if (fileDirectoryInfo.IsDirectory)
            {
                return;
            }

            var filePath = Path.Combine(App.TempFolder, fileDirectoryInfo.Name);

            if (File.Exists(filePath))
            {
                Process.Start(filePath);
                return;
            }

            if (_ftpClient.IsBusy)
            {
                MessageBox.Show("В данный момент невозможно выполнить загрузку. Попробуйте позже");
                return;
            }

            _downloadedChangesCount = 250;
            _neededOpeningFilePath  = filePath;
            var path = fileDirectoryInfo.Adress;
            var uri  = new Uri(path);

            if (_processWindow != null)
            {
                _processWindow.Close(true);
            }

            _processWindow = new WaitWindow {
                Text = "Загрузка файла..."
            };
            _processWindow.Show(Window.GetWindow(this), true);

            _fileSize = _ftpClient.GetFileSize(fileDirectoryInfo.Adress);
            _ftpClient.DownloadFileCompleted += OnFtpClientDownloadAndOpenFileCompleted;
            _ftpClient.DownloadFileAsync(uri, filePath);
        }
Пример #22
0
        public void LoadSteps()
        {
            LoadStepWindow dlg = new LoadStepWindow();

            dlg.ShowDialog();

            var waitWindow = new WaitWindow();

            waitWindow.Show();
            var old = m_Record;

            m_Record = dlg.Record;
            if (m_Record == null && old != null)
            {
                m_Record = old;
            }
            if (m_Record != null)
            {
                ShowAll();
            }
            waitWindow.Close();
        }
Пример #23
0
		public static void LongOperation(this Control source, Action action)
		{
//			var progress = new ProgressWindow {LongAction = action};
//			return progress.ShowDialog(source) == DialogResult.OK;

			var wait = new WaitWindow();
			source.Enabled = false;
			try
			{
				source.UseWaitCursor = true;
				wait.Show(source);
				Application.DoEvents();
				action();
				Application.DoEvents();
			}
			finally
			{
				wait.Hide();
				source.UseWaitCursor = false;
				source.Enabled = true;
			}
		}
Пример #24
0
        public bool exportar()
        {
            nfe = txtPath.Text + txtNomFile.Text + "." + cmbTipo.SelectedItem.ToString();
            if (File.Exists(nfe))
            {
                if (MessageBox.Show("El archivo ya existe, desea reemplazarlo ... ?", "Advertencia", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    txtNomFile.Focus();
                    return(false);
                }
            }

            dataTable = Conexion.GetTable(sql);
            if (cmbTipo.SelectedItem.ToString() == "XLSX" && dataTable.Rows.Count > max_records)
            {
                if (MessageBox.Show("Cantidad de registros mayor a " + max_records.ToString() + ", desea continuar ...?", "Advertencia", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return(false);
                }
            }
            return((bool)WaitWindow.Show(WorkerMethod, "Generando el archivo..."));
        }
Пример #25
0
        private void btnSOP_Click(object sender, EventArgs e)
        {
            if (txtSOP.Text.Length == 0)
            {
                MessageBox.Show("Ingrese monto para Sala de Operaciones ...", "Advertencia");
                return;
            }

            this.subtitle = (cmbConsultorio.SelectedIndex != -1 ? "CONSULTORIO: " + cmbConsultorio.SelectedText : "");

            object result = WaitWindow.Show(WorkerMethodRptProdMedPrcSOP, "Generando el reporte...", new string[] { "SOP" });

            if (result == null)
            {
                MessageBox.Show("No se pudo procesar el reporte.");
                return;
            }

            frmCRViewer frg = new frmCRViewer(rpt);

            frg.ShowDialog();
        }
        private async void ApplyChanges()
        {
            if (SourceSearchResults.Any(s => s.TuSelected))
            {
                System.Windows.Application.Current.Dispatcher.Invoke(delegate
                {
                    _waitWindow = new WaitWindow();
                    _waitWindow.Show();
                });
                var selectedSearchResult = SourceSearchResults.Where(s => s.TuSelected).ToList();
                List <AnonymizeTranslationMemory> tusToAnonymize;
                //file base tms
                var fileBasedSearchResult = selectedSearchResult.Where(t => !t.IsServer).ToList();
                if (fileBasedSearchResult.Count > 0)
                {
                    BackupFileBasedTm();
                    tusToAnonymize = GetTranslationUnitsToAnonymize(fileBasedSearchResult);
                    Tm.AnonymizeFileBasedTu(tusToAnonymize);
                }
                //server based tms
                var serverBasedSearchResult = selectedSearchResult.Where(t => t.IsServer).ToList();
                if (serverBasedSearchResult.Count > 0)
                {
                    tusToAnonymize = GetTranslationUnitsToAnonymize(serverBasedSearchResult);
                    var uri = new Uri(_tmViewModel.Credentials.Url);
                    var translationProvider = new TranslationProviderServer(uri, false, _tmViewModel.Credentials.UserName,
                                                                            _tmViewModel.Credentials.Password);

                    BackupServerBasedTm(translationProvider, tusToAnonymize);
                    Tm.AnonymizeServerBasedTu(translationProvider, tusToAnonymize);
                }
                RemoveSelectedTusToAnonymize();
                _waitWindow?.Close();
            }
            else
            {
                await _dialogCoordinator.ShowMessageAsync(this, "", "Please select at least one translation unit to apply the changes");
            }
        }
        void Ribbon_HaRepackerClicked()
        {
            WaitWindow ww = new WaitWindow("Opening HaRepacker...");

            ww.Show();
            Application.DoEvents();
            HaRepacker.Program.WzMan = new HaRepacker.WzFileManager();
            bool firstRun = HaRepacker.Program.PrepareApplication(false);

            HaRepacker.GUI.MainForm mf = new HaRepacker.GUI.MainForm(null, false, firstRun);
            mf.unloadAllToolStripMenuItem.Visible = false;
            mf.reloadAllToolStripMenuItem.Visible = false;
            foreach (KeyValuePair <string, WzFile> entry in Program.WzManager.wzFiles)
            {
                mf.Interop_AddLoadedWzFileToManager(entry.Value);
            }
            ww.EndWait();
            lock (multiBoard)
            {
                mf.ShowDialog();
            }
            HaRepacker.Program.EndApplication(false, false);
        }
Пример #28
0
        /// <summary>
        /// Retrieve a GitHub API update resource
        /// </summary>
        /// <param name="resource">The relative path; not a complete URI</param>
        /// <param name="waitWindow"></param>
        /// <returns></returns>
        private string GetUpdateInfo(string resource, bool waitWindow = true)
        {
            if (waitWindow)
            {
                return((string)WaitWindow.Show(GetUpdateInfo, @"Contacting GitHub", resource));
            }

            var client = GetRestClient();

            client.UseJson();

            var request = new RestRequest {
                Resource = resource
            };
            var response = client.Execute(request);

            var apiJson = response.Content;

            //log json (pretty-printed)
            LogApiResponse(apiJson, true);

            return(apiJson);
        }
Пример #29
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (lstCIE10.Items.Count > 0)
            {
                string consul = cmbConsultorio.SelectedIndex == -1 ? "" : cmbConsultorio.SelectedValue.ToString();
                string fi     = dtpFecIni.Value.ToShortDateString();
                string ff     = dtpFecFin.Value.ToShortDateString();

                object result = WaitWindow.Show(WorkerMethodRpt, "Generando el reporte...", new string[] { consul, fi, ff });

                if (result == null)
                {
                    MessageBox.Show("No se pudo procesar el reporte.");
                    return;
                }

                frmCRViewer frg = new frmCRViewer(rpt);
                frg.ShowDialog();
            }
            else
            {
                MessageBox.Show("No hay datos para exportar\n\nDebe de realizar otra consulta", "Aviso");
            }
        }
        void MultiBoard_ImageDropped(Board selectedBoard, System.Drawing.Bitmap bmp, string name, Microsoft.Xna.Framework.Point pos)
        {
            WaitWindow ww = new WaitWindow("Processing \"" + name + "\"...");

            ww.Show();
            Application.DoEvents();
            ObjectInfo oi = null;

            try
            {
                oi = multiBoard.UserObjects.Add(bmp, name);
            }
            catch (NameAlreadyUsedException)
            {
                MessageBox.Show("\"" + name + "\" could not be added because an object with the same name already exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            finally
            {
                ww.EndWait();
            }
            selectedBoard.BoardItems.Add(oi.CreateInstance(selectedBoard.SelectedLayer, selectedBoard, pos.X, pos.Y, 0, false), true);
            objPanel.OnL1Changed(UserObjectsManager.l1);
        }
Пример #31
0
        private void CheckAdvancedOptions()
        {
            CefSettings settings = new CefSettings();

            string cefProxy    = "";
            string torProxy    = "127.0.0.1:8182";
            int    controlPort = 9051;

            if (File.Exists(Constants.ProxySettingsFile))
            {
                string[] lines = File.ReadAllLines(Constants.ProxySettingsFile);

                var dict = lines.Select(l => l.Split('=')).ToDictionary(a => a[0], a => a[1]);
                cefProxy    = dict["cefProxy"];
                torProxy    = dict["torProxy"];
                controlPort = int.Parse(dict["torPort"]);
                if (dict.ContainsKey("disablewebrtc"))
                {
                    bool webRtc = false;
                    if (bool.TryParse("disablewebrtc", out webRtc))
                    {
                        OsirtHelper.DisableWebRtc = Convert.ToBoolean(dict["disablewebrtc"].Trim());
                    }
                }
            }
            //DPI settings >100% break screenshots. This prevents cefsharp from auto scaling the browser, meaning screenshots don't break.
            settings.CefCommandLineArgs.Add("force-device-scale-factor", "1");
            //settings.CefCommandLineArgs.Add("--enable-system-flash", "1");

            if (RuntimeSettings.EnableWebDownloadMode)
            {
                settings.CefCommandLineArgs.Add("disable-application-cache", "1");
            }


            if (!string.IsNullOrEmpty(userAgent))
            {
                settings.UserAgent = userAgent;
            }
            if (!RuntimeSettings.IsUsingTor)
            {
                if (!string.IsNullOrWhiteSpace(cefProxy))
                {
                    settings.CefCommandLineArgs.Add("proxy-server", cefProxy);
                }

                Cef.Initialize(settings);
                return;
            }

            //tor settings
            settings.CefCommandLineArgs.Add("proxy-server", "socks5://127.0.0.1:9050");



            Process[] previous = Process.GetProcessesByName("tor");
            if (previous != null && previous.Length > 0)
            {
                foreach (Process p in previous)
                {
                    p.Kill();
                }
            }

            var process = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName       = @"Tor\Tor\tor.exe",
                    CreateNoWindow = true,
                    WindowStyle    = ProcessWindowStyle.Hidden
                }
            };

            process.Start();
            WaitWindow.Show(LoadTor, "Loading Tor... Please Wait. This will take a few seconds.");
            Cef.Initialize(settings);
        }
Пример #32
0
		private void menuItemReportExport_Click(object sender, EventArgs e)
		{
			
#if DEBUG && USE_TDISK
			var basePath = Path.Combine(@"T:\", Scenario.LastReportId.ToString());
#else
			var basePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Scenario.LastReportId.ToString());
#endif
			var reportFile = new FileInfo(basePath + ".doc");
			//var calcFile = new FileInfo(basePath + ".c.html");
			//var sourceDataFile = new FileInfo(basePath + ".s.html");

			if (!reportFile.Exists)
			{
				MessageBox.Show(this, "Для того, чтобы выгрузить отчет, последний должен быть сперва сгенерирован", "Модуль выгрузки данных", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
				return;
			}

			var fullPath = "";
			var ww = new WaitWindow();

			try
			{
				ww.Show(this);
				Func<IBranch, ScenarioNodeType> nodeType = b => b.GetValue("nodeType") == null
				                                                	? ScenarioNodeType.Default
				                                                	:
				                                                		(ScenarioNodeType) Enum.Parse(typeof (ScenarioNodeType), b.GetValue("nodeType").ContentString);
				var all = Scenario.Vault.GetBranchesRecursive().ToDictionary(b => b, nodeType);
				var forExport = all.Where(kvp => kvp.Value == ScenarioNodeType.ForExport).FirstOrDefault();

				Application.DoEvents();

				using (var repo = RepositoryEditor.Repository())
				{
					var now = DateTime.Now;
					var name = String.Format("{0:00}.{1:00}.{2:0000} {3:00}{4:00}{5:00}", now.Day, now.Month, now.Year, now.Hour, now.Minute, now.Second);
					var root = repo.GetOrCreateBranch("Для выгрузки");
					var receiver = root.GetOrCreateBranch(name);
					fullPath = receiver.VPath.Path;

					if (!TryCreateFileStreamForTempCopy(reportFile, x => receiver.CreateValue("Отчет.doc", x).SetTypeToken2("binary"))) return;

					if (forExport.Key != null)
					{
						var node = new ScenarioNode(forExport.Key);

						//#warning Review this: eval sessions now lock the vault for reading

#if VAULT_EVAL_1
                    using (_evalSession1 = new Esath.Eval.Ver1.EvalSession(Scenario.Vault, repo))
                    {
#endif

#if VAULT_EVAL_2
						using (_evalSession2 = new Esath.Eval.Ver2.EvalSession(Scenario.Vault, repo, null))
						{
#endif

#if VAULT_EVAL_3
                    using (_evalSession3 = new Esath.Eval.Ver3.EvalSession(Scenario.VaultCompiler, repo))
                    {
#endif

							var source = Regex.Replace(node.Template, StartUp.VFIELD_PATTERN, vpathEvaluator, RegexOptions.Compiled);
							source = "<html><head></head><body>" + source + "</body></html>";
							receiver.CreateValue("Расчетные Данные.html", new TempHtmlFile(source).Content).SetTypeToken2("binary");
						}
					}

					var buf = new StringBuilder(32*1024);
					buf.Append("<html><head></head><body>");
					buf.Append("<table border=1>");
					buf.Append("<tr><th>Имя</th><th>Значение</th><th>Ед Изм</th><th>Тип</th></tr>");
					foreach (var sourceValueDeclaration in Scenario.AllSourceValueDeclarations)
					{
						buf.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>",
						                 sourceValueDeclaration.Name,
						                 sourceValueDeclaration.Value,
						                 sourceValueDeclaration.MeasurementUnit == "" ? "&nbsp;" : sourceValueDeclaration.MeasurementUnit,
						                 sourceValueDeclaration.HumanType
							);
					}
					buf.Append("</table>");
					buf.Append("</body></html>");
					receiver.CreateValue("Исходные Данные.html", new TempHtmlFile(buf.ToString()).Content).SetTypeToken2("binary");

					repo.Save();
				}
			}
			finally
			{
				ww.Hide();
				ww = null;
				Application.DoEvents();
			}
			MessageBox.Show(this, string.Format("Данные текущего отчета успешно выгружены в ветвь Репозитория '{0}'", fullPath), "Модуль выгрузки данных", MessageBoxButtons.OK, MessageBoxIcon.Information);
		}