Exemplo n.º 1
0
        /// <summary>
        /// обработчик вкладки меню "Добавить"
        /// открывает окно проводника
        /// копирует и переименовывает аудиофайл в папку приложения
        /// сохраняет новое имя файла в "WordSample"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClickMenuItemAdd(object sender, RoutedEventArgs e)
        {
            DefaultDialogService dds = new DefaultDialogService();

            dds.OpenFileDialog();
            string   fileName  = dds.FilePath;
            FileInfo filesound = new FileInfo(fileName);
            FileInfo filecopy  = null;

            if ((filecopy = IsExist(filesound)) != null)
            {
                _wordsSample.SoundName = filecopy.Name;
                return;
            }
            string wordName = textBoxWord.Text.Trim().ToLower();

            if (wordName != "")
            {
                filecopy = filesound.CopyTo(Path.Combine(FIleTools.NameDirectoryAudio, wordName + filesound.Extension));
                if (filecopy != null)
                {
                    _wordsSample.SoundName = filecopy.Name;
                }
                else
                {
                    System.Media.SystemSounds.Beep.Play();
                }
            }
            else
            {
                MessageBox.Show("Укажите слово!", "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
 public AccessViewModel(IWindowController windowFactory, string Path)
 {
     this.windowFactory = windowFactory;
     RegistrationMode = false;
     dialogService = new DefaultDialogService();
     this.DBPath = Path;
 }
Exemplo n.º 3
0
        protected override void Awake()
        {
            ApplicationContext   context        = Context.GetApplicationContext();
            BindingServiceBundle bindingService = new BindingServiceBundle(context.GetContainer());

            bindingService.Start();

            /* Initialize the ui view locator and register UIViewLocator */
            //获得上下文中的服务容器
            IServiceContainer container = context.GetContainer();

            //初始化IUIViewLocator,并注册到容器
            container.Register <IUIViewLocator>(new DefaultUIViewLocator());
            //初始化本地化服务,并注册到容器中
            CultureInfo cultureInfo  = Locale.GetCultureInfo();
            var         localization = Localization.Current;

            localization.CultureInfo = cultureInfo;
            localization.AddDataProvider(new DefaultDataProvider("LocalizationTutorials", new XmlDocumentParser()));
            container.Register(localization);

            /* Initialize the dialog service */
            IDialogService dialogService = new DefaultDialogService();

            container.Register <IDialogService>(dialogService);
        }
Exemplo n.º 4
0
 public _University()
 {
     University        = new University();
     UniversityRecords = new ObservableCollection <University>();
     LoadUniversityData();
     showWindow    = new DefaultShowWindowService();
     dialogService = new DefaultDialogService();
 }
Exemplo n.º 5
0
 public _WorkType()
 {
     WorkType         = new WorkType();
     WorkTypesRecords = new ObservableCollection <WorkType>();
     LoadWorkTypesData();
     showWindow    = new DefaultShowWindowService();
     dialogService = new DefaultDialogService();
 }
Exemplo n.º 6
0
 public _Status()
 {
     Status        = new Status();
     StatusRecords = new ObservableCollection <Status>();
     LoadStatusData();
     showWindow    = new DefaultShowWindowService();
     dialogService = new DefaultDialogService();
 }
Exemplo n.º 7
0
        /// <summary>
        /// обработчик вкладки меню "Открыть"
        /// открывает проводник и сохраняет в текстовый файл путь к внешней папке с аудиофайлами
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClickMenuItemOpen(object sender, RoutedEventArgs e)
        {
            DefaultDialogService dds = new DefaultDialogService();

            dds.OpenFileDialog();
            string pathDirectory = dds.GetDirectory(dds.FilePath);

            FIleTools.WritePath(FIleTools.NameFilePathes, pathDirectory, false);
        }
        public async Task ExportWorkComplexAsync()
        {
            var saveFileDialog = DefaultDialogService.SaveFile();

            if (saveFileDialog)
            {
                await Exporter.ExportAsync(DefaultDialogService.FileName, Project);
            }
        }
Exemplo n.º 9
0
 public _AuthorStatus()
 {
     AuthorStatus         = new AuthorStatus();
     SelectedAuthorStatus = new AuthorStatus();
     AuthorStatusRecords  = new ObservableCollection <AuthorStatus>();
     LoadData();
     showWindow    = new DefaultShowWindowService();
     dialogService = new DefaultDialogService();
 }
Exemplo n.º 10
0
        private void buttonfile_Click(object sender, RoutedEventArgs e)
        {
            DefaultDialogService dds = new DefaultDialogService();

            dds.OpenFileDialog();
            string fileName = dds.FilePath;

            audioFile         = new FileInfo(fileName);
            textboxAudio.Text = audioFile.Name;
        }
Exemplo n.º 11
0
        protected override void Awake()
        {
            Debug.Log("protected override void Awake()");
            ApplicationContext context = Context.GetApplicationContext();
            //获得上下文中的服务容器
            IServiceContainer container     = context.GetContainer();
            IDialogService    dialogService = new DefaultDialogService();

            container.Register <IDialogService>(dialogService);
        }
Exemplo n.º 12
0
        public _Source()
        {
            Source = new Source();

            SourcesRecords = new ObservableCollection <Source>();

            LoadSourcesData();
            showWindow    = new DefaultShowWindowService();
            dialogService = new DefaultDialogService();
        }
Exemplo n.º 13
0
        /// <summary>
        /// обработчик вкладки меню "Копировать аудиофайл"
        /// открывает проводник и  копирует файл
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClickMenuItemOpen(object sender, RoutedEventArgs e)
        {
            DefaultDialogService dds = new DefaultDialogService();

            dds.OpenFileDialog();
            string   path     = dds.FilePath;
            FileInfo fileInfo = new FileInfo(path);

            FIleTools.CopyTo(fileInfo, FIleTools.NameDirectoryAudio);
            textboxAudio.Text = fileInfo.Name.ToLower();
        }
Exemplo n.º 14
0
 public _Subject()
 {
     Subj           = new Subject();
     SelectedSubj   = new Subject();
     SelectedSubj2  = new Subject();
     SubjRecords    = new ObservableCollection <Subject>();
     AuthorSubjects = new ObservableCollection <Subject>();
     LoadSubjectsData();
     showWindow    = new DefaultShowWindowService();
     dialogService = new  DefaultDialogService();
 }
Exemplo n.º 15
0
 public _Direction()
 {
     Dir              = new Direction();
     SelectedDir      = new Direction();
     SelectedDir2     = new Direction();
     DirRecords       = new ObservableCollection <Direction>();
     AuthorDirections = new ObservableCollection <Direction>();
     LoadDirectionsData();
     showWindow    = new DefaultShowWindowService();
     dialogService = new  DefaultDialogService();
 }
        public MainPageViewModel()
        {
            _dialogService = new DefaultDialogService();

            OpenDialogCommand   = new DelegateCommand(async() => await OpenMazeFileDialog());
            OpenFromPathCommand = new DelegateCommand(async() => await OpenFileByPath(), CanOpenFileByPath)
                                  .ObservesProperty(() => DialogFilePath);

            DialogFilePath =
                @"C:\Users\ia_no\Source\Repos\CodeTechnologyLabs_course3\MazeOperations.Tests\TestInput\labirint4.txt";
            InfluteMazeControl(DialogFilePath);
        }
 public ProjectViewModel()
 {
     DefaultDialogService       = new DefaultDialogService();
     UnitOfWork                 = new UnitOfWork(new NetworkModelContext());
     Importer                   = new();
     Exporter                   = new();
     TechnologicalConditionDTOs = new();
     TimeCharacteristicDTOs     = new();
     ResourceDTOs               = new();
     VariableParameterDTOs      = new();
     ProjectDTO                 = new();
 }
Exemplo n.º 18
0
 public EditViewModel(IWindowController controller, AgencySQLDb DataBase)
 {
     dialog             = new DefaultDialogService();
     windowController   = controller;
     SqlDataBase        = DataBase;
     TransactionsEdit   = new List <DataRow>();
     OfficeEmployeeEdit = new List <DataRow>();
     OfficeEdit         = new List <DataRow>();
     SeekerEdit         = new List <DataRow>();
     SaleEdit           = new List <DataRow>();
     EmployeeEdit       = new List <DataRow>();
     RefreshData();
 }
Exemplo n.º 19
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            DefaultDialogService dialogService = new DefaultDialogService();

            if (dialogService.SaveFileDialog())
            {
                dialogService.ShowMessage("File save!");
                EmployeViewModel.SaveToFile(dialogService.FilePath, EmployeViewModel.Employees);
            }
            else
            {
                dialogService.ShowMessage("Bad!");
            }
        }
Exemplo n.º 20
0
    public App()
    {
        var broadcastFactory      = new ChainerFactory(16384);
        var networkServiceFactory = new NetworkServiceFactory();

        _watcher          = networkServiceFactory.CreateWatcher();
        _broadcastService = new BroadcastService(broadcastFactory, _watcher, networkServiceFactory.CreateUtility());
        InitializeBroadcastService(networkServiceFactory, _broadcastService);
        var frameworkDialogFactory = new DefaultFrameworkDialogFactory();
        var dialogService          = new DefaultDialogService(frameworkDialogFactory);
        var fileService            = new DefaultFileService(new [] { ".lpsnp" });

        _paintDataContext = new PaintViewModel(_broadcastService, dialogService, fileService, networkServiceFactory);
    }
Exemplo n.º 21
0
        private void GetFromFileDialog()
        {
            DefaultDialogService dialogService = new DefaultDialogService();

            if (dialogService.OpenFileDialog())
            {
                dialogService.ShowMessage("File is open!");
                GateFromFile(dialogService.FilePath);
            }
            else
            {
                dialogService.ShowMessage("Error opening file!");
            }
        }
Exemplo n.º 22
0
 public Contacts()
 {
     this.Phone1   = "+380";
     this.Phone2   = "---";
     this.Phone3   = "---";
     this.Email1   = "---";
     this.Email2   = "---";
     this.Adress   = "---";
     this.Skype    = "---";
     this.VK       = "---";
     this.FaceBook = "---";
     this.Persone  = new ObservableCollection <Persone>();
     showWindow    = new DefaultShowWindowService();
     dialogService = new DefaultDialogService();
 }
        public async Task ImportWorkDataSourceAsync()
        {
            var openFileDialog = DefaultDialogService.OpenFile();

            if (openFileDialog)
            {
                var project = await Importer.ImportAsync(DefaultDialogService.FileName);

                foreach (var item in project.TechnologicalConditions)
                {
                    var workDataSourceDTO = Mapper.Map <TechnologicalCondition, TechnologicalConditionDTO>(item);
                    TechnologicalConditionDTOs.Add(workDataSourceDTO);
                }
            }
        }
Exemplo n.º 24
0
 private void ExportAsPngFile_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (partScanView != null)
     {
         IDialog SaveFileService = new DefaultDialogService();
         var     ScanTime        = DateTime.Now;
         if (SaveFileService.SaveFileDialog(Item.Name + "_" + ScanTime.ToShortDateString().Replace(".", "_") + "_" + ScanTime.ToLongTimeString().Replace(":", "_"), "PNG files|*.png") == true)
         {
             var partScanViewBackground = partScanView.Background;
             partScanView.Background = ThemeManager.GetResource(Theme, "WindowBackgroundBrush") as SolidColorBrush;
             MemoryStream stream = new MemoryStream();
             VisualHelper.SnapShotPNG(partScanView).Save(stream);
             var image = System.Drawing.Image.FromStream(stream);
             image.Save(SaveFileService.FilePath);
             partScanView.Background = partScanViewBackground;
         }
     }
 }
Exemplo n.º 25
0
        public OpenProjectPage(EmployeViewModel employeViewModel)
        {
            InitializeComponent();

            EmployeViewModel = employeViewModel;

            DefaultDialogService dialogService = new DefaultDialogService();

            if (dialogService.OpenFileDialog())
            {
                dialogService.ShowMessage("File is open!");
                EmployeViewModel.OpenFile(dialogService.FilePath);
            }
            else
            {
                dialogService.ShowMessage("Bad!");
            }
        }
Exemplo n.º 26
0
 private void ExportAsHtmlFile_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (partSwitch != null)
     {
         if (partScans != null)
         {
             if (partScans.SelectedValue != null)
             {
                 IDialog SaveFileService = new DefaultDialogService();
                 var     ScanTime        = DateTime.Now;
                 if (SaveFileService.SaveFileDialog(Item.Name + "_" + ScanTime.ToShortDateString().Replace(".", "_") + "_" + ScanTime.ToLongTimeString().Replace(":", "_"), "html files|*.html") == true)
                 {
                     var result = htmlSerializer.Serialize(Item.Name, partScans.SelectedValue as ComputerHardwareScan, Pupulate(), partSwitch.SelectedItems, Item.Description, Item.Address, Item.FQDN, true);
                     File.WriteAllText(SaveFileService.FilePath, result);
                 }
             }
         }
     }
 }
        protected override void Awake()
        {
            ApplicationContext   context        = Context.GetApplicationContext();
            BindingServiceBundle bindingService = new BindingServiceBundle(context.GetContainer());

            bindingService.Start();

            /* Initialize the ui view locator and register UIViewLocator */
            IServiceContainer container = context.GetContainer();

            container.Register <IUIViewLocator>(new DefaultUIViewLocator());

            CultureInfo cultureInfo = Locale.GetCultureInfo();

            Localization.Current = Localization.Create(new DefaultDataProvider("LocalizationTutorials", new XmlDocumentParser()), cultureInfo);

            /* Initialize the dialog service */
            IDialogService dialogService = new DefaultDialogService();

            container.Register <IDialogService>(dialogService);
        }
Exemplo n.º 28
0
        private void SaveFile(ICollection <YDPostModel> records)
        {
            IFileService   fileService   = new CsvFileService();
            IDialogService dialogService = new DefaultDialogService();

            try
            {
                if (records == null || records.Count < 1)
                {
                    throw new Exception("Нет данных для сохранения");
                }

                if (dialogService.SaveFileDialog() == true)
                {
                    fileService.Save(dialogService.FilePath, PostToCsvConverter.Convert(records));
                    dialogService.ShowMessage("Файл сохранен");
                }
            }
            catch (Exception ex)
            {
                dialogService.ShowMessage(ex.Message);
            }
        }
Exemplo n.º 29
0
        private void SaveReportToFile()
        {
            DefaultDialogService dialogService = new DefaultDialogService();

            if (dialogService.SaveFileDialog())
            {
                if (dialogService.FileFormat == ".csv")
                {
                    FileExtension.SaveToCsvFile(dialogService.FilePath, UsersSelectionByParameters());
                }
                else if (dialogService.FileFormat == ".xml")
                {
                    FileExtension.SaveToXmlFile(dialogService.FilePath, UsersSelectionByParameters());
                }
                else
                {
                    dialogService.ShowMessage("Error saving report!");
                }
            }
            else
            {
                dialogService.ShowMessage("Error saving report!");
            }
        }
Exemplo n.º 30
0
 public MainWindow()
 {
     InitializeComponent();
     DefaultDialog = new DefaultDialogService();
 }