Ejemplo n.º 1
0
        private void updateNamesListBox()
        {
            Program.allLuas     = Program.fetcher.getAllLuas();
            Program.allLuaNames = Program.fetcher.getNames();
            listViewWidgets.Clear();

            IEnumerator ienum = Program.allLuaNames.Values.GetEnumerator();

            while (ienum.MoveNext())
            {
                WidgetName info = (WidgetName)ienum.Current;

                ListViewItem item = new ListViewItem(info.Name);
                item.Tag = info.Id.ToString();

                if (!Program.isSuperAdmin && (info.ownerId != Program.UserId))
                {
                    item.ForeColor = Color.LightGray;
                }

                listViewWidgets.Items.Add(item);
            }

            try
            {
                this.updateWidgetNameDisplay(getSelectedWidgetName());
            }
            catch (Exception)
            {
                this.updateWidgetNameDisplay("");
            }
        }
Ejemplo n.º 2
0
        public void SingleOrPareto(string widgetName, string widget)

        {
            //DashboardInitialize(widgetName);

            AddWidget(widgetName);

            SingleMetric("Total Completed Hours");

            RatioMetric();

            CustomMetric();

            Filter();

            Axis(widgetName);

            Options("Formatting").Clicks();

            Formatting();

            Options("Base").Clicks();

            BasenGoal(1000, 4000);

            WidgetName.ClearText(); WidgetName.EnterText(widget);

            Apply();
        }
        /// <summary>
        /// Update Widget by Id
        /// </summary>
        /// <param name="name">Id of Widget</param>
        public void UpdateWidget(WidgetName name)
        {
            Widget widget = GetWidget(name);

            if (widget)
            {
                widget.UpdateWidget();
            }
        }
Ejemplo n.º 4
0
        private void saveName_Click(object sender, EventArgs e)
        {
            Program.fetcher.updateName(this.getSelectedNameId(), textBoxName.Text, textBoxAuthor.Text, textBoxMods.Text, textBoxDesc.Text, checkBoxWidgetHidden.Checked, (comboBoxCategory.SelectedItem as Category).id);

            WidgetName current = (WidgetName)Program.allLuaNames[this.getSelectedWidgetName()];

            current.Name          = textBoxName.Text;
            current.Author        = textBoxAuthor.Text;
            current.SupportedMods = textBoxMods.Text;
            current.Description   = textBoxDesc.Text;
            current.Hidden        = checkBoxWidgetHidden.Checked;
            current.CategoryId    = (comboBoxCategory.SelectedItem as Category).id;
        }
        /// <summary>
        /// Hide Widget by Id to voilate LIFO Rule, its Handy in Some Situations
        /// </summary>
        /// <param name="id"> Widget to Hide </param>
        /// <param name="isPlayShowTween">Play OnShow Tween of Previous Widget</param>
        public void Pop(WidgetName id, bool isPlayShowTween = true)
        {
            if (m_stack.Count < 1)
            {
                Debug.Log("<color=red>There is no more item in stack:</color>");
                return;
            }


            if (m_stack.Count > 1)      // if there are more than 1 widget
            {
                m_stack[1].Show(isPlayShowTween);
            }

            Widget top = GetWidget(id);

            if (top == null)
            {
                Debug.Log("<color=red>There is no Active Widget by this Id:</color>" + " " + id.ToString());
                return;
            }
            top.Hide();
            if (!top.IsPoolOnLoad)
            {
                if (top.Tweens != null)
                {
                    m_handler = top.Tweens.GetTweenHandler();
                }
                if (m_handler != null)
                {
                    m_handler.setOnComplete(() =>
                    {
                        m_pooledWidgets.Remove(top);
                        Destroy(top.gameObject);
                    });
                }
                else
                {
                    m_pooledWidgets.Remove(top);
                    Destroy(top.gameObject);
                }
            }
            m_stack.Remove(top);
        }
        /// <summary>
        /// Push Widget on top of stack
        /// </summary>
        /// <param name="id">Id of Widget</param>
        /// <param name="isPlayHideTween">Play hide tween of previous widget</param>
        /// <param name="lastActive">Is previous Widget Visible</param>
        /// <param name="lastInteractive">Is previous Widget Interactable, in case of small panels</param>
        /// <param name="firstChild">Set Widget as first child </param>
        public void Push(WidgetName id, bool isPlayHideTween = true, bool lastActive = false, bool lastInteractive = false, bool firstChild = false)
        {
            if (m_stack.Count >= 1)
            {
                if (!lastActive)
                {
                    m_stack[0].Hide(isPlayHideTween);
                }
                m_stack[0].CanvasGroup.interactable = lastInteractive;
            }

            Widget widget = GetPooledWidget(id);

            if (!widget || !widget.IsPoolOnLoad)
            {
                var        wToLoad   = Database.GetDatabase().Find(w => w.Id == id);
                GameObject widgetObj = Instantiate(Resources.Load(wToLoad.perfabPath)) as GameObject;
                widget = widgetObj.GetComponent <Widget>();
                widget.IsPoolOnLoad = wToLoad.PoolOnLoad;
                widget.Id           = id;
                m_pooledWidgets.Add(widget);
            }

            widget.transform.SetParent(m_parent, false);

            if (firstChild)
            {
                widget.transform.SetAsFirstSibling();
            }
            else
            {
                widget.transform.SetAsLastSibling();
            }
            widget.Init();
            widget.Show();
            m_stack.Insert(0, widget);
        }
        /// <summary>
        /// These Methods used by this class no concern for user
        /// </summary>

        #region Helper Methods

        private Widget GetPooledWidget(WidgetName name)
        {
            return(m_pooledWidgets.Find(id => id.Id == name));
        }
 /// <summary>
 /// Get Widget by Id
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public Widget GetWidget(WidgetName name)
 {
     return(m_stack.Find(id => id.Id == name));
 }
Ejemplo n.º 9
0
        private void updateWidgetNameDisplay(string nameIn)
        {
            if ((nameIn.Length == 0 || (Program.UserId != ((WidgetName)Program.allLuaNames[nameIn]).ownerId) && (Program.isSuperAdmin == false)))
            {
                this.toggleWidgetNameDisplayElements(false);
                return;
            }

            this.toggleWidgetNameDisplayElements(true);

            WidgetName name = (WidgetName)Program.allLuaNames[nameIn];

            //thumbnail
            pictureBoxThumb.ImageLocation = thumbnailBaseUrl + name.Id.ToString();
            pictureBoxThumb.Visible       = true;
            try
            {
                pictureBoxThumb.Load();
            }
            catch (Exception)
            {
                pictureBoxThumb.Image = null;
            }

            textBoxName.Text             = name.Name;
            textBoxAuthor.Text           = name.Author;
            textBoxDesc.Text             = name.Description;
            textBoxMods.Text             = name.SupportedMods;
            checkBoxWidgetHidden.Checked = name.Hidden;
            if (name.CategoryId == 0)
            {
                comboBoxCategory.SelectedIndex = 0;
            }
            else
            {
                comboBoxCategory.SelectedItem = Program.allCategories[name.CategoryId];
            }

            listViewImages.Clear();
            LinkedList <FileInfo> images = Program.fetcher.getImagesByNameId(name.Id);
            IEnumerator           ienum  = images.GetEnumerator();

            while (ienum.MoveNext())
            {
                FileInfo info = (FileInfo)ienum.Current;

                ListViewItem item = new ListViewItem();
                item.Text = info.Url;
                item.Tag  = info.id.ToString();
                listViewImages.Items.Add(item);
            }

            listViewVersions.Clear();
            ienum = Program.allLuas.Values.GetEnumerator();
            while (ienum.MoveNext())
            {
                WidgetInfo winfo = (WidgetInfo)ienum.Current;
                if (winfo.nameId == name.Id)
                {
                    ListViewItem item = new ListViewItem();
                    item.Tag  = winfo.id.ToString();
                    item.Text = winfo.version.ToString("G29", CultureInfo.InvariantCulture);

                    listViewVersions.Items.Add(item);
                }
            }


            this.updateVersionView();
        }