private void Button_Click(object sender, RoutedEventArgs e)
        {
            long lTotalSize = 0;
            ObservableCollection <SubItem> pList = new ObservableCollection <SubItem>();

            foreach (Track item in m_Info.Tracks)
            {
                pList.Add(new SubItem()
                {
                    data         = item,
                    Type         = "TRACK",
                    Status       = AIGS.Common.Status.Wait,
                    Name         = item.Title,
                    DownloadSize = 0,
                    Percentage   = 0,
                    TotalSize    = item.StreamUrl == null ? 0 : item.StreamUrl.FileSize,
                    DownloadUrl  = item.StreamUrl
                });
                lTotalSize += item.StreamUrl == null ? 0 : item.StreamUrl.FileSize;
            }

            Para.MainItems.Add(new MainItem()
            {
                data         = m_Info,
                Type         = "ALBUM",
                Status       = AIGS.Common.Status.Wait,
                Name         = m_Info.Title,
                DownloadSize = 0,
                Percentage   = 0,
                TotalSize    = lTotalSize,
                SubList      = pList
            });
            _session.Close();
        }
Exemplo n.º 2
0
 public void CloseLoading()
 {
     if (_session?.IsEnded == false)
     {
         _session.Close(true);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectRunDateTimeDialog_OnPreviewKeyDown(object sender, KeyEventArgs e)
        {
            bool wasEnter;

            if ((wasEnter = (e.Key == Key.Enter)) || e.Key == Key.Cancel)
            {
                DidComplete = wasEnter;
                e.Handled   = true;
                _dialogSession.Close(false);
            }
            if (e.Key == Key.Escape)
            {
                DidComplete = false;
                e.Handled   = true;
                _dialogSession.Close(false);
            }
        }
        private void SaveHandler(ConnectionEditorViewModel connectionEditorViewModel, DialogSession dialogSession)
        {
            var connection = new ExplicitConnection(connectionEditorViewModel.Id.GetValueOrDefault(Guid.NewGuid()),
                                                    connectionEditorViewModel.Label, connectionEditorViewModel.Host,
                                                    connectionEditorViewModel.AuthorisationKey, connectionEditorViewModel.DatabaseId,
                                                    connectionEditorViewModel.CollectionId);

            _explicitConnectionCache.AddOrUpdate(connection);
            dialogSession.Close(connection);
        }
        public void Hide()
        {
            if (dialogSession == null)
            {
                return;
            }

            if (!dialogSession.IsEnded)
            {
                dialogSession.Close();
            }
        }
Exemplo n.º 6
0
        public void Complete()
        {
            this.IsCompleted   = true;
            this.IsDownloading = false;
            this.Speed         = 0;
            client?.Dispose();


            if (!StopDownload)
            {
                PaperDownloadComplete?.Invoke();
                ///关闭 等待窗
                Application.Current.Dispatcher.Invoke(new Action(() => { dialogSession?.Close(); }));
            }
        }
Exemplo n.º 7
0
        public async Task <OsmoMessageBoxResult> ShowDialog(MaterialMessageBox msgBox, bool forceClose)
        {
            if (forceClose && IsOpen)
            {
                if (dialogSender != null)
                {
                    Helper.ExecuteDialogCloseCommand(dialogSender);
                    NotifyDialogClosed();
                }
                else if (session != null)
                {
                    session.Close(false);
                    NotifyDialogClosed();
                }
            }

            return(await ShowDialog(msgBox));
        }
Exemplo n.º 8
0
        // 触发保存事件,要写回配置文件,并主动关闭对话框
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            string signal = "";

            foreach (var s in Model.Config.Signals)
            {
                if (s.IsSelected)
                {
                    signal += s.Value.ToString() + ",";
                }
            }
            signal       = signal.Remove(signal.Length - 1);
            Model.Script = Model.Script.Replace("\r\n", ";");
            if (CurTemplate == null)
            {
                ConfigModel.Instance.Templates.Add(new TestItemTemplate
                {
                    Name     = Model.Name,
                    Source   = Model.Source,
                    Location = Model.Location,
                    Measure  = Model.Measure,
                    Signals  = signal,
                    Target   = Model.Target,
                    Loop     = Model.Loop,
                    Script   = Model.Script
                });
            }
            else
            {
                CurTemplate.Name     = Model.Name;
                CurTemplate.Source   = Model.Source;
                CurTemplate.Location = Model.Location;
                CurTemplate.Measure  = Model.Measure;
                CurTemplate.Signals  = signal;
                CurTemplate.Target   = Model.Target;
                CurTemplate.Loop     = Model.Loop;
                CurTemplate.Script   = Model.Script;
            }
            // 写回配置文件
            ConfigModel.Instance.WriteBack();
            Session.Close();
        }
Exemplo n.º 9
0
 private void CloseDialog(DialogSession ds)
 {
     ds.Close();
 }
Exemplo n.º 10
0
 public void Close()
 {
     _session.Close();
 }
 private void CloseDialog(DialogSession dc)
 {
     dc.Close();
 }
Exemplo n.º 12
0
 public void CloseCurrent()
 {
     _currentDialogSession.Close();
 }
Exemplo n.º 13
0
        /// <summary>
        /// Сохраняет результаты записи в документ Excel
        /// </summary>
        /// <param name="closeOnSaved">закрыть при успешном сохранении</param>
        public void ExportToExcel(bool closeOnSaved)
        {
            if (SensorsData.Count() <= 0)
            {
                dialog.Show("Сначала запишите данные датчиков");
                return;
            }
            isSaved = false;
            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                Filter     = "Книга Excel (*.xlsx)|*.xlsx",
                DefaultExt = "xlsx"
            };
            var desctopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

            saveFileDialog.InitialDirectory = desctopPath;
            saveFileDialog.FileName         = $"{GroupName.Text} {StudentName.Text}.xlsx";

            Exception exception = null;

            if (saveFileDialog.ShowDialog() == true)
            {
                var result = DialogHost.Show(new ProccesDialog(), MainIdentifier,
                                             new DialogOpenedEventHandler((object sender, DialogOpenedEventArgs args) => {
                    DialogSession session = args.Session;

                    using (var p = new ExcelPackage())
                    {
                        var ws = p.Workbook.Worksheets.Add("Результаты");
                        ws.Cells["A1"].Value = "Время, мс";
                        ws.Cells["B1"].Value = "Ускорение ползуна, м / с ^ 2";
                        ws.Cells["C1"].Value = "Усилие резания, кН";
                        ws.Cells["D1"].Value = "Напряжение питания ЭД, В";
                        ws.Cells["E1"].Value = "Ток потребления ЭД, А";
                        ws.Cells["F1"].Value = "Частота вращения, мкс";

                        for (int i = 2; i < SensorsData.Count() + 2; i++)
                        {
                            var sdi = SensorsData[i - 2];
                            ws.Cells[i, 1].Value = sdi.Time;
                            ws.Cells[i, 2].Value = sdi.Acceleration;
                            ws.Cells[i, 3].Value = sdi.Force;
                            ws.Cells[i, 4].Value = sdi.Voltage;
                            ws.Cells[i, 5].Value = sdi.Amperage;
                            ws.Cells[i, 6].Value = sdi.Rpm;
                        }
                        try
                        {
                            p.SaveAs(new FileInfo(saveFileDialog.FileName));
                            isSaved = true;
                        }
                        catch (Exception ex)
                        {
                            exception = ex;
                        }
                    }
                    session.Close(false);
                }));
            }

            if (isSaved && exception == null)
            {
                if (closeOnSaved)
                {
                    Close();
                }
                dialog.Show($"Файл {saveFileDialog.SafeFileName} успешно сохранен!");
            }
            else if (exception != null)
            {
                dialog.Show($"Файл {saveFileDialog.SafeFileName} не был сохранен: { exception.Message }");
            }
        }