Пример #1
0
        public int MoveDownSeriesWidget(SeriesWidgets swid)
        {
            // read the series widgets order
            string[] widgets    = AppSettings.SeriesWidgetsOrder.Split(';');
            string   moveWidget = ((int)swid).ToString();

            // find the position of the language to be moved
            int pos = -1;

            for (int i = 0; i < widgets.Length; i++)
            {
                if (widgets[i].Trim().ToUpper() == moveWidget.Trim().ToUpper())
                {
                    pos = i;
                }
            }

            if (pos == -1)
            {
                return(-1);           // not found
            }
            if (pos == widgets.Length - 1)
            {
                return(-1);                           // already at bottom
            }
            string lan1 = widgets[pos + 1];

            widgets[pos + 1] = moveWidget;
            widgets[pos]     = lan1;

            string newWidgetOrder = string.Empty;

            foreach (string wid in widgets)
            {
                if (!string.IsNullOrEmpty(newWidgetOrder))
                {
                    newWidgetOrder += ";";
                }

                newWidgetOrder += wid;
            }

            AppSettings.SeriesWidgetsOrder = newWidgetOrder;

            return(pos + 1);
        }
Пример #2
0
        public int GetSeriesWidgetPosition(SeriesWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.SeriesWidgetsOrder.Split(';');

            int i = 1;

            foreach (string widget in widgets)
            {
                SeriesWidgets thisswid = (SeriesWidgets)int.Parse(widget);

                if (thisswid == swid)
                {
                    return(i);
                }
                else
                {
                    i++;
                }
            }

            return(1);
        }
Пример #3
0
        public int MoveUpSeriesWidget(SeriesWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.SeriesWidgetsOrder.Split(';');

            string moveWidget = ((int)swid).ToString();

            // find the position of the language to be moved
            int pos = -1;
            for (int i = 0; i < widgets.Length; i++)
            {
                if (widgets[i].Trim().ToUpper() == moveWidget.Trim().ToUpper()) pos = i;
            }

            if (pos == -1) return -1; // not found
            if (pos == 0) return -1; // already at top

            string wid1 = widgets[pos - 1];
            widgets[pos - 1] = moveWidget;
            widgets[pos] = wid1;

            string newWidgetOrder = string.Empty;
            foreach (string wid in widgets)
            {
                if (!string.IsNullOrEmpty(newWidgetOrder))
                    newWidgetOrder += ";";

                newWidgetOrder += wid;
            }

            AppSettings.SeriesWidgetsOrder = newWidgetOrder;

            return pos - 1;
        }
Пример #4
0
        public int GetSeriesWidgetPosition(SeriesWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.SeriesWidgetsOrder.Split(';');

            int i = 1;
            foreach (string widget in widgets)
            {
                SeriesWidgets thisswid = (SeriesWidgets)int.Parse(widget);

                if (thisswid == swid)
                    return i;
                else
                    i++;
            }

            return 1;
        }