public static void Init(Products.Product targetBase = null, Action <Products.Product> OnComplete = null)
        {
            CompletedAction = OnComplete;

            if (targetBase != null)
            {
                CurrentBase = (Products.Product)targetBase.Clone();
            }
            else
            {
                CurrentBase = new Products.Product();
            }

            int itemCount = TemplateEditor.CurrentTemplate.ItemDefinitions.Count;

            itemList = new string[itemCount];
            for (int i = 0; i < itemCount; i++)
            {
                if (TemplateEditor.CurrentTemplate.ItemDefinitions[i].Id == CurrentBase.ItemId)
                {
                    selection = i;
                }

                itemList[i] = TemplateEditor.CurrentTemplate.ItemDefinitions[i].Id;
            }

            pricesEditor = new PricesEditor();

            // Create window.
            var window = (ProductEditor)GetWindow(typeof(ProductEditor));

            window.minSize = new Vector2(320, 435);
            window.maxSize = new Vector2(320, 435);
            window.Show();
        }
        public static void Init(Products.Bundle targetBase = null, Action <Products.Bundle> OnComplete = null)
        {
            CompletedAction = OnComplete;

            if (targetBase != null)
            {
                CurrentBase = (Products.Bundle)targetBase.Clone();
            }
            else
            {
                CurrentBase = new Products.Bundle();
            }

            int templateProductsCount = CurrentBase.BundleItems.Count;
            int totalItemsCount       = TemplateEditor.CurrentTemplate.ItemDefinitions.Count;

            selection = new int[templateProductsCount];

            itemList = new string[totalItemsCount];
            for (int i = 0; i < totalItemsCount; i++)
            {
                itemList[i] = TemplateEditor.CurrentTemplate.ItemDefinitions[i].Id;
            }

            // set current selections
            for (int i = 0; i < templateProductsCount; i++)
            {
                selection[i] = itemList.ToList().FindIndex(x => x.Equals(CurrentBase.BundleItems[i].ItemId));
            }

            pricesEditor = new PricesEditor();
            // Create window.
            var window = (BundleEditor)GetWindow(typeof(BundleEditor));

            window.minSize = new Vector2(320, 510);
            window.maxSize = new Vector2(320, 510);
            window.Show();
        }