private void ImportImages(DiscogsRelease discogsRelease)
        {
            bool replaceImages = true;

            if (this.release.Images.Count > 0)
            {
                replaceImages = Dialogs.YesNoQuestion("Replace existing release images?");
            }

            if (replaceImages)
            {
                foreach (Image image in this.release.Images.ToArray())
                {
                    this.imagesEditor.RemoveImage(image);
                }
            }

            WaitWindow waitWindow = new WaitWindow("Downloading images. Please wait.");

            Progress <double> progress = new Progress <double>();

            waitWindow.ShowDialog(this.window, new Task(() =>
            {
                this.DownloadImagesAsync(discogsRelease, progress);
            }), progress);
        }
Esempio n. 2
0
 public frmWait(WaitWindow parent)
 {
     InitializeComponent();
     this._Parent = parent;
     this.Top     = Screen.PrimaryScreen.WorkingArea.Top + 32;
     this.Left    = Screen.PrimaryScreen.WorkingArea.Right - this.Width - 32;
 }
        public void Run()
        {
            this.waitWindow = new WaitWindow("Searching for cover art...");
            this.waitWindow.ShowDialog(this.ParentWindow, () =>
            {
                BlockingCollection <ReleaseData> releaseData = new BlockingCollection <ReleaseData>(6);

                Thread addingThread = new Thread(this.AddingThread);
                addingThread.Start(releaseData);

                for (int releaseNumber = 1; ; ++releaseNumber)
                {
                    ReleaseData release;
                    if (!releaseData.TryTake(out release, -1))
                    {
                        break;
                    }

                    if (!this.ChooseReleasePicture(release, releaseNumber))
                    {
                        addingThread.Abort();
                        break;
                    }
                }

                addingThread.Join();
            });

            CollectionManagerGlobal.OnCollectionChanged();
        }
        private void OnXmlFileDropped(string file)
        {
            if (this.DatabaseRelease.Images.Count != 0 || this.DatabaseRelease.AdditionalFiles.Count != 0)
            {
                if (!Dialogs.Confirm("This will replace all images, additional files and other data. Continue?"))
                {
                    return;
                }
            }

            WaitWindow waitWindow = new WaitWindow("Reading release data...");

            waitWindow.ShowDialog(this, () =>
            {
                var tempFactory = new MemorySessionFactory();
                var tempManager = tempFactory.CreateCollectionManager();

                using (XmlReleaseImporter xmlReleaseImporter = new XmlReleaseImporter(file, tempManager))
                {
                    Release release = xmlReleaseImporter.ImportRelease();

                    this.Dispatcher.InvokeAction(() =>
                    {
                        this.LoadDataFromRelease(release, tempManager.ImageHandler);

                        tempManager.Dispose();
                        tempFactory.Dispose();
                    });
                }
            });
        }
Esempio n. 5
0
        public void Run()
        {
            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderDialog.ShowNewFolderButton = true;
            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitWindow waitWindow = new WaitWindow("Importing collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    try
                    {
                        using (DirectoryCollectionImporter importer = new DirectoryCollectionImporter(folderDialog.SelectedPath, this.CollectionManager))
                        {
                            importer.Import();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utility.WriteToErrorLog("Error importing: " + ex.ToString());
                        MessageBox.Show("Error importing backup: " + ex.Message);
                    }

                    this.ParentWindow.Dispatcher.BeginInvokeAction(() =>
                    {
                        CollectionManagerGlobal.OnCollectionChanged();
                    });
                });
            }
        }
Esempio n. 6
0
        public void Test(object o)
        {
            WaitWindow waitcontrol = new WaitWindow();


            // System.Windows.MessageBox.Show("The file type is wrong!");
            waitcontrol.Show();


            Task task = Task.Run(() =>
            {
                for (int i = 0; i < 10000; i++)
                {
                    for (int j = 0; j < 1000; j++)
                    {
                        for (int m = 0; m < 1000; m++)
                        {
                        }
                    }
                }
            });

            task.Wait();
            System.Windows.MessageBox.Show("The file typewwg!");
            waitcontrol.Close();
        }
        public void Run()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Zip Files (*.zip)|*.zip|" + Utility.AllFilesFilter;
            if (openFileDialog.ShowDialog() == true)
            {
                WaitWindow waitWindow = new WaitWindow("Importing collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    try
                    {
                        using (CollectionImporterBase importer = new ArchivedCollectionImporter(openFileDialog.FileName, this.CollectionManager))
                        {
                            importer.Import();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utility.WriteToErrorLog("Error importing: " + ex.ToString());
                        MessageBox.Show("Error importing backup: " + ex.Message);
                    }

                    this.ParentWindow.Dispatcher.BeginInvokeAction(() =>
                    {
                        CollectionManagerGlobal.OnCollectionChanged();
                    });
                });
            }
        }
        private void btnXuatBB_Click(object sender, EventArgs e)
        {
            string tenTrgBP = tbTenTruongBP.Text, tenNVLapBieu = tbTenNVNhapLieu.Text;

            XL.SaveSetting(lastTenNVLapBieuChamCong: tenNVLapBieu, lastTenTruongBP: tenTrgBP);

            if (XL2.KiemtraKetnoiCSDL() == false)
            {
                return;
            }

            #region lấy save file name

            saveFileDlg.ShowDialog();
            if (saveFileDlg.FileName == String.Empty)
            {
                return;
            }
            var saveFileName = saveFileDlg.FileName;

            #endregion

            if (radBB_ChamCongThang.Checked)
            {
                WaitWindow.Show(this.XuatBBKetCongThang, "Đang xử lý. Bạn vui lòng đợi trong giây lát...", new object[] { saveFileName, tenNVLapBieu, tenTrgBP });
            }
            else if (radioButton2.Checked)
            {
                WaitWindow.Show(this.XuatBBGioKoDungQuyDinh_Va_DiTreVesom, "Đang xử lý. Bạn vui lòng đợi trong giây lát...", new object[] { saveFileName });
            }
        }
Esempio n. 9
0
        public void Run()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Zip Files (*.zip)|*.zip|" + Utility.AllFilesFilter;
            if (openFileDialog.ShowDialog() == true)
            {
                WaitWindow waitWindow = new WaitWindow("Importing collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    try
                    {
                        using (CollectionImporterBase importer = new ArchivedCollectionImporter(openFileDialog.FileName, this.CollectionManager))
                        {
                            importer.Import();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utility.WriteToErrorLog("Error importing: " + ex.ToString());
                        MessageBox.Show("Error importing backup: " + ex.Message);
                    }

                    this.ParentWindow.Dispatcher.BeginInvokeAction(() =>
                    {
                        CollectionManagerGlobal.OnCollectionChanged();
                    });
                });
            }
        }
Esempio n. 10
0
        public void HideProgress()
        {
            _event.Set();

            _currentBackgoundTaskWindow = null;
            _isProgressBarActive        = false;
        }
Esempio n. 11
0
        private void btnKetLuong_Click(object sender, EventArgs e)
        {
            if (XL2.KiemtraKetnoiCSDL() == false)
            {
                return;
            }

            XL.SaveSetting(lastTenNVLapBieuLuong: tbTenNVLapbieuLuong.Text);

            //nếu đã kết lương tháng này rồi thì ko cho kết lương, phải hủy kết lương trước
            #region ko cho chỉnh sửa giờ nếu khoảng thời gian xem công tồn tại các ngày đã kết lương

            if (XL.Kiemtra(m_Thang.Date, MyUtility.LastDayOfMonth(m_Thang)))
            {
                MessageBox.Show(string.Format("Tháng {0} đã kết lương! Trường hợp muốn kết lương lại tháng này yêu cầu hủy kết lương tháng và thực hiện kết lương lại.", m_Thang.ToString("MM/yyyy")),
                                Resources.Caption_ThongBao);
                return;
            }

            #endregion
            WaitWindow.Show(this.KetLuong, "Đang kết lương tháng. Bạn vui lòng đợi trong giây lát...");

            saveFileDialog.ShowDialog();
            if (saveFileDialog.FileName != string.Empty)
            {
                string saveFileName = saveFileDialog.FileName;
                WaitWindow.Show(this.XuatBBLuong, "Đang xuất bảng kết lương. Bạn vui lòng đợi...",
                                new object[] { tbTenNVLapbieuLuong.Text, saveFileName });
            }
        }
Esempio n. 12
0
        //刷新初始化界面
        public void RefreshList(bool initTree = true)
        {
            This.Dispatcher.Invoke(() => {
                This.WaitEvent(() =>
                {
                    ClearUI();
                    WaitWindow.ChangeCallback(0, 10);
                    Thread.Sleep(100);
                    initlocalList();
                    WaitWindow.ChangeCallback(0, 30);
                    Thread.Sleep(100);
                    InitRemoteList();
                    WaitWindow.ChangeCallback(0, 50);
                    Thread.Sleep(100);
                    InitRelativeList();
                    WaitWindow.ChangeCallback(0, 100);
                    Thread.Sleep(100);
                });
            });
            Binging();

            AllRemoteFilesCheckBox.IsChecked = false;
            AllLocalFilesCheckBox.IsChecked  = false;
            P2PConfig.This.SetFileDir(IP, DirRelative);
        }
Esempio n. 13
0
        public void ShowProgress(bool centerOwner = true)
        {
            if (_isProgressBarActive)
            {
                throw new Exception("Progress Bar is active!");
            }

            _isProgressBarActive = true;

            var thread = new Thread(() =>
            {
                _currentProgressBarWindow         = new WaitWindow((param) => _event.WaitOne(), null, null);
                _currentProgressBarWindow.Closed += (sender1, e1) => _currentProgressBarWindow.Dispatcher.InvokeShutdown();

                if (MainWindowInitialized)
                {
                    _currentBackgoundTaskWindow.Owner = MainWindow;
                }

                _currentProgressBarWindow.WindowStartupLocation = centerOwner
                                                                        ? WindowStartupLocation.CenterOwner
                                                                        : WindowStartupLocation.CenterScreen;

                _currentProgressBarWindow.Show();
                Dispatcher.Run();
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();

            _isProgressBarActive = true;
        }
Esempio n. 14
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (txtPaciente.Text.Length == 0)
            {
                return;
            }

            if (this.preimpexp(this.id_paciente) == 0)
            {
                MessageBox.Show("No se hallaron registros ... ", "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();
        }
Esempio n. 15
0
        private void OnArtikelInfosAbrufen(Window window)
        {
            var errorText = string.Empty;

            if (!string.IsNullOrWhiteSpace(DatenbankId))
            {
                var index = DatenbankId.IndexOf(':');
                if (index > 0)
                {
                    var produktId = DatenbankId.Substring(index + 1);

                    if (!string.IsNullOrWhiteSpace(produktId))
                    {
                        var datenbanken = new List <DatenbankDto>
                        {
                            new DatenbankDto {
                                Datenbank = DatenbankAnzeigeString
                            }
                        };

                        PluginManager.DbManager.GetDatenbankDaten(ref datenbanken);

                        var dialog = new WaitWindow(DatenbankAnzeigeString,
                                                    datenbanken[0].ApiToken,
                                                    "",
                                                    "",
                                                    produktId)
                        {
                            Owner = window
                        };
                        dialog.ShowDialog();
                        if (dialog.Success)
                        {
                            DatenbankInfos = dialog.ResultProduktString;
                        }
                        else
                        {
                            errorText = dialog.ErrorText;
                        }
                    }
                    else
                    {
                        errorText = "Verknüpfung zur Gewichtsdatenbank fehlerhaft.";
                    }
                }
                else
                {
                    errorText = "Verknüpfung zur Gewichtsdatenbank fehlerhaft.";
                }
            }
            else
            {
                errorText = "Verknüpfung zur Gewichtsdatenbank fehlerhaft.";
            }

            if (!string.IsNullOrWhiteSpace(errorText))
            {
                HilfsFunktionen.ShowMessageBox(window, "Teileliste", errorText, true);
            }
        }
        private void uiOKButton_Click(object sender, EventArgs e)
        {
            if (FileExtension == SaveableFileTypes.Pdf)
            {
                WaitWindow.Show(SaveAsOther, "Saving as PDF. Please Wait...", new ImageSaveOptions(FileName, MagickFormat.Pdf, SaveableFileTypes.Pdf));
            }
            else if (FileExtension == SaveableFileTypes.Png)
            {
                SaveAsPng(FileName);
            }
            else if (FileExtension == SaveableFileTypes.Jpg)
            {
                WaitWindow.Show(SaveAsOther, "Saving as JPG. Please Wait...", new ImageSaveOptions(FileName, MagickFormat.Jpg, SaveableFileTypes.Jpg));
            }
            else
            {
                SaveAs();
            }

            //May be an error, so we don't want to close without checking
            if (successful)
            {
                Logger.Log(new WebpageActionsLog(Url, action, Hash, FileName + FileExtension, Note));

                if (UserSettings.Load().CopyImage)
                {
                    CopyImage();
                }

                DialogResult = DialogResult.OK;
                Close();
            }
        }
        public void Run()
        {
            this.waitWindow = new WaitWindow("Searching for cover art...");
            this.waitWindow.ShowDialog(this.ParentWindow, () =>
            {
                BlockingCollection<ReleaseData> releaseData = new BlockingCollection<ReleaseData>(6);

                Thread addingThread = new Thread(this.AddingThread);
                addingThread.Start(releaseData);

                for (int releaseNumber = 1; ; ++releaseNumber)
                {
                    ReleaseData release;
                    if (!releaseData.TryTake(out release, -1))
                    {
                        break;
                    }

                    if (!this.ChooseReleasePicture(release, releaseNumber))
                    {
                        addingThread.Abort();
                        break;
                    }
                }

                addingThread.Join();
            });

            CollectionManagerGlobal.OnCollectionChanged();
        }
        public void Run()
        {
            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderDialog.ShowNewFolderButton = true;
            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitWindow waitWindow = new WaitWindow("Importing collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    try
                    {
                        using (DirectoryCollectionImporter importer = new DirectoryCollectionImporter(folderDialog.SelectedPath, this.CollectionManager))
                        {
                            importer.Import();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utility.WriteToErrorLog("Error importing: " + ex.ToString());
                        MessageBox.Show("Error importing backup: " + ex.Message);
                    }

                    this.ParentWindow.Dispatcher.BeginInvokeAction(() =>
                    {
                        CollectionManagerGlobal.OnCollectionChanged();
                    });
                });
            }
        }
Esempio n. 19
0
 private string GetUpdateInfo()
 {
     if (WaitWindowWorker)
     {
         return((string)WaitWindow.Show(GetUpdateInfoWorker, @"Contacting GitHub"));
     }
     return(ApiContact());
 }
Esempio n. 20
0
        private void UploadFiles(IEnumerable <string> filePaths, int workerId)
        {
            if (_ftpClient.IsBusy)
            {
                MessageBox.Show("В данный момент невозможно выполнить загрузку. Попробуйте позже");
                return;
            }

            var workerPath = GetWorkerPath(workerId);

            // Worker directory doesnt exist
            if (workerPath == null)
            {
                var workerName =
                    new IdToNameConverter().Convert(workerId, typeof(string), "FullName", new CultureInfo("ru-RU"))
                    .ToString();
                // Get right name of worker directory
                var renamedWorkerName = GetRenamedFileName(workerName);
                workerPath = string.Format("{0}_[id]{1}", renamedWorkerName, workerId);
                // Create worker directory
                _ftpClient.MakeDirectory(string.Concat(_ftpClient.CurrentPath, workerPath, "/"));
            }

            foreach (var filePath in filePaths)
            {
                var fileName = Path.GetFileName(filePath);
                var adress   = string.Concat(_ftpClient.CurrentPath, workerPath, "/", fileName);

                if (!_ftpClient.FileExist(adress))
                {
                    _sc.AddFileToWorker(Convert.ToInt32(StaffListBox.SelectedValue), fileName,
                                        AdministrationClass.CurrentWorkerId, App.BaseClass.GetDateFromSqlServer());
                }
                else
                {
                    if (MetroMessageBox.Show("Файл '" + fileName + "' уже существует в данном каталоге. \n\n" +
                                             "Заменить существующий файл?", string.Empty, MessageBoxButton.YesNo,
                                             MessageBoxImage.Warning) != MessageBoxResult.Yes)
                    {
                        return;
                    }
                }

                var uri = new Uri(adress);

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

                _processWindow = new WaitWindow {
                    Text = "Загрузка файла..."
                };
                _processWindow.Show(Window.GetWindow(this), true);
                _ftpClient.UploadFileCompleted += OnFtpClientUploadFileCompleted;
                _ftpClient.UploadFileAsync(uri, "STOR", filePath);
            }
        }
 void Login()
 {
     lock (sync)
     {
         view.SetState(LoginState.LoggingIn);
         window = view.ShowWaitWindow();
         client.Login(view.Server, view.Username, view.Password);
     }
 }
Esempio n. 22
0
        private DownloadStatus ExecuteDownload(bool waitWindow = true)
        {
            //wait window
            if (waitWindow)
            {
                return((DownloadStatus)WaitWindow.Show(ExecuteDownload, @"Downloading update"));
            }

            //the final status to deliver to the UpdateClient
            var status = DownloadStatus.Unknown;

            try
            {
                //loop through each GitHub release asset
                foreach (var a in AppUpdate.UpdateData.assets)
                {
                    //location of the unique folder
                    var dirA = $@"{Agent.UpdateDirectory}\{a.id}";

                    //each asset has a separate directory inside the 'UpdateId' directory
                    if (!Directory.Exists(dirA))
                    {
                        Directory.CreateDirectory(dirA);
                    }
                    else
                    {
                        //the directory already exists; delete it then create it once more
                        Directory.Delete(dirA, true);
                        Directory.CreateDirectory(dirA);
                    }

                    //construct download job
                    var j = new Job
                    {
                        //the asset URI to download
                        DownloadUri = new Uri(a.browser_download_url),

                        //the path of the file to save the asset to
                        DownloadPath = $@"{dirA}\{a.name}",

                        //the byte-size of the asset
                        DownloadSize = a.size
                    };

                    //download and flush job to disk
                    status = j.DoDownload();
                }
            }
            catch (Exception ex)
            {
                //log the error to a file
                ex.ExportError();
            }

            //finally, return the final status
            return(status);
        }
Esempio n. 23
0
 public void ShowWaitDialog()
 {
     _waitDialog = new WaitWindow
     {
         Owner            = Application.Current.MainWindow,
         FetchProgressBar = { IsIndeterminate = true }
     };
     _waitDialog.Show();
 }
Esempio n. 24
0
        private void buttonLoad_Click(object sender, EventArgs e)
        {
            openFileDialog1.Title  = "Indicate the GO (DAG) file";
            openFileDialog1.Filter = "OBO file (*.OBO)|*.OBO";

            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            gt.LoadFile(openFileDialog1.FileName);
            richTextBoxLog.AppendText("Nodes loaded :" + gt.Terms.Count.ToString() + "\n");

            int prunnedNodes = gt.pruneObsoleteTerms();

            richTextBoxLog.AppendText("Prunned nodes (obsolete): " + prunnedNodes.ToString() + "\n");
            richTextBoxLog.AppendText("We now have " + gt.Terms.Count.ToString() + "nodes\n");

            gt.buildTreeNodes();

            //Lets give them a friendly wait advice
            waitWindow = new WaitWindow();
            waitWindow.ChangeLable("Performing Optimizations...");
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(waitWindow.ShowWindow));
            t.Start();

            tabControlGOTools.Enabled = true;
            tabControlRight.Enabled   = true;

            treeViewGO2.ShowPlusMinus = false;

            treeNodes.Clear();
            treeNodes = gt.getNodesCategory(GO.GOTerms.GOCategories.all);

            addRoots();

            //Perform Precalculations
            //We could let this computing in a sepatared thread
            gt.ComputeAllNodesBelowForAllNodes();

            dagLoaded = true;

            if (dagLoaded && associationTableloaded)
            {
                buttonSavePreCalc.Enabled    = true;
                groupBoxTreeControls.Enabled = true;
                groupBoxGOPlot.Enabled       = true;
            }
            openFileDialog1.Filter = "";

            //Turn off the button so the user wont fo mess
            buttonLoad.Enabled        = false;
            groupBoxGOPrecomp.Enabled = false;

            t.Abort();
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            WaitWindow w = new WaitWindow("Searching for Themes. Please Wait...");

            w.Show();
            GetThemes();
            MainWindow m = new MainWindow(w);

            m.Show();
        }
Esempio n. 26
0
    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        var   dialog     = new WaitWindow();
        var   task       = WorkAsync(dialog.Progress);
        var   dialogTask = dialog.ShowDialogAsync();
        await task;

        dialog.Close();
        await dialogTask;
    }
Esempio n. 27
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();
        }
        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);
            }
        }
Esempio n. 29
0
        public CustomerListViewModel(CustomerListView customerListView)
        {
            WaitWindow       = new WaitWindow();
            CustomerListView = customerListView;

            Task.Run(() => LoadCustomersAsync());

            AddCustomerCommand    = new RelayCommand(ExecAddCustomer, CanAddCustomer);
            EditCustomerCommand   = new RelayCommand(ExecEditCustomer, CanEditCustomer);
            DeleteCustomerCommand = new RelayCommand(ExecDeleteCustomerAsync, CanDeleteCustomer);
        }
Esempio n. 30
0
        private void UpdateResInfos()
        {
            WaitWindow waitWindow = new WaitWindow("Сваляне на резервации от сървъра...");

            ReservationInfos = new List <ReservationInfo>(Context.Reservations
                                                          .Include(r => r.Room)
                                                          .Include(r => r.Guest)
                                                          .Include(r => r.Transactions)
                                                          .Select(x => new ReservationInfo(x)));
            waitWindow.Close();
        }
Esempio n. 31
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");
        }
        public WorkerListViewModel(WorkerListView workerListView)
        {
            WaitWindow     = new WaitWindow();
            WorkerListView = workerListView;

            Task.Run(() => LoadWorkersAsync());

            AddWorkerCommand    = new RelayCommand(ExecAddWorker, CanAddWorker);
            EditWorkerCommand   = new RelayCommand(ExecEditWorker, CanEditWorker);
            DeleteWorkerCommand = new RelayCommand(ExecDeleteWorkerAsync, CanDeleteWorker);
        }
Esempio n. 33
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;
 }
 public void Run()
 {
     SaveFileDialog saveFileDialog = new SaveFileDialog();
     saveFileDialog.Filter = "Zip Files (*.zip)|*.zip|" + Utility.AllFilesFilter;
     saveFileDialog.FileName = "Export_" + DateTime.Now.ToString("yyyy_MM_dd") + ".zip";
     if (saveFileDialog.ShowDialog() == true)
     {
         WaitWindow waitWindow = new WaitWindow("Exporting collection...");
         waitWindow.ShowDialog(this.ParentWindow, () =>
         {
             using (CollectionExporterBase exporter = new ArchivedCollectionExporter(saveFileDialog.FileName, this.CollectionManager))
             {
                 exporter.Export();
             }
         });
     }
 }
        public void Run()
        {
            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderDialog.ShowNewFolderButton = true;
            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string path = folderDialog.SelectedPath;

                if (Directory.GetFiles(path).Length != 0 || Directory.GetDirectories(path).Length != 0)
                {
                    MessageBoxResult emptyDirectoryResult = Dialogs.YesNoCancelQuestion("Target directory is not empty. Delete directory contents before exporting?");
                    if (emptyDirectoryResult == MessageBoxResult.Yes)
                    {
                        if (Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => Path.GetExtension(f).ToLower() != ".xml"))
                        {
                            Dialogs.Error("The directory contains files that aren't XML. I refuse to delete them!");
                            return;
                        }

                        if (!Utility.TryEmptyDirectory(path))
                        {
                            Dialogs.Error("Error deleting directory contents!");
                            return;
                        }
                    }
                    else if (emptyDirectoryResult == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                WaitWindow waitWindow = new WaitWindow("Exporting collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    using (DirectoryCollectionExporter exporter = new DirectoryCollectionExporter(folderDialog.SelectedPath, this.CollectionManager))
                    {
                        exporter.Export();
                    }
                });
            }
        }
Esempio n. 36
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;
			}
		}
Esempio n. 37
0
 protected virtual void OnConnect(object sender, System.EventArgs e)
 {
     if ((entryUser.Text.Length > 0) && (entryPass.Text.Length > 0))
     {
         waitWindow = new WaitWindow();
         waitWindow.SetMsg("Registering user and password: Please wait...");
         this.Hide();
         threadLogin.Start();
     }
 }
Esempio n. 38
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);
		}
        private void ImportImages(DiscogsRelease discogsRelease)
        {
            bool replaceImages = true;
            if (this.release.Images.Count > 0)
            {
                replaceImages = Dialogs.YesNoQuestion("Replace existing release images?");
            }

            if (replaceImages)
            {
                foreach (Image image in this.release.Images.ToArray())
                {
                    this.imagesEditor.RemoveImage(image);
                }
            }

            WaitWindow waitWindow = new WaitWindow("Downloading images. Please wait.");

            Progress<double> progress = new Progress<double>();

            waitWindow.ShowDialog(this.window, new Task(() =>
            {
                this.DownloadImagesAsync(discogsRelease, progress);
            }), progress);
        }
        private void OnXmlFileDropped(string file)
        {
            if (this.DatabaseRelease.Images.Count != 0 || this.DatabaseRelease.AdditionalFiles.Count != 0)
            {
                if (!Dialogs.Confirm("This will replace all images, additional files and other data. Continue?"))
                {
                    return;
                }
            }

            WaitWindow waitWindow = new WaitWindow("Reading release data...");
            waitWindow.ShowDialog(this, () =>
            {
                var tempFactory = new MemorySessionFactory();
                var tempManager = tempFactory.CreateCollectionManager();

                using (XmlReleaseImporter xmlReleaseImporter = new XmlReleaseImporter(file, tempManager))
                {
                    Release release = xmlReleaseImporter.ImportRelease();

                    this.Dispatcher.InvokeAction(() =>
                    {
                        this.LoadDataFromRelease(release, tempManager.ImageHandler);

                        tempManager.Dispose();
                        tempFactory.Dispose();
                    });
                }
            });
        }
        private void OKCancelBox_OKClicked(object sender, System.EventArgs e)
        {
            this.UpdateRelease();

            WaitWindow waitWindow = new WaitWindow("Moving files and saving tags...");

            Progress<double> progress = new Progress<double>();

            waitWindow.ShowDialog(this, new Task(() =>
            {
                this.SaveChangesAsync(progress);
            }), progress);
        }