Пример #1
0
        public async Task <ResultSingle <Inkton.Nest.Model.Nest> > QueryNestAsync(Inkton.Nest.Model.Nest nest = null,
                                                                                  bool doCache = false, bool throwIfError = true)
        {
            Inkton.Nest.Model.Nest theNest = nest == null ? _editNest : nest;

            ResultSingle <Inkton.Nest.Model.Nest> result = await ResultSingleUI <Inkton.Nest.Model.Nest> .WaitForObjectAsync(
                throwIfError, theNest, new CachedHttpRequest <Inkton.Nest.Model.Nest, ResultSingle <Inkton.Nest.Model.Nest> >(
                    Backend.QueryAsync), doCache, null, null);

            if (result.Code >= 0)
            {
                _editNest = result.Data.Payload;

                if (nest != null)
                {
                    _editNest.CopyTo(nest);
                }
            }

            return(result);
        }
Пример #2
0
        public async Task <ResultSingle <Inkton.Nest.Model.Nest> > CreateNestAsync(Inkton.Nest.Model.Nest nest = null,
                                                                                   bool doCache = false, bool throwIfError = true)
        {
            Inkton.Nest.Model.Nest theNest = nest == null ? _editNest : nest;

            ResultSingle <Inkton.Nest.Model.Nest> result = await ResultSingleUI <Inkton.Nest.Model.Nest> .WaitForObjectAsync(
                throwIfError, theNest, new CachedHttpRequest <Inkton.Nest.Model.Nest, ResultSingle <Inkton.Nest.Model.Nest> >(
                    Backend.CreateAsync), doCache);

            if (result.Code >= 0)
            {
                _editNest = result.Data.Payload;

                if (nest != null)
                {
                    _editNest.CopyTo(nest);
                    _nests.Add(nest);
                }

                OnPropertyChanged("Nests");
            }

            return(result);
        }
Пример #3
0
        private void SetDefaults()
        {
            Memory.SelectedIndex = 0;
            Type.SelectedIndex   = 0;

            if (AppNestsList.SelectedItem == null)
            {
                Type.IsEnabled = true;
                return;
            }
            else
            {
                Type.IsEnabled = false;
            }

            Inkton.Nest.Model.Nest browseNest = AppNestsList.SelectedItem as Inkton.Nest.Model.Nest;
            Inkton.Nest.Model.Nest copy       = new Inkton.Nest.Model.Nest();
            browseNest.CopyTo(copy);
            AppViewModel.NestViewModel.EditNest = copy;

            int index = 0;

            foreach (string memory in Memory.Items)
            {
                if (memory == browseNest.ScaleSize)
                {
                    Memory.SelectedIndex = index;
                }
                ++index;
            }

            Scaling.Value = browseNest.Scale;
            NestPlatform platform = AppViewModel.NestViewModel.Platforms.First(
                x => x.Id == browseNest.PlatformId);

            if (AppViewModel.EditApp.Type == "uniflow")
            {
                /*
                 * The standard webserver can be a mvc or api type
                 * + worker makes 3 nest types
                 */
                System.Diagnostics.Debug.Assert(Type.Items.Count == 3);

                if (platform.Tag == "mvc")
                {
                    Type.SelectedIndex = 0;
                }
                else if (platform.Tag == "api")
                {
                    Type.SelectedIndex = 1;
                }
                else
                {
                    Type.SelectedIndex = 2;
                }
            }
            else if (AppViewModel.EditApp.Type == "biflow")
            {
                /*
                 * The websocket can be a mvc type only
                 * + worker makes 2 nest types
                 */
                System.Diagnostics.Debug.Assert(Type.Items.Count == 2);

                if (platform.Tag == "mvc")
                {
                    Type.SelectedIndex = 0;
                }
                else
                {
                    Type.SelectedIndex = 1;
                }
            }
        }