Beispiel #1
0
        void OnClicked(object sender, EventArgs e)
        {
            int i = 0;

            _dialog            = new Native.Dialog(Forms.NativeParent);
            _list              = new List(_dialog);
            _dialog.AlignmentX = -1;
            _dialog.AlignmentY = -1;

            _dialog.Title              = Element.Title;
            _dialog.Dismissed         += OnDialogDismissed;
            _dialog.BackButtonPressed += (object senders, EventArgs es) =>
            {
                _dialog.Dismiss();
            };

            foreach (var s in Element.Items)
            {
                ListItem item = _list.Append(s);
                _itemToItemNumber[item] = i;
                i++;
            }
            _list.ItemSelected += OnItemSelected;
            _dialog.Content     = _list;

            _dialog.Show();
            _list.Show();
        }
Beispiel #2
0
 private static void ShowStartingLists()
 {
     integers.Show("integers");
     doubles.Show("doubles");
     strings.Show("strings");
     persons.Show("persons");
 }
Beispiel #3
0
 private void editbranchbtn_Click(object sender, EventArgs e)
 {
     if (editlocationtxt.Text == String.Empty)
     {
         MessageBox.Show("Fill all Fields", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (editcomboadmin.SelectedIndex > 0)
         {
             B.Br_Admin_ID = itemid[editcomboadmin.SelectedIndex];
         }
         B.Location = editlocationtxt.Text;
         ServiceBranch.BranchServiceClient s    = new ServiceBranch.BranchServiceClient();
         ServiceBranch.Branchdata          data = new ServiceBranch.Branchdata();
         data = s.updateBranch(B);
         if (data != null)
         {
             MessageBox.Show("Edit Successfully", "Edit", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Load_data();
             AddPanel.Hide();
             EditPanel.Hide();
             List.Show();
         }
         else
         {
             MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Beispiel #4
0
        private void branchaddbtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtlocation.Text) && combobr_adminList.SelectedIndex > 0)
            {
                int br_admin_id = itemid[combobr_adminList.SelectedIndex];
                ServiceBranch.BranchServiceClient c = new ServiceBranch.BranchServiceClient();
                ServiceBranch.Branch d = new ServiceBranch.Branch();
                d.Location    = txtlocation.Text;
                d.Br_Admin_ID = br_admin_id;
                d             = c.addBranch(d);
                if (d != null && d.Id > 0)
                {
                    MessageBox.Show("Add Sucessfully", "Branch Added !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Load_data();
                    AddPanel.Hide();
                    EditPanel.Hide();
                    List.Show();
                }
                else
                {
                    MessageBox.Show("Fail", "Fail !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            else
            {
                MessageBox.Show("Fill all Fields", " Info !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            OPT option = OPT.ADD_NODE_FIRST;

            int    inputInt    = 0;
            int    valuesCount = 0;
            string keyNode     = "5";

            List values = new List();

            do
            {
                ShowMenu();
                string inputString = Console.ReadLine();
                Int32.TryParse(inputString, out inputInt);
                option = (OPT)inputInt;

                switch (option)
                {
                case OPT.ADD_NODE_FIRST:
                    ++valuesCount;
                    values.AddFirst(new Node(valuesCount.ToString()));
                    break;

                case OPT.ADD_NODE_LAST:
                    ++valuesCount;
                    values.AddLast(new Node(valuesCount.ToString()));
                    break;

                case OPT.DEL_FIRST_NODE:
                    values.DeleteFirst();
                    break;

                case OPT.DEL_LAST_NODE:
                    values.DeleteLast();
                    break;

                case OPT.SHOW_LIST:
                    values.Show();
                    break;

                case OPT.ADD_AFTER_OF:
                    ++valuesCount;
                    values.AddAfterOf(keyNode, new Node(valuesCount.ToString()));
                    break;

                case OPT.FIND_BY_NAME:
                    if (values.FindByName(keyNode) != null)
                    {
                        Console.WriteLine("Found!");
                    }
                    else
                    {
                        Console.WriteLine("Opps! Not found");
                    }
                    break;
                }
            } while (option != OPT.QUIT_PROGRAM);
        }
        public void ToList_Example_2()
        {
            List <Employee> resultList = _employees
                                         .Where(item => item.Experience > 1)
                                         .ToList();

            resultList.Show(item => $"{item.FirstName} - {item.DepartmentName} ");
        }
Beispiel #7
0
 private void AllBranch_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     AllBranch.LinkBehavior = System.Windows.Forms.LinkBehavior.AlwaysUnderline;
     AddBranch.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
     List.Show();
     EditPanel.Show();
     AddPanel.Show();
 }
Beispiel #8
0
        public int MainHandler(NameValueCollection parameters)
        {
            List <ListItem> items = new List <ListItem> {
                new ListItem(
                    label: "AudioPlayer",
                    url: BuildNavUrl("/audio"),
                    isFolder: true,
                    art: new Dictionary <Art, string> {
                    { Art.Poster, "https://upload.wikimedia.org/wikipedia/commons/2/25/Kodi-logo-Thumbnail-light-transparent.png" },
                    { Art.Fanart, "https://images.pexels.com/photos/167092/pexels-photo-167092.jpeg?dl&fit=crop&crop=entropy&w=6000&h=4000" }
                }
                    ),
                new ListItem(
                    label: "Events",
                    url: BuildNavUrl("/events"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Nav",
                    url: BuildNavUrl("/nav"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Playlist",
                    url: BuildNavUrl("/playlist"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Video",
                    url: BuildNavUrl("/video"),
                    art: new Dictionary <Art, string>()
                {
                    { Art.Fanart, "https://mango.blender.org/wp-content/gallery/4k-renders/26_thom_robot.jpg" },
                    { Art.Poster, "https://mango.blender.org/wp-content/themes/tearsofsteel/images/logo.png" },
                }
                    ),
                new ListItem(
                    label: "Video2",
                    url: BuildNavUrl("/video2"),
                    art: new Dictionary <Art, string>()
                {
                    { Art.Poster, "https://peach.blender.org/wp-content/uploads/poster_bunny_small.jpg?x81236" },
                    { Art.Fanart, "https://peach.blender.org/wp-content/uploads/bbb-splash.png?x81236" }
                }
                    )
            };

            List.Add(items);
            List.Show();

            UiBuiltins.Notification(
                header: "My Notification",
                message: "Hello World from C#",
                duration: TimeSpan.FromSeconds(1)
                );

            return(0);
        }
        static List <Pet> pets = new List <Pet>(); //create list

        static void Main(string[] args)
        {
            pets.Add(new Dog("harry")); //Adds things to the pets list
            pets.Add(new Lion("simba"));
            pets.Add(new Duck("sven"));

            Console.WriteLine(pets.Show());
            Console.ReadKey();
        }
Beispiel #10
0
        public void Query()
        {
            Response.WriteXmlHead();
                List<SystemSetting> list = new List<SystemSetting>();
                var systemSetting = Database.SystemSettings.GetSystemSetting();
                list.Add(systemSetting);

                list.Show(Response, Database);
        }
Beispiel #11
0
        public void GetApplyById()
        {
            var apply = Request.GetEntity(Database.MemberApplys, "applyID");

            Response.WriteXmlHead();
            List<MemberApply> listApply = new List<MemberApply>();
            listApply.Add(apply);
            listApply.Show(Response, User, Database);
        }
Beispiel #12
0
        public int PlaylistHandler(NameValueCollection parameters)
        {
            Uri uri = new Uri("http://www.amclassical.com/piano/");

            var data = new HttpClient()
                       .GetAsync(uri)
                       .Result.Content
                       .ReadAsStringAsync()
                       .Result;

            PlayList pl = new PlayList(PlayListType.Music);

            List <ListItem> items = new List <ListItem> {
            };

            var matches = new Regex("<a href=\"?(.*?)\"?>.*</a>").Matches(data);
            var number  = Math.Min(5, matches.Count);

            for (var i = 0; i < number; i++)
            {
                string path = matches[i].Groups[1].Value.ToLower();
                if (!path.EndsWith("mp3"))
                {
                    continue;
                }

                string url = uri.GetLeftPart(UriPartial.Authority) + path;

                pl.Add(url);
                items.Add(new ListItem(label: Path.GetFileName(path), url: url));
            }
            List.Add(items);
            List.Show();

            var player = new XbmcPlayer();

            player.Play(pl);

            for (int i = 0; i < pl.Count; i++)
            {
                while (!player.IsPlayingAudio)
                {
                    Kodi.Sleep(TimeSpan.FromMilliseconds(200));
                }
                var info = player.MusicInfoTag;
                Console.WriteLine($"[NOW PLAYING]: {player.PlayingFile}");
                Console.WriteLine("=====================");
                Console.WriteLine($"{info.URL}, {info.Title}");

                Kodi.Sleep(TimeSpan.FromSeconds(5));
                player.PlayNext();
            }

            return(0);
        }
Beispiel #13
0
        public void Process(ArraySegment <byte> data)
        {
            var       count    = data.Count;
            var       buf      = data.Array;
            const int leastLen = 1 + 1 + 3 + 3 + 3;

            if (buf == null || count < leastLen)
            {
                AppLogger.Error("corruted sample data");
                return;
            }

            var startIdx = data.Offset;

            startIdx++;
            var order = buf[startIdx];

            startIdx++;
            var chan1 = new ArraySegment <byte>(buf, startIdx, 3);

            startIdx += 3;
            var chan2 = new ArraySegment <byte>(buf, startIdx, 3);

            startIdx += 3;
            var chan3 = new ArraySegment <byte>(buf, startIdx, 3);

            startIdx += 3;

            AppLogger.Debug($"sample data received,order:{order},ch1:{chan1.Show()},ch2:{chan2.Show()},ch3:{chan3.Show()}");

            var endInd          = data.Offset + count;
            var extraBlockCount = (count - leastLen + 2) / 3;

            if (extraBlockCount > 0)
            {
                var extraBlocks = new List <ArraySegment <byte> >(extraBlockCount);
                for (var i = 0; i < extraBlockCount; i++)
                {
                    if (startIdx + 3 <= endInd)
                    {
                        extraBlocks[i] = new ArraySegment <byte>(buf, startIdx, 3);
                    }
                    else
                    {
                        extraBlocks[i] = new ArraySegment <byte>(buf, startIdx, data.Offset + count - startIdx);
                    }

                    startIdx += 3;
                }
                AppLogger.Debug($"extra channel data:{extraBlocks.Show()}");
            }
        }
Beispiel #14
0
        private void AllUser_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            profilefriend r;
            int           i = AllUser.SelectedIndex;

            if (AllUser.Items.Count == profilesq.Count)

            {
                if (profilesq[i].ID != profile.ID)
                {
                    //Service.Profile d = fr.FirstOrDefault(o => o.ID ==i);
                    if (i != -1)
                    {
                        // client.AddToBlacklist(MainWindow.shopWindows.profile.ID, fr[i].ID);
                        // client.RemoveFromBlacklist(MainWindow.shopWindows.profile.ID, fr[i].ID);
                        r      = new profilefriend(ShopWindows.client.CheckProfile(profilesq[i].ID));
                        r.Left = this.Left;
                        r.Top  = this.Top;
                        r.Show();
                        MainWindow.shopWindows.Visibility = Visibility.Hidden;
                    }
                }
                else
                {
                    myprofiletab.Focus();
                }
            }
            else
            {
                if (p[i].ID != profile.ID)
                {
                    if (i != -1)
                    {
                        // client.AddToBlacklist(MainWindow.shopWindows.profile.ID, fr[i].ID);
                        // client.RemoveFromBlacklist(MainWindow.shopWindows.profile.ID, fr[i].ID);
                        r      = new profilefriend(ShopWindows.client.CheckProfile(p[i].ID));
                        r.Left = this.Left;
                        r.Top  = this.Top;
                        r.Show();
                        MainWindow.shopWindows.Visibility = Visibility.Hidden;
                    }
                }
                else
                {
                    myprofiletab.Focus();
                }
            }
        }
Beispiel #15
0
        public void MainHandler(NameValueCollection parameters)
        {
            TestPlugin      addon = KodiBridge.RunningAddon as TestPlugin;
            List <ListItem> items = new List <ListItem> {
                new ListItem(
                    label: "AudioPlayer",
                    url: addon.BuildNavUrl("/audio"),
                    isFolder: true,
                    art: new Dictionary <Art, string> {
                    { Art.Poster, "https://upload.wikimedia.org/wikipedia/commons/2/25/Kodi-logo-Thumbnail-light-transparent.png" },
                    { Art.Fanart, "https://images.pexels.com/photos/167092/pexels-photo-167092.jpeg?dl&fit=crop&crop=entropy&w=6000&h=4000" }
                }
                    ),
                new ListItem(
                    label: "Events",
                    url: addon.BuildNavUrl("/events"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Nav",
                    url: addon.BuildNavUrl("/nav"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Playlist",
                    url: addon.BuildNavUrl("/playlist"),
                    isFolder: true
                    ),
                new ListItem("Item 2"),
                new ListItem("Item 3")
            };

            List.Add(items);
            List.Show();

            UiBuiltins.Notification(
                header: "My Notification",
                message: "Hello World from C#",
                duration: TimeSpan.FromSeconds(10)
                );

            /*
             * Persistent variables preserve their value between multiple plugin invokations,
             * unlike python in XBMC where everything is destroyed when the plugin is invoked again (e.g navigating between pages).
             * This is possible due to Assembly Domain that is created by the CLR once the plugin is loaded for the first time.
             **/
            TestPluginState.LastMainPageVisitTime = DateTime.Now;
        }
        public static void Run()
        {
            var initial = new List <int> {
                1, 2, 10, 6, 20, 11, 2, 3, 4
            }.ToTree();

            Console.WriteLine(initial.Show());
            var sorted = initial.Sort();

            Console.WriteLine(sorted.ToTree().Show());
            var y = new List <int> {
                10, 3, 1
            }.ZipOrdered(new List <int> {
                8, 4, 2
            });
        }
Beispiel #17
0
        void OnTextBlockFocused(object sender, EventArgs e)
        {
            // For EFL Entry, the event will occur even if it is currently disabled.
            // If the problem is resolved, no conditional statement is required.
            if (Element.IsEnabled)
            {
                int i = 0;
                if (Device.Idiom == TargetIdiom.Watch)
                {
                    _dialog = new WatchDialog(System.Maui.Maui.NativeParent, false);
                }
                else
                {
                    _dialog = new Dialog(System.Maui.Maui.NativeParent);
                }
                _dialog.AlignmentX         = -1;
                _dialog.AlignmentY         = -1;
                _dialog.Title              = Element.Title;
                _dialog.TitleColor         = Element.TitleColor.ToNative();
                _dialog.Dismissed         += OnDialogDismissed;
                _dialog.BackButtonPressed += (object senders, EventArgs es) =>
                {
                    _dialog.Dismiss();
                };

                _list = new List(_dialog);
                foreach (var s in Element.Items)
                {
                    ListItem item = _list.Append(s);
                    _itemToItemNumber[item] = i;
                    i++;
                }
                _list.ItemSelected += OnItemSelected;
                _dialog.Content     = _list;

                // You need to call Show() after ui thread occupation because of EFL problem.
                // Otherwise, the content of the popup will not receive focus.
                Device.BeginInvokeOnMainThread(() =>
                {
                    _dialog.Show();
                    _list.Show();
                });
            }
        }
Beispiel #18
0
        private void editbranchbtn_Click(object sender, EventArgs e)
        {
            B.Br_Admin_ID = UserInfo.id;
            B.Location    = editlocationtxt.Text;
            ServiceBranch.BranchServiceClient s    = new ServiceBranch.BranchServiceClient();
            ServiceBranch.Branchdata          data = new ServiceBranch.Branchdata();
            data = s.updateBranch(B);
            if (data != null)
            {
                MessageBox.Show("Edit Successfully", "Edit", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Load_data();
                List.Show();

                EditPanel.Hide();
            }
            else
            {
                MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #19
0
        public static void MainHandler(NameValueCollection parameters)
        {
            TestPlugin      addon = KodiBridge.RunningAddon as TestPlugin;
            List <ListItem> items = new List <ListItem> {
                new ListItem(
                    label: "AudioPlayer",
                    url: addon.BuildNavUrl("/audio"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Events",
                    url: addon.BuildNavUrl("/events"),
                    isFolder: true
                    ),
                new ListItem(
                    label: "Nav",
                    url: addon.BuildNavUrl("/nav"),
                    isFolder: true
                    ),
                new ListItem("Item 2"),
                new ListItem("Item 3")
            };

            List.Add(items);
            List.Show();

            //Console.WriteLine("Settings Test: " + addon.Settings["test"]);

            UiBuiltins.Notification(
                header: "My Notification",
                message: "Hello World from C#",
                duration: TimeSpan.FromSeconds(10)
                );

            /*
             * Persistent variables preserve their value between multiple plugin invokations,
             * unlike python in XBMC where everything is destroyed when the plugin is invoked again (e.g navigating between pages).
             * This is possible due to Assembly Domain that is created by the CLR once the plugin is loaded for the first time.
             **/
            TestPluginState.LastMainPageVisitTime = DateTime.Now;
        }
Beispiel #20
0
        public static void ShowGeneric()
        {
            //MyClass<int> myClass = new MyClass<int>();
            //MyClass<char> myClass2 = new MyClass<char>();
            ////MySimpleClass simpleClass = new MySimpleClass();
            ////simpleClass.Add(10);


            //var mm = new MyClass<int>();

            //MyDerivedClass myDerived = new MyDerivedClass();
            //myDerived.Add(11);

            //MyDerivedClassT<char> derivedClassT = new MyDerivedClassT<char>();
            //derivedClassT.Add('2');


            //MySimpleClass classWithTMeth = new MySimpleClass();
            //classWithTMeth.PrintSymb<double>(123);
            //classWithTMeth.PrintTwoSymb<char, string>('a', "hello");

            //MyClass<int> myClass1 = new MyClass<int>();
            //myClass1.Add(3);

            MyClass <int[]> myClass = new MyClass <int[]>();

            string str = "Hello";

            str.Show();

            int[] arr1 = new int[] { 1, 5, 7, 10 };
            arr1.Show <int>();

            List <string> list = new List <string> {
                "fff", "www", "qqq", "lll"
            };

            list.Show <string>();
        }
Beispiel #21
0
        public int NavHandler(NameValueCollection parameters)
        {
            string itemLabel = "Go to Main";

            if (LastNavVisited != null)
            {
                itemLabel += string.Format(" (Last Visited: {0})", LastNavVisited.Value.ToString());
            }
            LastNavVisited = DateTime.Now;

            List <ListItem> items = new List <ListItem> {
                new ListItem(
                    label: itemLabel,
                    url: BuildNavUrl("/"),
                    isFolder: true
                    ),
            };

            Console.WriteLine(string.Format("ListItem label is '{0}'", items[0].Label));

            List.Add(items);
            List.Show();
            return(0);
        }
Beispiel #22
0
        public void NavHandler(NameValueCollection parameters)
        {
            TestPlugin addon = KodiBridge.RunningAddon as TestPlugin;

            string itemLabel = "Go to Main";

            if (TestPluginState.LastMainPageVisitTime != null)
            {
                itemLabel += string.Format(" (Last Visited: {0})", TestPluginState.LastMainPageVisitTime.Value.ToString());
            }

            List <ListItem> items = new List <ListItem> {
                new ListItem(
                    label: itemLabel,
                    url: addon.BuildNavUrl("/"),
                    isFolder: true
                    ),
            };

            Console.WriteLine(string.Format("ListItem label is '{0}'", items[0].Label));

            List.Add(items);
            List.Show();
        }
Beispiel #23
0
        public virtual void ShowReturnAssignments(Sungero.Domain.Client.ExecuteChildCollectionActionArgs e)
        {
            var assignments = new List <Workflow.IAssignment>();

            try
            {
                assignments = Functions.OfficialDocument.Remote.GetReturnAssignments(_obj.ReturnTask);
            }
            catch (Sungero.Domain.Shared.Exceptions.SecuritySystemException)
            {
            }

            if (assignments.Any())
            {
                if (assignments.Count == 1)
                {
                    assignments.First().Show();
                }
                else
                {
                    var assignment = assignments.FirstOrDefault(a => Equals(a.Performer, Company.Employees.Current));
                    if (assignment != null)
                    {
                        assignment.Show();
                    }
                    else
                    {
                        assignments.Show();
                    }
                }
            }
            else
            {
                Dialogs.NotifyMessage(Docflow.Resources.JobToReturnNotFound);
            }
        }
Beispiel #24
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Лист 1:");
            Console.ResetColor();
            List list = new List();

            list.Add("Юлия");
            list.Add("Чистякова");
            list.Add("программист");
            list.Show();
            list.Remove("Чистякова");
            list.Remove("5 группа");
            list.Show();



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nЛист 2:");
            Console.ResetColor();
            List list2 = new List();

            list2.Add("Студентка");
            list2.Show();



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nЛист 3 (объединение лист1 и лист2):");
            Console.ResetColor();
            List list3 = list + list2;

            list3.Show();



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nСтрока max длины в Лист 3:");
            Console.ResetColor();
            list3.MaxString();



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nЛист 4 (инверсия листа3):");
            Console.ResetColor();
            list3 = !list3;
            list3.Show();



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nЛист 3 усечен до 4 символов:");
            Console.ResetColor();
            list3.СropList(4);
            list3.Show();



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nЛист 4 и Лист 5 равны?");
            Console.ResetColor();
            List list4 = new List();
            List list5 = new List();

            list4.Add("12345");
            list5.Add("12345");
            list4.Show();
            list5.Show();
            if (list5 == list4)
            {
                Console.WriteLine("Да, равны.");
            }
            if (list5 != list4)
            {
                Console.WriteLine("Нет, не равны.");
            }



            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\n\nOwners:");
            Console.ResetColor();
            list4._owner = new List.Owner("Иван", "Google");
            list5._owner = new List.Owner("Михаил", "Microsoft");
            list4._owner.ShowInfo();
            list5._owner.ShowInfo();


            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nDates:");
            Console.ResetColor();
            list5._date = new List.Date();
            list5._date.ShowDate();

            Console.ReadLine();
        }
Beispiel #25
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();
            conformant.SetContent(box);

            List list = new List(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            for (int i = 0; i < 5; i++)
            {
                list.Append(string.Format("{0} item", _count++));
            }

            list.ItemSelected      += List_Selected;
            list.ItemUnselected    += List_Unselected;
            list.ItemActivated     += List_ItemActivated;
            list.ItemDoubleClicked += List_ItemDoubleClicked;
            list.ItemLongPressed   += List_ItemLongPressed;
            list.RenderPost        += List_RenderPost;
            list.Update();
            list.Show();

            box.PackEnd(list);
            Button append = new Button(window)
            {
                Text       = "Append",
                AlignmentX = -1,
                WeightX    = 1,
            };
            Button prepend = new Button(window)
            {
                Text       = "Prepend",
                AlignmentX = -1,
                WeightX    = 1,
            };

            append.Clicked += (s, e) =>
            {
                list.Append(string.Format("{0} item", _count++));
                list.Update();
            };
            prepend.Clicked += (s, e) =>
            {
                list.Prepend(string.Format("{0} item", _count++));
                list.Update();
            };
            append.Show();
            prepend.Show();
            box.PackEnd(append);
            box.PackEnd(prepend);
        }
Beispiel #26
0
        /// <summary>
        /// show menu options and execute choosen one
        /// </summary>
        /// <returns></returns>
        static public string DisplayMenu()
        {
            Console.WriteLine("File cabinet");
            Console.WriteLine();
            Console.WriteLine("create");
            Console.WriteLine("list");
            Console.WriteLine("stat");
            Console.WriteLine("find");
            Console.WriteLine("edit");
            Console.WriteLine("remove");
            Console.WriteLine("purge");
            Console.WriteLine("export xml");
            Console.WriteLine("export csv");
            Console.WriteLine("import xml");
            Console.WriteLine("import csv");
            Console.WriteLine("exit");
            var result = Console.ReadLine();

            string[] splitedresult = result.Split(' ');
            switch (splitedresult[0])
            {
            case "create":
                users.Create();
                break;

            case "purge":
                users.purge();
                break;

            case "remove":
                int a = 0;
                if (!int.TryParse(splitedresult[1], out a))
                {
                    break;
                }
                users.remove(Convert.ToInt32(splitedresult[1]));
                break;

            case "edit":

                if (!int.TryParse(splitedresult[1], out a))
                {
                    break;
                }
                users.edit(Convert.ToInt32(splitedresult[1]));
                break;

            case "list":
                string formatforshow = "";
                if (splitedresult.Count() > 1)
                {
                    for (int i = 0; i < splitedresult.Count(); i++)
                    {
                        if (splitedresult[i] == "firstname")
                        {
                            formatforshow += "F";
                        }
                        if (splitedresult[i] == "lastname")
                        {
                            formatforshow += "L";
                        }
                        if (splitedresult[i] == "dateofbirth")
                        {
                            formatforshow += "D";
                        }
                        if (splitedresult[i] == "id")
                        {
                            formatforshow += "I";
                        }
                    }
                    users.Show(formatforshow);
                }
                else
                {
                    users.Show();
                }

                break;

            case "stat":
                users.Stat();
                break;

            case "export":
                if (splitedresult[1] == "xml")
                {
                    users.exportxml();
                }
                if (splitedresult[1] == "csv")
                {
                    users.exportcsv();
                }
                break;

            case "import":
                if (splitedresult[1] == "xml")
                {
                    fileservice.importxml(ref users);
                }
                if (splitedresult[1] == "csv")
                {
                    fileservice.importcsv(ref users);
                }
                break;

                #region
            case "find":
                string param1 = "";
                string format = "";

                if (splitedresult.Count() == 3)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        if (splitedresult[i] == "firstname")
                        {
                            param1 = splitedresult[i + 1];
                            format = "F";
                        }
                        if (splitedresult[i] == "lastname")
                        {
                            param1 = splitedresult[i + 1];
                            format = "L";
                        }
                        if (splitedresult[i] == "dateofbirth")
                        {
                            param1 = splitedresult[i + 1];
                            format = "D";
                        }
                    }
                    users.Find(format, param1);
                }
                if (splitedresult.Count() == 5)
                {
                    string firstname   = "";
                    string lastname    = "";
                    string dateofbirth = "";

                    for (int i = 0; i < 5; i++)
                    {
                        if (splitedresult[i] == "firstname")
                        {
                            firstname = splitedresult[i + 1];
                            format    = format + "F";
                        }
                        if (splitedresult[i] == "lastname")
                        {
                            lastname = splitedresult[i + 1];
                            format   = format + "L";
                        }
                        if (splitedresult[i] == "dateofbirth")
                        {
                            dateofbirth = splitedresult[i + 1];
                            format      = format + "D";
                        }
                    }
                    if (firstname == "")
                    {
                        users.Find(format, lastname, dateofbirth);
                    }
                    if (lastname == "")
                    {
                        users.Find(format, firstname, dateofbirth);
                    }
                    if (dateofbirth == "")
                    {
                        users.Find(format, firstname, lastname);
                    }
                }
                if (splitedresult.Count() == 7)
                {
                    string firstname   = "";
                    string lastname    = "";
                    string dateofbirth = "";

                    for (int i = 0; i < 7; i++)
                    {
                        if (splitedresult[i] == "firstname")
                        {
                            firstname = splitedresult[i + 1];
                            format    = format + "F";
                        }
                        if (splitedresult[i] == "lastname")
                        {
                            lastname = splitedresult[i + 1];
                            format   = format + "L";
                        }
                        if (splitedresult[i] == "dateofbirth")
                        {
                            dateofbirth = splitedresult[i + 1];
                            format      = format + "D";
                        }
                    }
                    users.Find(firstname, lastname, dateofbirth, format);
                }


                break;
                #endregion
            }
            return(result);
        }
Beispiel #27
0
        public void GetStoreDeviceById()
        {
            var device = Request.getStoreDeviceByID(Database);

            Response.WriteXmlHead();
            var listDevice = new List<StoreDevice>();
            listDevice.Add(device);
            listDevice.Show(Response, User, Database);
        }
Beispiel #28
0
 public void GetDeviceForPrint()
 {
     var purchasePlanItemID = Request.GetInt("purchasePlanItemID").Value;
     var purchasePlanItem = Database.PurchasePlanItems.GetByID(purchasePlanItemID);
     var device = Database.ApplyDevices.GetByID(purchasePlanItem.ConstructTaskItem.ConstructPlanItem.MemberApplyItem.ApplyDeviceID);
     Response.WriteXmlHead();
     var listDevice = new List<ApplyDevice>();
     listDevice.Add(device);
     listDevice.Show(Response, User, Database);
 }