Ejemplo n.º 1
0
        // Set the expansion state on the CategoryContainer based on an existing container
        // or a cached value for the contained category
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            CiderCategoryContainer container = element as CiderCategoryContainer;
            CategoryEntry          category  = item as CategoryEntry;

            if (container != null && category != null)
            {
                // Ideally, we would want to initalize the expansion state here.  However,
                // in collection editor, Blend messes around with the expansion state _after_
                // the call to this method, which breaks our ability to remember which categories
                // were open and which were closed.  So, we set the state here (because Blend's
                // search logic relies on it to be set by this point) and _reset_ it in the Loaded
                // event handler.

                // Look into stored state
                CategoryState state = _categoryStates.GetCategoryState(category.CategoryName);
                container.Expanded = state.CategoryExpanded;
                container.AdvancedSectionPinned = state.AdvancedSectionExpanded;

                // Hook into other event handlers that we care about (including the Loaded event)
                container.Loaded   += new RoutedEventHandler(OnContainerLoaded);
                container.Unloaded += new RoutedEventHandler(OnContainerUnloaded);

                if (ContainerGenerated != null)
                {
                    ContainerGenerated(this, new ContainerGeneratedEventArgs(container));
                }
            }
            else
            {
                Debug.Fail("CategoryList should only be populated with CategoryEntries.");
            }

            base.PrepareContainerForItemOverride(element, item);
        }
Ejemplo n.º 2
0
            public static CategoryState ReduceAddCategoryAction(CategoryState state, AddCategoryAction action)
            {
                var categories = state.Categories;

                categories.Add(new Models.Category(action.categoryName));
                return(new CategoryState(categories));
            }
Ejemplo n.º 3
0
            public static CategoryState ReduceRemoveCategoryAction(CategoryState state, RemoveCategoryAction action)
            {
                var categories = state.Categories;

                categories.Remove(categories.Find(x => x.SystemId == action.systemId));
                return(new CategoryState(categories));
            }
Ejemplo n.º 4
0
        public Saga(SagaConfiguration configuration, IPersistenceClient persistence, ILogger logger)
        {
            this.logger = logger;

            this.configuration = configuration;
            this.persistence   = persistence;
            this.state         = new CategoryState(logger, this.configuration.Categories);
        }
        void OnGUI()
        {
            EditorGUILayout.Space();

            if (!EditorApplication.isPlayingOrWillChangePlaymode || _options == null)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.Label("SROptions can only be edited in play-mode.");
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                return;
            }

            if (_divider == null)
            {
                _divider = new GUIStyle(GUI.skin.box);
                _divider.stretchWidth = true;
                _divider.fixedHeight  = 2;
            }

            if (_foldout == null)
            {
                _foldout           = new GUIStyle(EditorStyles.foldout);
                _foldout.fontStyle = FontStyle.Bold;
            }

            _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);

            foreach (var kv in _options)
            {
                var state = _categoryStates.FirstOrDefault(p => p.Name == kv.Key);

                if (state == null)
                {
                    state = new CategoryState()
                    {
                        Name   = kv.Key,
                        IsOpen = true
                    };
                    _categoryStates.Add(state);
                }

                state.IsOpen = EditorGUILayout.Foldout(state.IsOpen, kv.Key, _foldout);

                if (!state.IsOpen)
                {
                    continue;
                }

                EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);
                OnGUI_Category(kv.Value);
                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndScrollView();
        }
Ejemplo n.º 6
0

        
Ejemplo n.º 7
0
    static void ShowPersonel(bool isFirst)
    {
        TextWriter.Clear();
        ShowNal();
        if (isFirst)
        {
            Values.N1++;
            Functions.RecalcPersonel();
        }

        CategoryState state = Functions.ArrStat(Values.D);

        TextWriter.ShowMsg("\n");
        if (state != CategoryState.BUYONLY)
        {
            TextWriter.ShowMsg(Language.canSell[4]);
            for (int i = 0; i < 5; i++)
            {
                if (Values.D[i] == 1)
                {
                    TextWriter.ShowMsg(Language.VCS[i] + "\t\t\t" + (Values.D1[i] * 0.2f).ToString() + "\n");
                }
            }
        }

        TextWriter.ShowMsg("\n");
        if (state != CategoryState.SELLONLY)
        {
            TextWriter.ShowMsg(Language.canBuy[4]);
            for (int i = 0; i < 5; i++)
            {
                if (Values.D[i] == 0)
                {
                    TextWriter.ShowMsg(Language.VCS[i] + "\t\t\t" + Values.D1[i].ToString() + "\n");
                }
            }
        }

        TextWriter.ShowMsg("\n");
        TextWriter.ShowMsg(Language.WillBuy[curMenuFlag]);
        Controller.GetStr(WaitBuy, true);
    }
Ejemplo n.º 8
0
    static void ShowFlat(bool first = false)
    {
        if (first)
        {
            Values.N1++;
            Functions.RecalcRealtyPrice();
        }
        TextWriter.Clear();
        TextWriter.ShowMsg("\n");
        ShowNal();
        CategoryState state = Functions.ArrStat(Values.C);

        if (state != CategoryState.BUYONLY)
        {
            TextWriter.ShowMsg(Language.canSell[3]);
            for (int i = 0; i < Values.C.Length; i++)
            {
                if (Values.C[i] == 1)
                {
                    TextWriter.ShowMsg(Language.VBS[i] + "\t\t\t" + Values.C2[i].ToString() + "\n");
                }
            }
        }
        TextWriter.ShowMsg("\n");
        if (state != CategoryState.SELLONLY)
        {
            TextWriter.ShowMsg(Language.canBuy[3]);
            for (int i = 0; i < Values.C.Length; i++)
            {
                if (Values.C[i] == 0)
                {
                    TextWriter.ShowMsg(Language.VBS[i] + "\t\t\t" + Values.C3[i].ToString() + "\n");
                }
            }
        }
        TextWriter.ShowMsg("\n");
        TextWriter.ShowMsg(Language.Expenses);
        TextWriter.ShowMsg("\n");
        TextWriter.ShowMsg(Language.WillBuy[curMenuFlag]);
        Controller.GetStr(WaitBuy, true);
    }
Ejemplo n.º 9
0
        private void OnAdvancedSectionPinnedChanged(object sender, EventArgs e)
        {
            // If we are in "Filter-applied" mode, don't store the expansion state, since applying
            // the filter automatically expands everything that matches that filter
            if (_currentFilter != null && !_currentFilter.IsEmpty)
            {
                return;
            }

            CiderCategoryContainer container = sender as CiderCategoryContainer;

            if (container != null)
            {
                CategoryEntry category = container.Category;
                if (category != null)
                {
                    CategoryState state = _categoryStates.GetCategoryState(container.Category.CategoryName);
                    state.AdvancedSectionExpanded = container.AdvancedSectionPinned;
                }
            }
        }
Ejemplo n.º 10
0
        public void Handle(CategoryStartedEvent evnt)
        {
            var key = KeyUtils.GetStateKey(evnt.AggregateId);

            var state = _db.GetObject <BlogState>(key);

            if (state == null)
            {
                throw new Exception("Blog has to be started first.");
            }

            var category = new CategoryState
            {
                Url   = evnt.Url,
                Title = evnt.Title
            };

            state.Categories.Add(category);

            _db.SetObject(key, state);
        }
Ejemplo n.º 11
0
    /// <summary>
    /// Показать бизнес
    /// 262
    /// </summary>
    static void ShowBusiness(bool isFirst)
    {
        TextWriter.Clear();
        ShowNal();
        TextWriter.ShowMsg("\n");
        if (isFirst)
        {
            Values.N1++;
            Functions.RecalcBusiness();
        }
        CategoryState state = Functions.ArrStat(Values.E);

        if (state != CategoryState.BUYONLY)
        {
            TextWriter.ShowMsg(Language.canSell[5]);
            for (int i = 0; i < 5; i++)
            {
                if (Values.E[i] == 1)
                {
                    TextWriter.ShowMsg(Language.VDS[i] + "\t\t" + Values.E2[i].ToString().PadRight(10) + "\t" + Values.E1[i] + "\n");
                }
            }
        }

        if (state != CategoryState.SELLONLY)
        {
            TextWriter.ShowMsg(Language.canBuy[5]);
            for (int i = 0; i < 5; i++)
            {
                if (Values.E[i] == 0)
                {
                    TextWriter.ShowMsg(Language.VDS[i] + "\t\t" + Values.E3[i].ToString().PadRight(10) + "\t" + Values.E1[i] + "\n");
                }
            }
        }
        TextWriter.ShowMsg("\n");
        TextWriter.ShowMsg(Language.WillBuy[curMenuFlag]);
        Controller.GetStr(WaitBuy, true);
    }
Ejemplo n.º 12
0
        // Re-initialize the expansion state here and hook into the ExpandedChanged and
        // AdvancedSectionPinnedChanged events, because by now Blend may have ----ed those
        // two values up (see comment in PrepareContainerForItemOverride() )
        private void OnContainerLoaded(object sender, RoutedEventArgs e)
        {
            CiderCategoryContainer container = sender as CiderCategoryContainer;

            if (container != null)
            {
                CategoryEntry category = container.Category;
                if (category != null)
                {
                    // Look into stored state
                    CategoryState state = _categoryStates.GetCategoryState(category.CategoryName);
                    container.Expanded = state.CategoryExpanded;
                    container.AdvancedSectionPinned = state.AdvancedSectionExpanded;

                    // Hook into these events here, because Blend won't mess the state up at this point
                    container.ExpandedChanged += new EventHandler(OnContainerExpandedChanged);
                    container.AdvancedSectionPinnedChanged += new EventHandler(OnAdvancedSectionPinnedChanged);
                }
            }
            else
            {
                Debug.Fail("CategoryList expects the individual items to be CiderCategoryContainers");
            }
        }
Ejemplo n.º 13
0
 public void CardSelected(Card card)
 {
     this._state      = CategoryState.OpenPage;
     this._pageToOpen = card;
 }