Beispiel #1
0
        static bool Tumbler()
        {
            Console.Clear();
            var st = new SetLabel();

            st.Label("Выберите действие");
            st.AddPoint(0, "Выход");
            st.AddPoint(1, "Проверка ввода логина");
            st.AddPoint(2, "Операции с текстом");
            st.AddPoint(3, "Проверка на анаграммность");

            switch (st.UserSelTask())
            {
            case 0:
                Exit.ExitProgram();
                return(false);

            case 1:
                CheckLogin.Main();
                return(true);

            case 2:
                Task_2.Main();
                return(true);

            case 3:
                Anagram.Main();
                return(true);

            default:
                return(true);
            }
        }
 public void ThreadSetLabel(string text)
 {
     SetLabel sl = new SetLabel(SetLabelText);
     object[] pms = new object[1];
     pms[0] = text;
     Invoke(sl, pms);
 }
Beispiel #3
0
        private void DrawPartition(SKCanvas canvas, SKImageInfo info, float textSize, double startValue, double endValue,
                                   double currentValue, bool highlight = false)
        {
            double unitDisplaySize = ((Orientation == GaugeOrientation.Horizontal ? info.Width : info.Height) - Margin * 2) / DisplayRange;

            float position;

            if (Orientation == GaugeOrientation.Horizontal)
            {
                position = (float)(Margin + (Unit.NormalizedDifference(currentValue, startValue) * unitDisplaySize));
            }
            else
            {
                position = (float)(Margin + (endValue - currentValue) * unitDisplaySize);
            }

            if (highlight)
            {
                if (Orientation == GaugeOrientation.Horizontal)
                {
                    canvas.DrawLine(position, textSize + TextMargin, position, info.Height, HighlightedLineStyle);
                }
                else
                {
                    canvas.DrawLine(info.Width * 0.5f, position, info.Width, position, HighlightedLineStyle);
                }
            }
            else if (currentValue.Emphasize(PartitionSize, PartitionGroupSize))
            {
                if (Orientation == GaugeOrientation.Horizontal)
                {
                    canvas.DrawLine(position, textSize + TextMargin, position, info.Height, LineStyle);
                }
                else
                {
                    canvas.DrawLine(info.Width * 0.5f, position, info.Width, position, LineStyle);
                }
            }
            else
            {
                if (Orientation == GaugeOrientation.Horizontal)
                {
                    canvas.DrawLine(position, textSize + TextMargin, position,
                                    textSize + TextMargin + (float)((info.Height - textSize - TextMargin) * 0.66), LineStyle);
                }
                else
                {
                    canvas.DrawLine(info.Width * 0.5f, position, (float)(info.Width * 0.5f) + (float)(info.Width * 0.33), position,
                                    LineStyle);
                }
            }

            string label = SetLabel?.Invoke(currentValue);

            if (!string.IsNullOrEmpty(label))
            {
                DrawText(canvas, info, position, label);
            }
        }
Beispiel #4
0
 //private string _rtk;
 //private string token;
 public AddFriendForm(string Cookiesstr, CookieContainer cc, string _rtk, string token)
 {
     InitializeComponent();
     listView1.View    = View.Details;
     AddFriendDelegate = new AddListItem(AddFriendListItemMethod);
     SetLabelDelegate  = new SetLabel(SetFriendCountLabel);
     FriendDelegate    = new AddListItem(FriendListItemMethod);
 }
Beispiel #5
0
        public void ThreadSetLabel(string text)
        {
            SetLabel sl = new SetLabel(SetLabelText);

            object[] pms = new object[1];
            pms[0] = text;
            Invoke(sl, pms);
        }
 public JsonResult SetLabel(SetLabel setLabel)
 {
     CommunicateManager.Invoke <IConsoBusinessmanService>(p =>
     {
         p.SetLabel(setLabel);
     });
     return(Json(null, JsonRequestBehavior.DenyGet));
 }
Beispiel #7
0
 public override int GetHashCode()
 {
     return(PrimaryFolder.GetHashCode() ^ Unread.GetHashCode() ^ Attachments.GetHashCode() ^
            PeriodFrom.GetHashCode() ^ PeriodTo.GetHashCode() ^ Important.GetHashCode() ^
            FromAddress.GetHashCode() ^ MailboxId.GetHashCode() ^ CustomLabels.GetHashCode() ^
            Sort.GetHashCode() ^ SortOrder.GetHashCode() ^ SearchText.GetHashCode() ^
            Page.GetValueOrDefault() ^ PageSize.GetHashCode() ^ SetLabel.GetHashCode() ^
            WithCalendar.GetHashCode() ^ UserFolderId.GetHashCode() ^ FromDate.GetHashCode() ^
            FromMessage.GetHashCode() ^ PrevFlag.GetHashCode());
 }
        public void SetLabel(SetLabel setLabel)
        {
            if (setLabel == null)
            {
                throw new CustomException(400, "设置信息不能为空");
            }
            var model = this.businessmanRepository.FindAll(p => p.Code == setLabel.Code && p is Buyer).Select(p => p as Buyer).FirstOrDefault();

            if (model == null)
            {
                throw new CustomException(400, string.Format("{0}商户号不存在", setLabel.Code));
            }
            model.Label = setLabel.BuyerLabel;
            unitOfWorkRepository.PersistUpdateOf(model);
            unitOfWork.Commit();
        }
Beispiel #9
0
        static bool TaskTumbler()
        // Переключатель заданий
        {
            var sl = new SetLabel();
            int sel;

            do // Цикл выбора заданий
            {
                Console.Clear();
                sl.Label("Выберите действие");
                sl.AddPoint(0, "Возврат в главное меню");
                sl.AddPoint(1, "Проверка без регулярных выражений");
                sl.AddPoint(2, "Проверка с регулярным выражением");
                sel = sl.UserSelTask();
            } while (sel < 0 || sel > 2);

            while (true) // Цикл повтора заданий
            {
                switch (sel)
                {
                case 0:
                    return(false);

                case 1:
                    Checking(1);
                    break;

                case 2:
                    Checking(2);
                    break;
                }

                var i = Exit.ExitTask(); // Повтор задания/Переход к выбору задания/Переход к начальному меню

                switch (i)
                {
                case 2:
                    return(true);

                case 3:
                    return(false);
                }
            }
        }
Beispiel #10
0
        public bool StartTask()
        // Метод старта задания
        {
            var ms = own ? new MyString(ownText) : new MyString();
            var sl = new SetLabel();

            int sel;

            do
            {
                Console.Clear();

                Console.Write($"\n\n{ms.Text()}");
                sl.Label("Выберите действие, которое хотите произвести над данным текстом");
                sl.AddPoint(0, "Вернуться в начально меню");
                sl.AddPoint(1, "Вывести только те слова текста, которые содержат не более чем n букв");
                sl.AddPoint(2, "Удалить из текста все слова, которые заканчиваются на заданную букву");
                sl.AddPoint(3, "Найти самое длинное слово в тексте");
                sl.AddPoint(4, "Найти все самые длинные слова в тексте");
                sl.AddPoint(5, own ? "Вернуть стандартный текст" : "Ввести свой текст");

                sel = sl.UserSelTask();
            } while (sel < 0 || sel > 5);

            var label = "";

            switch (sel)
            {
            case 0:     // Выход в начальное меню
                taskExit = true;
                return(false);

            case 1:     // Пункт a)
                label =
                    "\n\nВведите количество букв, которое \nмаксимально может содержать слово(иные слова отсеются): ";
                break;

            case 2:     // Пунк b)
                label =
                    "\n\nВведите букву (1 букву, не больше не меньше)\nслова заканчивающиеся на данную букву будут удалены: ";
                break;

            case 3:     // Пункт c)
                label = "\n\nНажмите Enter и на экране возникнет самое длинное слово в данном тексте: ";
                break;

            case 4:     // Пункт d)
                label = "\n\nНажмите Enter и на экране появятся все самые длинные слова: ";
                break;

            case 5:     // Возможность самому ввести текст
                if (!own)
                {
                    sl.Label("Введите свой (наверяка более изящный, рифмованный, и видимо намного лучше моего) текст");
                    ownText = Console.ReadLine();
                    own     = true;
                    return(false);
                }
                else
                {
                    own = false;
                    return(false);
                }
            }
            Console.WriteLine($"\n\n{ms.TextOperations(label, sel)}");


            var i = Exit.ExitTask(); // Повтор задания/Переход к выбору задания/Переход к начальному меню

            switch (i)
            {
            case 1:
                return(true);

            case 2:
                return(false);

            case 3:
                taskExit = false;
                return(false);
            }

            return(true);
        }
Beispiel #11
0
        public static void Start(
            string Path,
            Form form,
            SetMax Max,
            SetValue Value,
            SetLabel Label,
            Action End,
            Action Error,
            bool HideMessages,
            bool DeleteMessages,
            bool HideNicknames,
            bool HideServerIDs,
            bool HideServerNames,
            bool HideChannelIDs,
            bool HideChannelNames,
            bool HideApplication,
            bool DeleteApplication,
            bool HideOS,
            bool HideIPs,
            bool HideLocations,
            bool DeleteActivities
            )
        {
            Task t = new Task(() =>
            {
                form.Invoke(Max, 114);
                form.Invoke(Value, 0);
                int start = 0;
                int max   = 0;

                #region UnZip
                max = 5;
                form.Invoke(Label, "UnZip");
                if (!Ziper.UnZip(Path))
                {
                    form.Invoke(Error, "UnZipFailed");
                    return;
                }
                form.Invoke(Value, start += max);
                #endregion

                #region IDs
                max = 2;
                form.Invoke(Label, "IDs");
                try
                {
                    ServerIDs      = new Dictionary <string, string>();
                    ChannelIDs     = new Dictionary <string, string>();
                    string channel = $@"{Ziper.TempPath}\messages\index.json";
                    string servers = $@"{Ziper.TempPath}\servers\index.json";

                    JServerIDs  = File.Exists(servers) ? JObject.Parse(File.ReadAllText(servers)) : null;
                    JChannelIDs = File.Exists(channel) ? JObject.Parse(File.ReadAllText(channel)) : null;
                }
                catch { form.Invoke(Error, "IDsFailed"); return; }
                form.Invoke(Value, start += max);
                #endregion

                #region Messages Channel
                max = 35;
                form.Invoke(Label, "Messages");
                string messages = $@"{Ziper.TempPath}\messages";
                try
                {
                    if (Directory.Exists(messages))
                    {
                        string[] directories = Directory.GetDirectories(messages);
                        if (DeleteMessages)
                        {
                            foreach (string directory in Directory.GetDirectories(messages))
                            {
                                Directory.Delete(directory, true);
                            }
                        }
                        else if (HideMessages)
                        {