Пример #1
0
        public MainWindowViewModel(IRegionManager regionManager, IApplicationCommand applicationCommand,
                                   TmsClient nepse, IDialogService dialog, MeroshareClient meroshareClient, IConfiguration config)
        {
            _regionManager     = regionManager;
            _client            = nepse;
            _dialog            = dialog;
            _meroshareClient   = meroshareClient;
            _config            = config;
            ApplicationCommand = applicationCommand;

            applicationCommand.ShowMessage    = ShowMessage;
            _client.PromptCredentials         = GetTmsCredentials;
            _meroshareClient.PromptCredential = GetMeroShareCredentials;
        }
 public MeroShareAsbaApplicationReportPageViewModel(IApplicationCommand appCommand,
                                                    MeroshareClient client, IDialogService dialog) : base(appCommand)
 {
     _client = client;
     _dialog = dialog;
 }
        public SettingsPageViewModel(MeroshareClient client)
        {
            var pageItems = new List <SelectedTabItem>
            {
                new SelectedTabItem {
                    ViewName = nameof(PortfolioPage), DisplayName = "Portfolio"
                },
                new SelectedTabItem {
                    ViewName = nameof(AsbaPage), DisplayName = "My ASBA"
                },
                new SelectedTabItem {
                    ViewName = nameof(TmsLiveMarketPage), DisplayName = "Live Market"
                },
                new SelectedTabItem {
                    ViewName = nameof(SettingsPage), DisplayName = "Settings"
                },
            };

            GeneralItems = new List <SettingsItem>
            {
                new ToggleSettingsItem
                {
                    IconKind  = MaterialDesignThemes.Wpf.PackIconKind.Refresh,
                    Name      = "Auto Refresh",
                    IsChecked = Settings.Default.AutoRefreshOnLoad,
                    OnSave    = value => Settings.Default.AutoRefreshOnLoad = value,
                    OnReset   = () => Settings.Default.AutoRefreshOnLoad,
                },

                new ComboBoxSettingsItem
                {
                    IconKind          = MaterialDesignThemes.Wpf.PackIconKind.Tab,
                    Name              = "Open Tab on Load",
                    DisplayMemberPath = "DisplayName",
                    Items             = pageItems,
                    SelectedItem      = pageItems.FirstOrDefault(x => x.ViewName.Equals(Settings.Default.SelectedTab)),
                    OnSave            = value => Settings.Default.SelectedTab = (value as SelectedTabItem)?.ViewName,
                    OnReset           = () => pageItems.FirstOrDefault(x => x.ViewName.Equals(Settings.Default.SelectedTab)),
                }
            };

            TmsItems = new List <SettingsItem>
            {
                new SettingsHeaderItem
                {
                    Name = "Tms",
                },

                new TextBoxSettingsItem
                {
                    IconKind = MaterialDesignThemes.Wpf.PackIconKind.Web,
                    Name     = "Base URL",
                    Value    = Settings.Default.TmsBaseUrl,
                    OnSave   = value => Settings.Default.TmsBaseUrl = value,
                    OnReset  = () => Settings.Default.TmsBaseUrl,
                }
            };

            var capitals = /*new MeroshareCapitalResponse[0];//*/ client.GetCapitals();

            MeroShareItems = new List <SettingsItem>
            {
                new SettingsHeaderItem
                {
                    Name = "MeroShare",
                },

                new ComboBoxSettingsItem
                {
                    IconKind     = MaterialDesignThemes.Wpf.PackIconKind.Tab,
                    Name         = "DP",
                    Items        = capitals,
                    SelectedItem = capitals.FirstOrDefault(x => x.Id.Equals(Settings.Default.MeroShareClientId)),
                    OnSave       = value => Settings.Default.MeroShareClientId = (value as MeroshareCapitalResponse)?.Id,
                    OnReset      = () => capitals.FirstOrDefault(x => x.Id.Equals(Settings.Default.MeroShareClientId)),
                }
            };
        }
Пример #4
0
 public MeroShareApplicationDialogPageViewModel(MeroshareClient client)
 {
     _client = client;
 }
 public PortfolioPageViewModel(MeroshareClient client, IApplicationCommand applicationCommand) :
     base(applicationCommand)
 {
     _client = client;
 }