protected List<string> describeException(Exception e)
 {
     var list = new List<string> { "caused by" };
     if (e != null)
     {
         list.Add(e.Message);
         list.Add(e.StackTrace);
         if (e.InnerException != null)
         {
             list.Concat(describeException(e.InnerException));
         }
     }
     return list;
 }
Пример #2
0
 public void OpenGameWindow(ConversationDC conv)
 {
     List<string> allPlayers = new List<string>();
     allPlayers.Add(conv.Host.Login);
     var logins = (from p in conv.Participants select p.Login).ToList();
     allPlayers = allPlayers.Concat<string>(logins).ToList();
     GameLaunching(allPlayers, conv.ConversationId);
 }
Пример #3
0
 public void LoadFriends()
 {
     var onlineFriends = from f in friends where f.PlayerStatus == "Online" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
     var offlineFriends = from f in friends where f.PlayerStatus == "Offline" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
     var absentFriends = from f in friends where f.PlayerStatus == "Absent" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
     var inPartyFriends = from f in friends where f.PlayerStatus == "InParty" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
     var orderedFriends = new List<PlayerDC>();
     playerDCViewSource.Source = orderedFriends.Concat(onlineFriends).Concat(absentFriends).Concat(inPartyFriends).Concat(offlineFriends);
     playerDCViewSource.View.Refresh();
 }
Пример #4
0
 public void NotifyFriendshipEstablishment(PlayerDC playerDC)
 {
     var q = (from r in friendshipRequests
              where r.PlayerId == playerDC.PlayerId
              select r).ToList();
     if (q.Count > 0)
     {
         RemoveFriendshipRequestFromList(q.ElementAt(0));
     }
     q = (from f in friends
          where f.PlayerId == playerDC.PlayerId
          select f).ToList();
     if (q.Count == 0)
     {
         addFriendsPage.playerDCViewSource.Source = new List<PlayerDC>();
         addFriendsPage.playerDCViewSource.View.Refresh();
         var newFriendsList = new List<PlayerDC>() { playerDC };
         friends = newFriendsList.Concat(friends);
         LoadFriends();
         playerDCViewSource.View.Refresh();
     }
 }
Пример #5
0
        public DateTime[] QuickSortFunction()
        {
            int[] MyArrayofTicks= QuickSortFunction(ArrayOfElements.ToArray(), 0, (ArrayOfElements.Count - 1), (ArrayOfElements.Count / 2));
            List<DateTime> ListOfSortedDateTime = new List<DateTime>();

            foreach (int MyInt in MyArrayofTicks)
            {
                var JustConcatenate = ListOfSortedDateTime.Concat(DictionaryOfIntAndDateTime[MyInt]);
                ListOfSortedDateTime = JustConcatenate.ToList();
            }

            return ListOfSortedDateTime.ToArray();
        }
        private void taskText_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (_updating == null)
                {
                    _taskList.Add(new Task(taskText.Text.Trim()));
                }
                else
                {
                    _taskList.Update(_updating, new Task(taskText.Text.Trim()));
                    _updating = null;
                }

                taskText.Text = "";
                FilterAndSort(_currentSort);

                Intellisense.IsOpen = false;
                return;
            }

            if (Intellisense.IsOpen && !IntellisenseList.IsFocused)
            {
                switch (e.Key)
                {
                    case Key.Down:
                        IntellisenseList.Focus();
                        Keyboard.Focus(IntellisenseList);
                        IntellisenseList.SelectedIndex = 0;
                        break;
                    case Key.Escape:
                    case Key.Space:
                        Intellisense.IsOpen = false;
                        break;
                    default:
                        var word = FindIntelliWord();
                        IntellisenseList.Items.Filter = (o) => o.ToString().Contains(word);

                        break;
                }
            }
            else
            {
                switch (e.Key)
                {
                    case Key.Enter:
                        if (_updating == null)
                        {
                            _taskList.Add(new Task(taskText.Text.Trim()));
                        }
                        else
                        {
                            _taskList.Update(_updating, new Task(taskText.Text.Trim()));
                            _updating = null;
                        }

                        taskText.Text = "";
                        FilterAndSort(_currentSort);
                        break;
                    case Key.Escape:
                        _updating = null;
                        taskText.Text = "";
                        this.lbTasks.Focus();
                        break;
                    case Key.OemPlus:
                        List<string> projects = new List<string>();
                        foreach (var task in _taskList.Tasks)
                            projects = projects.Concat(task.Projects).ToList();

                        var pos = taskText.CaretIndex;
                        ShowIntellisense(projects.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(pos));
                        break;
                    case Key.D2:
                        List<string> contexts = new List<string>();
                        foreach (var task in _taskList.Tasks)
                            contexts = contexts.Concat(task.Contexts).ToList();

                        pos = taskText.CaretIndex;
                        ShowIntellisense(contexts.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(pos));
                        break;
                }
            }
        }
Пример #7
0
 private void DrawPoint(List<Vector2Ext> points, Color color)
 {
     bitmap.FillPolygon(
         points.Concat(new List<Vector2Ext> {points.First()})
         .SelectMany(x=>x.AsArray()).ToArray(), color);
 }
Пример #8
0
        public void NotifyGameOver(bool isDraw, List<Player> winners)
        {
            Application.Current.Dispatcher.Invoke((ThreadStart)delegate()
            {
                Uri uri = GameSoundLocator.GetSystemSound("GameOver");
                GameSoundPlayer.PlaySoundEffect(uri);
                GameSoundPlayer.PlayBackgroundMusic(null);
                List<Player> drawers;
                List<Player> losers;
                if (isDraw)
                {
                    Trace.Assert(winners.Count == 0);
                    drawers = Game.CurrentGame.Players;
                    losers = new List<Player>();
                }
                else
                {
                    drawers = new List<Player>();
                    losers = new List<Player>(Game.CurrentGame.Players.Except(winners));
                }
                bool delayWindow = true;
                if (winners.Contains(GameModel.MainPlayerModel.Player))
                {
                    PlayAnimation(new WinAnimation());
                }
                else if (losers.Contains(GameModel.MainPlayerModel.Player))
                {
                    PlayAnimation(new LoseAnimation());
                }
                else delayWindow = false;
                LobbyViewModel.Instance.OnChat -= chatEventHandler;

                ObservableCollection<GameResultViewModel> model = new ObservableCollection<GameResultViewModel>();
                foreach (Player player in winners.Concat(losers).Concat(drawers))
                {
                    var m = new GameResultViewModel();
                    m.Player = player;
                    if (winners.Contains(player))
                    {
                        m.Result = GameResult.Win;
                        // @todo : fix this.
                        m.GainedExperience = "+15";
                        m.GainedTechPoints = "+0";
                    }
                    else if (losers.Contains(player))
                    {
                        m.Result = GameResult.Lose;
                        // @todo : fix this.
                        m.GainedExperience = "-3";
                        m.GainedTechPoints = "+0";
                    }
                    else if (drawers.Contains(player))
                    {
                        m.Result = GameResult.Draw;
                        // @todo : fix this.
                        m.GainedExperience = "+3";
                        m.GainedTechPoints = "+0";
                    }
                    model.Add(m);
                }
                gameResultBox.DataContext = model;
                gameResultWindow.Content = gameResultBox;
                gameResultWindow.Closed += (o, e) =>
                {
                    var handler = OnGameCompleted;
                    if (handler != null)
                    {
                        handler(this, new EventArgs());
                    }
                };

                if (delayWindow)
                {
                    DispatcherTimer timer = new DispatcherTimer();
                    timer.Tick += (o, e) =>
                    {
                        gameResultWindow.Show();
                        timer.Stop();
                    };
                    timer.Interval = TimeSpan.FromSeconds(2);
                    timer.Start();
                }
                else
                {
                    gameResultWindow.Show();
                }
            });
        }
 TimeLine getTimeLine()
 {
     DateTime LastDeadline=DateTime.Now.AddHours(1);
     List<BusyTimeLine> MyTotalBusySlots=new List<BusyTimeLine>(0);
     //var Holder=new List();
     foreach (KeyValuePair<string, CalendarEvent> MyCalendarEvent in AllEventDictionary)
     {
         var Holder = MyTotalBusySlots.Concat(GetBusySlotPerCalendarEvent(MyCalendarEvent.Value));
         MyTotalBusySlots = Holder.ToList();
         /*foreach (SubCalendarEvent MySubCalendarEvent in MyCalendarEvent.Value.AllEvents)
         {
             if (MySubCalendarEvent.End > LastDeadline)
             {
                 LastDeadline = MySubCalendarEvent.End;
             }
             MyTotalBusySlots.Add(MySubCalendarEvent.ActiveSlot);
         }*/
     }
     MyTotalBusySlots = SortBusyTimeline(MyTotalBusySlots, true);
     TimeLine MyTimeLine = new TimeLine(DateTime.Now, DateTime.Now.AddHours(1));
     if (MyTotalBusySlots.Count > 0)
     {
         MyTimeLine = new TimeLine(DateTime.Now, MyTotalBusySlots[MyTotalBusySlots.Count - 1].End);
     }
     MyTimeLine.OccupiedSlots = MyTotalBusySlots.ToArray();
     return MyTimeLine;
 }
        BusyTimeLine[] GetBusySlotPerCalendarEvent(CalendarEvent MyEvent)
        {
            int i=0;
            List<BusyTimeLine> MyTotalSubEventBusySlots = new List<BusyTimeLine>(0);
            BusyTimeLine[] ArrayOfBusySlotsInRepeat = new BusyTimeLine[0];
            DateTime LastDeadline = DateTime.Now.AddHours(1);

            if (MyEvent.RepetitionStatus)
            {
                ArrayOfBusySlotsInRepeat = GetBusySlotsPerRepeat(MyEvent.Repeat);
            }

            /*for (;i<MyEvent.AllEvents.Length;i++)
            {
                {*/
                    foreach (SubCalendarEvent MySubCalendarEvent in MyEvent.AllEvents)
                    {
                        if (!MyEvent.RepetitionStatus)
                        { MyTotalSubEventBusySlots.Add(MySubCalendarEvent.ActiveSlot); }
                    }

                    //MyTotalSubEventBusySlots.Add(MyEvent.AllEvents[i].ActiveSlot);
                /*}
            }*/

            //BusyTimeLine[] ConcatenatSumOfAllBusySlots = new BusyTimeLine[ArrayOfBusySlotsInRepeat.Length + MyTotalSubEventBusySlots.Count];
            /*
            i = 0;
            for (; i < ArrayOfBusySlotsInRepeat.Length; i++)
            {
                ConcatenatSumOfAllBusySlots[i] = ArrayOfBusySlotsInRepeat[i];
            }
            i = ArrayOfBusySlotsInRepeat.Length;
            int LengthOfConcatenatSumOfAllBusySlots = ConcatenatSumOfAllBusySlots.Length;
            int j = 0;
            j = i;
            for (; j < LengthOfConcatenatSumOfAllBusySlots;)
            {
                ConcatenatSumOfAllBusySlots[j] = MyTotalSubEventBusySlots[i];
                i++;
                j++;
            }*/
            var Holder = MyTotalSubEventBusySlots.Concat(ArrayOfBusySlotsInRepeat);
            BusyTimeLine[] ConcatenatSumOfAllBusySlots = Holder.ToArray();
            //ArrayOfBusySlotsInRepeat.CopyTo(ConcatenatSumOfAllBusySlots, 0);
            //MyTotalSubEventBusySlots.CopyTo(ConcatenatSumOfAllBusySlots, ConcatenatSumOfAllBusySlots.Length);
            //ArrayOfBusySlotsInRepeat.CopyTo(ConcatenatSumOfAllBusySlots, 0);
            return ConcatenatSumOfAllBusySlots;
        }
        private Dictionary<TimeLine, List<SubCalendarEvent>> BuildDicitionaryOfTimeLineAndSubcalendarEvents(List<SubCalendarEvent> MyInterferringSubCalendarEvents, Dictionary<TimeLine, Dictionary<CalendarEvent,List<SubCalendarEvent>>> DicitonaryTimeLineAndPertinentCalendarEventDictionary, CalendarEvent MyEvent)
        {
            List<TimeLine> MyListOfFreeTimelines = DicitonaryTimeLineAndPertinentCalendarEventDictionary.Keys.ToList();
            Dictionary<TimeLine,List<SubCalendarEvent>> DictionaryofTimeLineAndPertinentSubcalendar= new System.Collections.Generic.Dictionary<TimeLine,System.Collections.Generic.List<SubCalendarEvent>>();

            foreach (TimeLine MyTimeLine in MyListOfFreeTimelines)
            {
                //Dictionary<TimeLine, Dictionary<CalendarEvent, List<SubCalendarEvent>>> DicitonaryTimeLineAndPertinentCalendarEventDictionary1;

                Dictionary<CalendarEvent,List<SubCalendarEvent>> MyListOfDictionaryOfCalendarEventAndSubCalendarEvent=DicitonaryTimeLineAndPertinentCalendarEventDictionary[MyTimeLine];
                List<CalendarEvent> MyListOfPertitnentCalendars = MyListOfDictionaryOfCalendarEventAndSubCalendarEvent.Keys.ToList();
                MyListOfPertitnentCalendars = MyListOfPertitnentCalendars.OrderBy(obj => obj.End).ToList();
                List<SubCalendarEvent>  MyListOfPertinentSubEvent = new List<SubCalendarEvent>();
                foreach (CalendarEvent MyCalendarEvent in MyListOfPertitnentCalendars)
                {
                    List<SubCalendarEvent> InterFerringSubCalendarEventS = MyListOfDictionaryOfCalendarEventAndSubCalendarEvent[MyCalendarEvent];
                    if (MyCalendarEvent.Repeat.Enable)
                    {
                        List<CalendarEvent> MyListOfAffectedRepeatingCalendarEvent = getClashingCalendarEvent(MyCalendarEvent.Repeat.RecurringCalendarEvents.ToList(), MyTimeLine);

                        List<SubCalendarEvent> ListOfAffectedSubcalendarEvents = new System.Collections.Generic.List<SubCalendarEvent>();
                        foreach (CalendarEvent MyRepeatCalendarEvent in MyListOfAffectedRepeatingCalendarEvent)
                        {
                            SubCalendarEvent[] MyListOfSubCalendarEvents = MyRepeatCalendarEvent.AllEvents;
                            foreach (SubCalendarEvent PosibleClashingSubCalEvent in MyListOfSubCalendarEvents )
                            {
                                foreach(SubCalendarEvent eachInterFerringSubCalendarEvent in InterFerringSubCalendarEventS)
                                {
                                    if (PosibleClashingSubCalEvent.ID == eachInterFerringSubCalendarEvent.ID)
                                    {
                                        ListOfAffectedSubcalendarEvents.Add(eachInterFerringSubCalendarEvent);
                                    }
                                }
                            }
                        }
                        var MyTempHolder = MyListOfPertinentSubEvent.Concat(ListOfAffectedSubcalendarEvents);
                        MyListOfPertinentSubEvent = MyTempHolder.ToList();

                    }
                    else
                    {
                        var MyTempHolder = MyListOfPertinentSubEvent.Concat(MyListOfDictionaryOfCalendarEventAndSubCalendarEvent[MyCalendarEvent]);
                        MyListOfPertinentSubEvent=MyTempHolder.ToList();
                    }
                }
                //var ConcatVar = MyListOfPertinentSubEvent.Concat(TempSubCalendarEventsForMyCalendarEvent.ToList());
                //MyListOfPertinentSubEvent = ConcatVar.ToList();
                DictionaryofTimeLineAndPertinentSubcalendar.Add(MyTimeLine, MyListOfPertinentSubEvent);
            }

            return DictionaryofTimeLineAndPertinentSubcalendar;

            /*foreach(TimeLine MyTimeLine in MyListOfFreeTimelines)
            {
                List<SubCalendarEvent> MyTimeLineListToWorkWith = getIntersectionList(MyInterferringSubCalendarEvents, DictionsryofTimeLineAndPertinentSubcalenda[MyTimeLine]);

            }
            */
        }
Пример #12
0
        /// <summary>
        /// Generates the palette.
        /// </summary>
        /// <returns></returns>
        private Color[] GeneratePalette()
        {
            List<Color> colors = new List<Color>();

            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
            for (int c = 255; c >= 0; c--)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
            for (int c = 255; c >= 0; c--)
                colors.Add(Color.FromArgb(0xff, 0, 0xff, (byte)c));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
            for (int c = 255; c >= 0; c--)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));

            var half =
                colors.Concat(
                    colors.Reverse<Color>());

            return half.Concat(half).ToArray();
        }
Пример #13
0
        private void Button31_OnClick(object sender, RoutedEventArgs e)
        {
            var count = 0;
            var zjnamestr = "";

            var zjlblist1 = new List<string>();
            var zjlblist2 = new List<string>();
            var zjclasslist = 专家可评标专业分类.评审专业;
            foreach (var zjclass in zjclasslist)
            {
                zjlblist1.Add(zjclass.分类名);
                zjlblist2 = zjlblist2.Concat(zjclass.子分类).ToList();
            }


            var zjlist = 用户管理.查询用户<专家>(0, 0, includeDisabled: false);
            //foreach (var zj in zjlist)
            //{
            //    if (!string.IsNullOrWhiteSpace(zj.身份信息.姓名))
            //    {
            //        zj.身份信息.姓名 = zj.身份信息.姓名.Replace(" ", "").Replace(" ", "");
            //        用户管理.更新用户<专家>(zj, false);
            //        zjnamestr += zj.身份信息.姓名 + "          " + zj.身份信息.性别 + "          " + zj.身份信息.出生年月 + "          " +
            //                     zj.Id + "\r\n";
            //    }
            //    else
            //    {
            //        zjnamestr += "删除专家ID:" + zj.Id + "\r\n";
            //    }
            //}
            foreach(var item in zjlist)
            {
                string temp = "";
                foreach(var item1 in item.可参评物资类别列表)
                {
                    temp +=item1.一级分类+"|";
                }
                zjnamestr += item.身份信息.姓名 + "       " + item.身份信息.出生年月.ToString("yyyy-MM-dd") + "      " + item.学历信息.专业技术职称 + "      " + item.身份信息.专家级别 + "      " + item.联系方式.手机 + "      " + item.学历信息.毕业院校 + "      " +"可评标类别:"+ temp +"\r\n";
            }
            MessageBox.Show(count.ToString());
            textBox1.Text = zjnamestr;
        }
Пример #14
0
        private void taskText_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (_taskList == null)
            {
                MessageBox.Show("You don't have a todo.txt file open - please use File\\New or File\\Open",
                    "Please open a file", MessageBoxButton.OK, MessageBoxImage.Error);
                e.Handled = true;
                lbTasks.Focus();
                return;
            }

            if (e.Key == Key.Enter)
            {
                if (_updating == null)
                {
                    try
                    {
                        // determine if task entered has a creation date, if not lets add one.
                        // also need to know if there is a priority because we'll need to add the creation date after it if there is one.
                        string taskdetail = taskText.Text.Trim();
                        string[] split = taskdetail.Split(new char[] { ' ' });
                        int scenario = 0;
                        scenario = getTaskScenario(split);
                        DateTime thisDay = DateTime.Today;

                        switch (scenario)
                        {
                            //   Scenario 1 - Completed task (1st word is "x", 2nd word is Date_Completed, 3rd word starts Task_Details
                            //   Scenario 2 - Uncompleted task with Priority with Creation_Date
                            //   Scenario 3 - Uncompleted task with Priority without Creation_Date
                            //   Scenario 4 - Uncompleted task without Priority with Creation_Date
                            //   Scenario 5 - Uncompleted task without Priority without Creation_Date

                            case 0: // couldn't determine scenario
                            case 1: // completed
                            case 2: // has creation date
                            case 4: // has creation date
                                break;  // lets just leave the task alone

                            case 3: // add in the creation date
                                split[1] = thisDay.ToString("yyyy-MM-dd") + " " + split[1]; // squeeze in the date
                                taskdetail = "";
                                for (int i = 0; i < split.Count(); i++)  // rebuild the task
                                {
                                    taskdetail += split[i] + " ";
                                }
                                break;

                            case 5: // add in the creation date
                                split[0] = thisDay.ToString("yyyy-MM-dd") + " " + split[0]; // squeeze in the date
                                taskdetail = "";
                                for (int i = 0; i < split.Count(); i++)  // rebuild the task
                                {
                                    taskdetail += split[i] + " ";
                                }
                                break;

                            default:
                                break;  // anything else just leave the task alone

                        }
                        _taskList.Add(new Task(taskdetail.Trim()));
                    }
                    catch (TaskException ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    _taskList.Update(_updating, new Task(taskText.Text.Trim()));
                    _updating = null;
                }

                taskText.Text = "";
                FilterAndSort(_currentSort);

                Intellisense.IsOpen = false;
                return;
            }

            if (Intellisense.IsOpen && !IntellisenseList.IsFocused)
            {
                if (taskText.CaretIndex <= _intelliPos) // we've moved behind the symbol, drop out of intellisense
                {
                    Intellisense.IsOpen = false;
                    return;
                }

                switch (e.Key)
                {
                    case Key.Down:
                        IntellisenseList.Focus();
                        Keyboard.Focus(IntellisenseList);
                        IntellisenseList.SelectedIndex = 0;
                        break;
                    case Key.Escape:
                    case Key.Space:
                        Intellisense.IsOpen = false;
                        break;
                    default:
                        var word = FindIntelliWord();
                        IntellisenseList.Items.Filter = (o) => o.ToString().Contains(word);
                        break;
                }
            }
            else
            {
                switch (e.Key)
                {
                    case Key.Escape:
                        _updating = null;
                        taskText.Text = "";
                        this.lbTasks.Focus();
                        break;
                    case Key.OemPlus:
                        List<string> projects = new List<string>();
                        _taskList.Tasks.Each(task => projects = projects.Concat(task.Projects).ToList());

                        _intelliPos = taskText.CaretIndex - 1;
                        ShowIntellisense(projects.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(_intelliPos));
                        break;
                    case Key.D2:
                        List<string> contexts = new List<string>();
                        _taskList.Tasks.Each(task => contexts = contexts.Concat(task.Contexts).ToList());

                        _intelliPos = taskText.CaretIndex - 1;
                        ShowIntellisense(contexts.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(_intelliPos));
                        break;
                }
            }
        }
Пример #15
0
        private List<FileInfo> GetAccountReplays(DirectoryInfo account)
        {
            List<FileInfo> replays = new List<FileInfo>();
            account.GetDirectories().All(d =>
            {
                replays = replays.Concat(GetAccountReplays(d)).ToList();
                return true;
            });

            account.GetFiles().All(f =>
            {
                if (f.Extension.CompareTo(".SC2Replay") == 0)
                {
                    replays.Add(f);
                }
                return true;
            });
            return replays;
        }
Пример #16
0
        private void bitGetIssuesButton_Click(object sender, RoutedEventArgs e)
        {
            BitBucketRest bit = new BitBucketRest(bitUsername.Text,bitPassword.Password);
            bitComments = new Dictionary<int, List<BitModels.Comments>>();
            // Get the Bit Milestones
            bitMilestones = bit.GetMilestones(selectedBitRepository);
            if (bitMilestones == null)
            {
                logger.AppendText("The " + selectedBitRepository + " has no milestones.\n");

            }
            else
            {
                logger.AppendText("The " + selectedBitRepository + " has " + bitMilestones.Count.ToString() + " milestones.\n");

            }
            bitIssues = bit.GetIssues(selectedBitRepository);
            while (bit._hasMoreIssues)
            {
                bitIssues.Concat(bit.GetIssues(selectedBitRepository));
            }
            logger.AppendText("The " + selectedBitRepository + " has " + bitIssues.Count.ToString() + " issues.\n");
            // Get individual Comments for each issue
            foreach (Git2Bit.BitModels.Issue issue in bitIssues)
            {
                if (issue.comment_count > 0)
                {
                    // has comments:
                    List<Git2Bit.BitModels.Comments> comments = bit.GetComments(selectedBitRepository, issue.local_id);
                    logger.AppendText("Issue " + issue.local_id.ToString() + " has " + comments.Count.ToString() + " comments.\n");
                    bitComments[issue.local_id] = comments;
                }
            }
            bitGetIssuesButton.IsEnabled = false;
        }
Пример #17
0
        void FindTypesIcons()
        {
            IEnumerable<IHdumType> typesToCheck = Data.Namespace.Items.Select(node =>node.As<IHdumType>());
            IEnumerable<IHdumType> foundTypes = new List<IHdumType>();

            while (typesToCheck.Any())
            {
                foundTypes = foundTypes.Concat(typesToCheck);
                typesToCheck = typesToCheck.SelectMany(type => type.Items).Select(node => node.As<IHdumType>());
            }

            foreach (var type in foundTypes)
            {
                FindIconOfType(type);
            }
        }
Пример #18
0
		private void taskText_PreviewKeyUp(object sender, KeyEventArgs e)
		{
			if (_taskList == null)
			{
				MessageBox.Show("You don't have a todo.txt file open - please use File\\New or File\\Open",
					"Please open a file", MessageBoxButton.OK, MessageBoxImage.Error);
				e.Handled = true;
				lbTasks.Focus();
				return;
			}

			if (e.Key == Key.Enter)
			{
				if (_updating == null)
				{
					try
					{
						var taskDetail = taskText.Text.Trim();

						if (User.Default.AddCreationDate)
						{
							var tmpTask = new Task(taskDetail);
							var today = DateTime.Today.ToString("yyyy-MM-dd");

							if (string.IsNullOrEmpty(tmpTask.CreationDate))
							{
								if (string.IsNullOrEmpty(tmpTask.Priority))
									taskDetail = today + " " + taskDetail;
								else
									taskDetail = taskDetail.Insert(tmpTask.Priority.Length, " " + today);
							}
						}
						_taskList.Add(new Task(taskDetail));
					}
					catch (TaskException ex)
					{
						MessageBox.Show(ex.Message);
					}
				}
				else
				{
					_taskList.Update(_updating, new Task(taskText.Text.Trim()));
					_updating = null;
				}

				taskText.Text = "";
				FilterAndSort(_currentSort);

				Intellisense.IsOpen = false;
				lbTasks.Focus();

				return;
			}

			if (Intellisense.IsOpen && !IntellisenseList.IsFocused)
			{
				if (taskText.CaretIndex <= _intelliPos) // we've moved behind the symbol, drop out of intellisense
				{
					Intellisense.IsOpen = false;
					return;
				}

				switch (e.Key)
				{
					case Key.Down:
						IntellisenseList.Focus();
						Keyboard.Focus(IntellisenseList);
						IntellisenseList.SelectedIndex = 0;
						break;
					case Key.Escape:
					case Key.Space:
						Intellisense.IsOpen = false;
						break;
					default:
						var word = FindIntelliWord();
						IntellisenseList.Items.Filter = (o) => o.ToString().Contains(word);
						break;
				}
			}
			else
			{
				switch (e.Key)
				{
					case Key.Escape:
						_updating = null;
						taskText.Text = "";
						this.lbTasks.Focus();
						break;
					case Key.OemPlus:
						List<string> projects = new List<string>();
						_taskList.Tasks.Each(task => projects = projects.Concat(task.Projects).ToList());

						_intelliPos = taskText.CaretIndex - 1;
						ShowIntellisense(projects.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(_intelliPos));
						break;
					case Key.D2:
						List<string> contexts = new List<string>();
						_taskList.Tasks.Each(task => contexts = contexts.Concat(task.Contexts).ToList());

						_intelliPos = taskText.CaretIndex - 1;
						ShowIntellisense(contexts.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(_intelliPos));
						break;
				}
			}
		}
Пример #19
0
 public void NotifyGameOver(bool isDraw, List<Player> winners)
 {
     Application.Current.Dispatcher.Invoke((ThreadStart)delegate()
     {
         List<Player> drawers;
         List<Player> losers;
         if (isDraw)
         {
             Trace.Assert(winners.Count == 0);
             drawers = Game.CurrentGame.Players;
             losers = new List<Player>();
         }
         else
         {
             drawers = new List<Player>();
             losers = new List<Player>(Game.CurrentGame.Players.Except(winners));
         }
         ObservableCollection<GameResultViewModel> model = new ObservableCollection<GameResultViewModel>();
         foreach (Player player in winners.Concat(losers).Concat(drawers))
         {
             var m = new GameResultViewModel();
             m.Player = player;
             if (winners.Contains(player))
             {
                 m.Result = GameResult.Win;
                 // @todo : fix this.
                 m.GainedExperience = "+15";
                 m.GainedTechPoints = "+0";
             }
             else if (losers.Contains(player))
             {
                 m.Result = GameResult.Lose;
                 // @todo : fix this.
                 m.GainedExperience = "-3";
                 m.GainedTechPoints = "+0";
             }
             else if (drawers.Contains(player))
             {
                 m.Result = GameResult.Draw;
                 // @todo : fix this.
                 m.GainedExperience = "+3";
                 m.GainedTechPoints = "+0";
             }
             model.Add(m);
         }
         gameResultBox.DataContext = model;
         gameResultWindow.Content = gameResultBox;
         gameResultWindow.Show();
         gameResultWindow.Closed += (o, e) =>
         {
             var handler = OnGameCompleted;
             if (handler != null)
             {
                 handler(this, new EventArgs());
             }
         };
     });
 }