Пример #1
0
        /// <summary>
        /// Create a new system
        /// </summary>
        /// <returns>true if file creation succeeded, false if user cancelled or otherwise</returns>
        private bool New()
        {
            if (!Close())
            {
                return(false);
            }

            MessageBox.Show(Main.SaveNewSystem, Main.SaveNewSystemTitle, MessageBoxButton.OK,
                            MessageBoxImage.Information, MessageBoxResult.OK);

            LibraryData.CreateEmptySystem();

            LibraryData.FuturamaSys.CreatedInstallerVersion =
                Assembly.GetExecutingAssembly().GetName().Version.ToString();

            if (!IsInDesignMode)
            {
                var q = new SystemFileSaveAs();
                if (!q.Save())
                {
                    LibraryData.CloseProject();
                    return(false);
                }
            }

            RaisePropertyChanged(() => FileName);
            AddMainUnitsToTab();
            _recentFilesLogic.AddFile(FileName);

            RaisePropertyChanged(() => InstallerVersion);

            return(true);
        }
Пример #2
0
        /// <summary>
        ///     adds a new mainunit to the system
        /// </summary>
        private void AddMainUnit()
        {
            if (!LibraryData.SystemIsOpen)
            {
                LibraryData.CreateEmptySystem();
            }

            var t = new UcEscNum(LibraryData.FuturamaSys.MainUnits.Select(n => n.Id).ToList());

            if (t.ShowDialog() == false)
            {
                return;
            }

            var mu = LibraryData.AddEsc(t.Result);

            if (mu == null)
            {
                return;
            }
            var newunit = new MainUnitViewModel(mu, this);

            TabCollection.Add(newunit);
            OnSystemChanged(new SystemChangedEventArgs()
            {
                NewMainUnit = newunit
            });
        }
Пример #3
0
        public MainViewModel()
        {
            if (Application.Current != null)
            {
                Application.Current.Exit += (sender, args) =>
                {
                    //close connections
                    DisconnectAllUnists();

                    //save speaker library
                    SpeakerMethods.SaveSpeakerlib();

                    //save project settings
                    Properties.Settings.Default.Save();
                }
            }
            ;
            _recentFilesLogic = new RecentFilesLogic(this);

            Thread dispThread = Thread.CurrentThread;

            Dispatcher.FromThread(dispThread);


            _tabs.Add(_comViewModel);


#if DEBUG
            if (IsInDesignMode)
            {
                LibraryData.CreateEmptySystem();
            }
            Open(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\d.esc");
#endif
        }
Пример #4
0
        public void BackupFile()
        {
            LibraryData.CreateEmptySystem();
            SystemFileBackup u = new SystemFileBackup();

            u.Save();
        }
Пример #5
0
        private void AddMainUnit(int id)
        {
            if (!LibraryData.SystemIsOpen)
            {
                LibraryData.CreateEmptySystem();
            }
            var esc = LibraryData.AddEsc(id);

            if (esc == null)
            {
                return;
            }
            var escview = new MainUnitViewModel(esc, this);

            if (!TabCollection.Contains(escview))
            {
                TabCollection.Add(escview);
            }
        }
Пример #6
0
 public static void Initialize(TestContext context)
 {
     LibraryData.CreateEmptySystem();
 }
Пример #7
0
 /// <summary>
 /// Design instance
 /// </summary>
 public MainUnitViewModel()
 {
     LibraryData.CreateEmptySystem();
     _mainUnit = LibraryData.GetMainUnit(0);
     _main     = new MainViewModel();
 }
Пример #8
0
        //readonly FlowModel _flow;

        /// <summary>
        /// design time creation
        /// </summary>
#if DEBUG
        public BlAuxSpeakerPeq()
            : base(new MainUnitViewModel())
        {
            LibraryData.CreateEmptySystem();
            _card = LibraryData.FuturamaSys.MainUnits.First().Cards.OfType <CardModel>().First();
        }