Пример #1
0
        public DpdViewModel()
        {
            OpenCommand = new RelayCommand(x =>
            {
                var fd = FileDialog.Factory(Window, FileDialog.Behavior.Open, ("DPD effect", "dpd"));
                if (fd.ShowDialog() == true)
                {
                    using (var stream = File.OpenRead(fd.FileName))
                    {
                        FileName = fd.FileName;
                        Dpd      = new Dpd(stream);

                        OnPropertyChanged(nameof(SaveCommand));
                        OnPropertyChanged(nameof(SaveAsCommand));
                    }
                }
            }, x => true);

            SaveCommand = new RelayCommand(x =>
            {
                if (!string.IsNullOrEmpty(FileName))
                {
                    using (var stream = File.Open(FileName, FileMode.Create))
                    {
                        throw new NotImplementedException();
                    }
                }
                else
                {
                    SaveAsCommand.Execute(x);
                }
            }, x => true);

            SaveAsCommand = new RelayCommand(x =>
            {
                var fd = FileDialog.Factory(Window, FileDialog.Behavior.Save, ("DPD effect", "dpd"));
                if (fd.ShowDialog() == true)
                {
                    using (var stream = File.Open(fd.FileName, FileMode.Create))
                    {
                        throw new NotImplementedException();
                    }
                }
            }, x => true);

            ExitCommand = new RelayCommand(x =>
            {
                Window.Close();
            }, x => true);

            AboutCommand = new RelayCommand(x =>
            {
                new AboutDialog(Assembly.GetExecutingAssembly()).ShowDialog();
            }, x => true);
        }
Пример #2
0
        public DpdViewModel()
        {
            OpenCommand = new RelayCommand(x =>
            {
                FileDialog.OnOpen(fileName =>
                {
                    using (var stream = File.OpenRead(fileName))
                    {
                        FileName = fileName;
                        Dpd      = new Dpd(stream);

                        OnPropertyChanged(nameof(SaveCommand));
                        OnPropertyChanged(nameof(SaveAsCommand));
                    }
                }, Filters);
            }, x => true);

            SaveCommand = new RelayCommand(x =>
            {
                if (!string.IsNullOrEmpty(FileName))
                {
                    using (var stream = File.Open(FileName, FileMode.Create))
                    {
                        throw new NotImplementedException();
                    }
                }
                else
                {
                    SaveAsCommand.Execute(x);
                }
            }, x => true);

            SaveAsCommand = new RelayCommand(x =>
            {
                FileDialog.OnSave(fileName =>
                {
                    using (var stream = File.Open(fileName, FileMode.Create))
                    {
                        throw new NotImplementedException();
                    }
                }, Filters);
            }, x => true);

            ExitCommand = new RelayCommand(x =>
            {
                Window.Close();
            }, x => true);

            AboutCommand = new RelayCommand(x =>
            {
                new AboutDialog(Assembly.GetExecutingAssembly()).ShowDialog();
            }, x => true);
        }
Пример #3
0
 public DeliveryPriceService(Dpd dpd, AlLogistic alLogistic, EastLine eastLine)
 {
     _dpd        = dpd;
     _alLogistic = alLogistic;
     _eastLine   = eastLine;
 }