示例#1
0
        public ClientView(CredsModel creds)
        {
            PublicTradeSessionCommand = new Command(async() => await GetPublicTradeSession());
            PublicCurrenciesCommand   = new Command(async() => await GetPublicCurrencies());
            PublicSymbolsCommand      = new Command(async() => await GetPublicSymbols());
            PublicTicksCommand        = new Command(async() => await GetPublicTicks());
            PublicTicksL2Command      = new Command(async() => await GetPublicTicksLevel2());
            PublicTickersCommand      = new Command(async() => await GetPublicTickers());

            AccountInfoCommand  = new Command(async() => await GetAccount());
            TradeSessionCommand = new Command(async() => await GetTradeSession());
            CurrenciesCommand   = new Command(async() => await GetCurrencies());
            SymbolsCommand      = new Command(async() => await GetSymbols());
            TicksCommand        = new Command(async() => await GetTicks());
            TicksL2Command      = new Command(async() => await GetTicksLevel2());
            AssetsCommand       = new Command(async() => await GetAssets());
            PositionsCommand    = new Command(async() => await GetPositions());
            TradesCommand       = new Command(async() => await GetTrades());

            if (creds.IsPublicOnly)
            {
                _client          = new TickTraderWebClient(creds.WebApiAddress);
                IsPublicEnabled  = true;
                IsPrivateEnabled = false;
            }
            else
            {
                _client          = new TickTraderWebClient(creds.WebApiAddress, creds.WebApiId, creds.WebApiKey, creds.WebApiSecret);
                IsPublicEnabled  = true;
                IsPrivateEnabled = true;
                AccountInfoCommand.Execute(null);
            }
        }
示例#2
0
 private void OnClose()
 {
     Creds = new CredsModel()
     {
         WebApiId = Login, WebApiKey = Password, WebApiAddress = Server, WebApiSecret = Secret, Account = Account
     };
     Closed();
 }
示例#3
0
 public CredsDialogModel(CredsModel creds) : this()
 {
     Title    = "Edit Credentials";
     Login    = creds.WebApiId;
     Password = creds.WebApiKey;
     Server   = creds.WebApiAddress;
     Secret   = creds.WebApiSecret;
 }
示例#4
0
        public MainWindowModel(IWndService wndService)
        {
            _service      = wndService;
            StartCommand  = new Command(Start);
            StopCommand   = new Command(Stop);
            AddCommand    = new Command(AddCreds);
            DeleteCommand = new Command(DeleteCreds);
            EditCommand   = new Command(EditCreds);

            CredsList = new ObservableCollection <CredsModel>();

            if (Settings.Default.Creds != null)
            {
                foreach (var credsStr in Settings.Default.Creds)
                {
                    var credsItem = CredsModel.Parse(credsStr);
                    if (credsItem != null && !CredsList.Contains(credsItem))
                    {
                        CredsList.Add(credsItem);
                    }
                }
            }

            var savedSelected = CredsModel.Parse(Settings.Default.LastCred);

            if (savedSelected != null)
            {
                if (CredsList.Contains(savedSelected))
                {
                    SelectedCreds = savedSelected;
                }
            }
            if (SelectedCreds == null)
            {
                SelectedCreds = CredsList.FirstOrDefault();
            }

            UpdateCredsButtonState();
            Validate();
        }