public void LoadDirectories()
        {
            Directories = new ObservableCollection <DirectoryViewModel>();
            var dict = SerializationHelper.Current.Data.GetValueOrDefault(SerializationKey) as Dictionary <string, object>;

            if (dict != null)
            {
                var paths = (string[])dict["Paths"];
                var views = (DirectoryViewType[])dict["Views"];
                System.Diagnostics.Debug.Assert(paths.Length == views.Length);
                for (int i = 0; i < paths.Length; i++)
                {
                    var view = Instances.Get <DirectoryViewModel>();
                    view.ViewType = views[i];
                    if (Directory.Exists(paths[i]))
                    {
                        view.LoadDirectory(paths[i]);
                    }
                    else
                    {
                        view.LoadDirectory(IOHelper.GetDefaultPath());
                    }
                    Directories.Add(view);
                }
            }
            else
            {
                var view = Instances.Get <DirectoryViewModel>();
                view.LoadDirectory(IOHelper.GetDefaultPath());
                Directories.Add(view);
            }

            Directories.Add(DirectoryViewModel.CreateAddTabViewModel());
        }
Beispiel #2
0
        void download_and_parse()
        {
            var downloader = Instances.Get <DataDownloader>();
            var result     = downloader.DownloadTemperature("EPKK", new DateTime(2014, 3, 12));

            result.Should().NotBeEmpty();
            result[0].Date.Should().Be(new DateTime(2014, 3, 1));
            result[0].Value.Should().Be(12);
        }
        private void ExecuteOk(object parameter)
        {
            Settings.Default.Airport = SelectedLocation.AirportCode;
            Settings.Default.City    = SelectedLocation.City;
            Settings.Default.Save();

            Instances.Get <MainWindow>().Show();
            ((MetroWindow)parameter).Close();
        }
Beispiel #4
0
 private List <IEstimationEngine> LoadAlgorithms()
 {
     return(new List <IEstimationEngine>
     {
         Instances.Get <WeightedMeanEngine>(),
         Instances.Get <TrendEngine>(),
         Instances.Get <ArmaEngine>(),
         Instances.Get <NeuronNetworkEngine>()
     });
 }
Beispiel #5
0
        private async void NavigationStarting(CoreWebView2 coreWebView2, CoreWebView2NavigationStartingEventArgs args)
        {
            if (PixivAPI.Utils.CheckUrlLogin(args.Uri, out string code))
            {
                var result = await Instances.Get <PixivAPI.AuthClient>().InitAuthToken(code, this.args !.CodeVerifier);

                Instances.Get <IAccountService>().Add(result);
                this.args.LoginSuccessCallback.Invoke();
            }
        }
Beispiel #6
0
        public override void Execute(object parameter)
        {
            var dialog = Instances.Get <AccountManagerDialog>();

            dialog.IsCancelable = true;

            if (dialog.ShowModalDialog())
            {
                MainViewModel.ActiveDirectoryContainer.ActiveView.ChangeFileSystem(new FTPFileSystem(dialog.SelectedAccount));
            }
        }
Beispiel #7
0
        private void RenameSingleItem(DirectoryViewModel active)
        {
            var renameDialog = Instances.Get <RenameDialog>();

            renameDialog.ToRename = active.SelectedItem.FullName;
            if (renameDialog.ShowModalDialog())
            {
                //active.UnselectAll();//need because rename operation works strange when selecting new item after finishing operation
                var renameOp = new RenameOperation(active.SelectedItem, renameDialog.NewName, active.FileSystem);
                OperationManager.ExecuteOperation(renameOp);
            }
        }
Beispiel #8
0
        public MainWindow()
        {
            Title = "Pixiv Func";

            this.InitializeComponent();
            if (Instances.Get <IAccountService>().UserAccounts.Count > 0)
            {
                Content = new ShellView();
            }
            else
            {
                Content = new WelcomeView();
            }
        }
Beispiel #9
0
        private void AppStartup(object sender, StartupEventArgs e)
        {
            IOHelper.CreateDirectoryIfNotExist(AppDataPath);
            if (File.Exists(DataPath))
            {
                SerializationHelper.Current.Load(DataPath);
            }

            Installer.Install();
            Instances.Get <MainView>().Show();

            ThemeManager.ApplyTheme(this, Theme.Light, (SolidColorBrush)Application.Current.FindBrush("AccentColor"),
                                    (SolidColorBrush)Application.Current.FindBrush("FontColor"));
        }
        private void AddNewDirectoryView()
        {
            if (addingView)
            {
                return;
            }

            addingView = true;
            var view = Instances.Get <DirectoryViewModel>();

            view.LoadDirectory(ActiveView.FullPath);
            Directories.Insert(Directories.Count - 1, view);
            ActiveView = view;
            addingView = false;
        }
Beispiel #11
0
        public object GetValue(Type baseType, string name = null, params object[] constructorArgs)
        {
            object item = _instance.Get(baseType, name);

            if (item != null)
            {
                return(item);
            }
            Type map = this._type.Get(baseType, name);

            if (map != null)
            {
                return(this.CreateInstance(map, constructorArgs));
            }
            return(null);
        }
Beispiel #12
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            SqlFuDao.ConnectionStringIs(ConfigurationManager.ConnectionStrings["mainConnString"].ConnectionString, DbEngine.SQLite);
            Instances.RegisterTransient <LocationChoice>();
            Instances.RegisterTransient <MainWindow>();

            if (Settings.Default.Airport.IsNullOrEmpty())
            {
                Instances.Get <LocationChoice>().Show();
            }
            else
            {
                Instances.Get <MainWindow>().Show();
            }
        }
        public override void Execute(object parameter)
        {
            var dialog = Instances.Get <AccountManagerDialog>();

            dialog.ShowModalDialog();
        }
Beispiel #14
0
        public FileSystemBase CreateFileSystem()
        {
            Account acc = Instances.Get <AccountManager>().GetAccountById(AccountId);

            return(new FTPFileSystem(acc, FullName));
        }