internal SLEnumerator(SortableList <T> list, int id)
 {
     m_list    = list;
     m_idNext  = 0;
     m_id      = id;
     m_current = default(T);
 }
Example #2
0
        private void PopulateTourTypeFilterComboBox()
        {
            var tourTypesList = new List <string>();

            SortableList <StatsDomainObject> pilotStats = null;

            try
            {
                pilotStats = Registry.GetPilotStats(PilotName).FighterStatsList;
            }
            catch (PilotDoesNotExistInRegistryException)
            {
                //ignore.
            }

            if (pilotStats == null)
            {
                return;
            }

            foreach (var fs in pilotStats.Where(fs => fs.TourType != "[UNKNOWN]")
                     .Where(fs => !tourTypesList.Contains(fs.TourType)))
            {
                tourTypesList.Add(fs.TourType);
            }

            foreach (var tourType in tourTypesList)
            {
                cmbxTourTypeFilter.Items.Add(tourType);
            }

            cmbxTourTypeFilter.SelectedIndex = 0;
        }
Example #3
0
 private static void PrintList(SortableList list)
 {
     for (var i = 0; i < list.Count; i++)
     {
         Console.Write($"{list[i]}, ");
     }
 }
        public void Sort(SortableList sortableList)
        {
            ISortStrategy sortingStrategy = efficientSortingStrategyFinder.GetEfficientStrategy(sortableList);

            sortableList.SortStrategy = sortingStrategy;
            sortableList.Sort();
        }
Example #5
0
        private SortableList <StatsDomainObject> GetStats(string mode, string filterTourType)
        {
            var list = new SortableList <StatsDomainObject>();

            switch (mode)
            {
            case "Fighter":
                list = Registry.GetPilotStats(PilotName).FighterStatsList;
                break;

            case "Attack":
                list = Registry.GetPilotStats(PilotName).AttackStatsList;
                break;

            case "Bomber":
                list = Registry.GetPilotStats(PilotName).BomberStatsList;
                break;

            case "Vehicle/Boat":
                list = Registry.GetPilotStats(PilotName).VehicleBoatStatsList;
                break;
            }

            var filteredList = new SortableList <StatsDomainObject>();

            filteredList.AddRange(list.Where(statsObj => statsObj.TourType == filterTourType));

            if (filteredList.Count > 0)
            {
                filteredList.SortList("TourNumber", ListSortDirection.Ascending);
            }

            return(filteredList);
        }
Example #6
0
        public SortableList <K> list()
        {
            SortableList <K> l_ = new SortableList <K>(getKeys());

            l_.sort();
            return(l_);
        }
 private List<FavoriteConfigurationElement> MergeWithNewTodays(
     SortableList<FavoriteConfigurationElement> oldTodays)
 {
     List<FavoriteConfigurationElement> newTodays = this.GetDateItems(HistoryByFavorite.TODAY);
     if (oldTodays != null)
         newTodays = DataDispatcher.GetMissingFavorites(newTodays, oldTodays);
     return newTodays;
 }
Example #8
0
 /// <summary>
 /// AStar Constructor.
 /// </summary>
 /// <param name="G">The graph on which AStar will perform the search.</param>
 public AStar(Graph G)
 {
     _Graph                   = G;
     _Open                    = new SortableList();
     _Closed                  = new SortableList();
     ChoosenHeuristic         = EuclidianHeuristic;
     DijkstraHeuristicBalance = 0.5;
 }
Example #9
0
        private static void RefreshGroupNodes(TagTreeNode groupNode)
        {
            groupNode.Nodes.Clear();
            SortableList <FavoriteConfigurationElement> groupFavorites =
                ConnectionHistory.Instance.GetDateItems(groupNode.Name);

            CreateGroupNodes(groupNode, groupFavorites);
        }
Example #10
0
 private static void FireDataReceived(MemoryStream stream)
 {
     if (OnServerConnection != null)
     {
         SortableList <FavoriteConfigurationElement> favorites = ReceiveFavorites(stream);
         OnServerConnection(new ShareFavoritesEventArgs(favorites));
     }
 }
 private static void CreateGroupNodes(GroupTreeNode groupNode,
     SortableList<IFavorite> groupFavorites)
 {
     foreach (IFavorite favorite in groupFavorites)
     {
         var favoriteNode = new FavoriteTreeNode(favorite);
         groupNode.Nodes.Add(favoriteNode);
     }
 }
Example #12
0
        public SortableList <FavoriteConfigurationElement> GetDateItems(string historyDateKey)
        {
            SortableList <HistoryItem> historyGroupItems = this.HistoryGroupedByDate[historyDateKey];
            SortableList <FavoriteConfigurationElement> groupFavorites = SelectFavoritesFromHistoryItems(historyGroupItems);

            Log.Debug("Getting history items for " + historyDateKey);

            return(Settings.OrderByDefaultSorting(groupFavorites));
        }
Example #13
0
 private static void CreateGroupNodes(TagTreeNode groupNode,
                                      SortableList <FavoriteConfigurationElement> groupFavorites)
 {
     foreach (FavoriteConfigurationElement favorite in groupFavorites)
     {
         FavoriteTreeNode favoriteNode = new FavoriteTreeNode(favorite);
         groupNode.Nodes.Add(favoriteNode);
     }
 }
Example #14
0
 private void CreateGroupNodes(GroupTreeNode groupNode,
                               SortableList <IFavorite> groupFavorites)
 {
     foreach (var favorite in groupFavorites)
     {
         var toolTip      = this.toolTipBuilder.BuildTooTip(favorite);
         var favoriteNode = new FavoriteTreeNode(this.favoriteIcons, favorite, toolTip);
         groupNode.Nodes.Add(favoriteNode);
     }
 }
Example #15
0
        private SortableList <FavoriteConfigurationElement> GetOldTodaysHistory()
        {
            SortableList <FavoriteConfigurationElement> oldTodays = null;

            if (this._currentHistory != null)
            {
                oldTodays = this.GetDateItems(HistoryByFavorite.TODAY);
            }
            return(oldTodays);
        }
Example #16
0
        private List <IFavorite> MergeWithNewTodays(SortableList <IFavorite> oldTodays)
        {
            List <IFavorite> newTodays = this.GetDateItems(HistoryIntervals.TODAY);

            if (oldTodays != null)
            {
                newTodays = DataDispatcher.GetMissingFavorites(newTodays, oldTodays);
            }
            return(newTodays);
        }
Example #17
0
        private List <IFavorite> Find()
        {
            // already sorted, we dont have to sort the results once again
            SortableList <IFavorite> all = this.favoritesSource.ToListOrderedByDefaultSorting();

            return(all.AsParallel()
                   .WithCancellation(this.Token)
                   .Where(Meet)
                   .ToList());
        }
Example #18
0
        private SortableList <IFavorite> LoadFromCache(string historyDateKey)
        {
            if (!this.cache.ContainsKey(historyDateKey))
            {
                SortableList <IFavorite> loaded = this.LoadFromDatabaseByDate(historyDateKey);
                this.cache.Add(historyDateKey, loaded);
            }

            return(this.cache[historyDateKey]);
        }
 private void Button_Click_Sort(object sender, RoutedEventArgs e)
 {
     if (path != null)
     {
         sortableList = new SortableList(fileService.ReadFromFile(path));
         sortingService.Sort(sortableList);
         fileService.WriteToFile(path, sortableList.List);
         textBoxContent.Text = string.Join(System.Environment.NewLine, sortableList.List);
     }
 }
Example #20
0
        private void AddItemToGroup(SerializableDictionary <string, SortableList <IHistoryItem> > groupedByDate, HistoryItem item)
        {
            string intervalName = HistoryIntervals.GetDateIntervalName(item.Date);
            SortableList <IHistoryItem> timeIntervalItems = GetTimeIntervalItems(intervalName, groupedByDate);

            if (!timeIntervalItems.Contains(item)) // add each item only once
            {
                timeIntervalItems.Add(item);
            }
        }
Example #21
0
        private SortableList <IFavorite> GetOldTodaysHistory()
        {
            SortableList <IFavorite> oldTodays = null;

            if (this.currentHistory != null)
            {
                oldTodays = this.GetDateItems(HistoryIntervals.TODAY);
            }
            return(oldTodays);
        }
Example #22
0
 private static SortableList<FavoriteConfigurationElement> GetReceivedFavorites(ArrayList favorites)
 {
     var importedFavorites = new SortableList<FavoriteConfigurationElement>();
     foreach (object item in favorites)
     {
         SharedFavorite favorite = item as SharedFavorite;
         if (favorite != null)
             importedFavorites.Add(ImportSharedFavorite(favorite));
     }
     return importedFavorites;
 }
Example #23
0
 private bool _sortedListContains(SortableList list, object o)
 {
     foreach (var item in list)
     {
         if (item == o)
         {
             return(true);
         }
     }
     return(false);
 }
Example #24
0
        private List <FavoriteConfigurationElement> MergeWithNewTodays(
            SortableList <FavoriteConfigurationElement> oldTodays)
        {
            List <FavoriteConfigurationElement> newTodays = this.GetDateItems(HistoryByFavorite.TODAY);

            if (oldTodays != null)
            {
                newTodays = DataDispatcher.GetMissingFavorites(newTodays, oldTodays);
            }
            return(newTodays);
        }
Example #25
0
    public SortableList <T> ApplyFilter(Func <T, bool> func)
    {
        SortableList <T> newList = new SortableList <T>();

        foreach (var item in this.Where(func))
        {
            newList.Add(item);
        }

        return(newList);
    }
Example #26
0
        /// <summary>
        ///     this will contain each name in each bin of grouped by time.
        ///     Returns not null list of items.
        /// </summary>
        private SortableList <IHistoryItem> GetTimeIntervalItems(string timeKey,
                                                                 SerializableDictionary <string, SortableList <IHistoryItem> > groupedByDate)
        {
            if (!groupedByDate.ContainsKey(timeKey))
            {
                var timeIntervalItems = new SortableList <IHistoryItem>();
                groupedByDate.Add(timeKey, timeIntervalItems);
            }

            return(groupedByDate[timeKey]);
        }
Example #27
0
        public SortableList <FavoriteConfigurationElement> ToList()
        {
            SortableList <FavoriteConfigurationElement> favorites = new SortableList <FavoriteConfigurationElement>();

            foreach (FavoriteConfigurationElement favorite in this)
            {
                favorites.Add(favorite);
            }

            return(favorites);
        }
Example #28
0
        private void gridComputers_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewColumn lastSortedColumn = this.gridComputers.FindLastSortedColumn();
            DataGridViewColumn column           = this.gridComputers.Columns[e.ColumnIndex];

            SortOrder newSortDirection = SortableUnboundGrid.GetNewSortDirection(lastSortedColumn, column);
            SortableList <ActiveDirectoryComputer> data =
                this.bsComputers.DataSource as SortableList <ActiveDirectoryComputer>;

            this.bsComputers.DataSource          = data.SortByProperty(column.DataPropertyName, newSortDirection);
            column.HeaderCell.SortGlyphDirection = newSortDirection;
        }
Example #29
0
        /// <summary>
        ///     Sort columns
        /// </summary>
        private void dataGridFavorites_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewColumn lastSortedColumn = this.dataGridFavorites.FindLastSortedColumn();
            DataGridViewColumn column           = this.dataGridFavorites.Columns[e.ColumnIndex];

            SortOrder newSortDirection = SortableUnboundGrid.GetNewSortDirection(lastSortedColumn, column);
            SortableList <FavoriteConfigurationElement> data =
                this.bsFavorites.DataSource as SortableList <FavoriteConfigurationElement>;

            this.bsFavorites.DataSource          = data.SortByProperty(column.DataPropertyName, newSortDirection);
            column.HeaderCell.SortGlyphDirection = newSortDirection;
        }
Example #30
0
        private void OnFileChanged(object sender, EventArgs e)
        {
            SortableList <FavoriteConfigurationElement> oldTodays = this.GetOldTodaysHistory();

            this.LoadHistory(null);
            List <FavoriteConfigurationElement> newTodays = this.MergeWithNewTodays(oldTodays);

            foreach (FavoriteConfigurationElement favorite in newTodays)
            {
                this.FireOnHistoryRecorded(favorite.Name);
            }
        }
Example #31
0
        public ImportFromAD()
        {
            this.InitializeComponent();
            this.gridComputers.AutoGenerateColumns = false;

            this.adClient = new ActiveDirectoryClient();
            this.adClient.ListComputersDone += this.AdClient_OnListComputersDone;
            this.adClient.ComputerFound += this.OnClientComputerFound;

            SortableList<ActiveDirectoryComputer> computers = new SortableList<ActiveDirectoryComputer>();
            this.bsComputers.DataSource = computers;
        }
Example #32
0
        private void OnFileChanged(object sender, EventArgs e)
        {
            // don't need locking here, because only today is updated adding new items
            SortableList <IFavorite> oldTodays = GetOldTodaysHistory();

            LoadHistory(null);
            List <IFavorite> newTodays = MergeWithNewTodays(oldTodays);

            foreach (IFavorite favorite in newTodays)
            {
                FireOnHistoryRecorded(favorite);
            }
        }
Example #33
0
 public PilotStats()
 {
     FighterScoresList     = new SortableList <FighterScoresDO>();
     FighterStatsList      = new SortableList <StatsDomainObject>();
     AttackScoresList      = new SortableList <AttackScoresDO>();
     AttackStatsList       = new SortableList <StatsDomainObject>();
     BomberScoresList      = new SortableList <BomberScoresDO>();
     BomberStatsList       = new SortableList <StatsDomainObject>();
     VehicleBoatScoresList = new SortableList <VehicleBoatScoresDO>();
     VehicleBoatStatsList  = new SortableList <StatsDomainObject>();
     ObjVsObjCompleteList  = new SortableList <ObjectVsObjectDO>();
     ObjVsObjVisibleList   = new SortableBindingList <ObjectVsObjectDO>();
 }
Example #34
0
        public ImportFromAD()
        {
            this.InitializeComponent();
            this.gridComputers.AutoGenerateColumns = false;

            this.adClient = new ActiveDirectoryClient();
            this.adClient.ListComputersDone += this.AdClient_OnListComputersDone;
            this.adClient.ComputerFound     += this.OnClientComputerFound;

            SortableList <ActiveDirectoryComputer> computers = new SortableList <ActiveDirectoryComputer>();

            this.bsComputers.DataSource = computers;
        }
        public ImportFromAD(IPersistence persistence)
        {
            InitializeComponent();

            this.persistence = persistence;
            this.gridComputers.AutoGenerateColumns = false;

            adClient = new ActiveDirectoryClient();
            adClient.ListComputersDone += new ListComputersDoneDelegate(this.AdClient_OnListComputersDone);
            adClient.ComputerFound += new ComputerFoundDelegate(this.OnClientComputerFound);

            var computers = new SortableList<ActiveDirectoryComputer>();
            this.bsComputers.DataSource = computers;
        }
Example #36
0
 public void Initialization()
 {
     sl = new SortableList<stuff>();
 }
Example #37
0
        private static SortableList<FavoriteConfigurationElement> SelectFavoritesFromHistoryItems(SortableList<HistoryItem> groupedByDate)
        {
            FavoriteConfigurationElementCollection favorites = Settings.GetFavorites(false);
            SortableList<FavoriteConfigurationElement> selection = new SortableList<FavoriteConfigurationElement>();
            foreach (HistoryItem favoriteTouch in groupedByDate)
            {
                FavoriteConfigurationElement favorite = favorites[favoriteTouch.Name];
                if (favorite != null && !selection.Contains(favorite))
                    selection.Add(favorite);
            }

            return selection;
        }
 private SortableList<FavoriteViewModel> ConvertFavoritesToViewModel(SortableList<IFavorite> source)
 {
     ICredentials storedCredentials = this.persistence.Credentials;
     IEnumerable<FavoriteViewModel> sortedFavorites = source.Select(favorite => new FavoriteViewModel(favorite, storedCredentials));
     return new SortableList<FavoriteViewModel>(sortedFavorites);
 }
 private void FavoritesSearchBoxFound(object sender, FavoritesFoundEventArgs e)
 {
     this.foundFavorites = new SortableList<IFavorite>(e.Favorites);
     this.UpdateFavoritesBindingSource();
 }
 private void OnAlphabeticalMenuDropDownOpening(object sender, EventArgs e)
 {
     if (!this.alphabeticalMenu.HasDropDownItems)
     {
         List<IFavorite> favorites = new SortableList<IFavorite>(PersistedFavorites)
             .SortByProperty("Name", SortOrder.Ascending);
         CreateAlphabeticalFavoriteMenuItems(favorites);
         Boolean alphaMenuVisible = this.alphabeticalMenu.DropDownItems.Count > 0;
         this.alphabeticalMenu.Visible = alphaMenuVisible;
     }
 }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            ClearBind();

            List<string> arFilter = GetFilters(null);

            string sExclude = tbExclude.Text;
            string[] arExclude = null;
            if (!string.IsNullOrEmpty(sExclude))
                arExclude = sExclude.Split('|');

            string sSql = "Select * From Win32_Service";
            sSql += ConvertFilter2Str(arFilter);

            var qry = new SelectQuery(sSql);
            var searcher = new ManagementObjectSearcher(qry);
            ManagementObjectCollection serviceGetter = searcher.Get();

            //主业务对象
            _arBiz = new SortableList<WmiServiceObj>();

            //显示行序号
            int[] iOrder = {0};
            foreach (
                WmiServiceObj objWmi in
                    serviceGetter.Cast<ManagementBaseObject>()
                        .Select(mobj => new WmiServiceObj(mobj, iOrder[0], arExclude))
                        .Where(objWmi => !objWmi.BSkipReadConfig))
            {
                _arBiz.Add(objWmi);
                iOrder[0] += 1;
            }

            BindBiz(true);
        }
    public Controls_PageView(string PageName)
    {
        XmlUtil x_util = new XmlUtil();
        Util util = new Util();
        //get page image
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        PageImage.ImageUrl = util.GetAppPageImage(State, State["PageViewAppID"].ToString(), PageName);
        PageImage.ID = PageName + "_PageImage";
        PageImage.Attributes.Add("onclick", "goToPage('" + PageName + "');");
        PageImage.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
        PageImage.Attributes.Add("onmouseout", "this.style.cursor='arrow';");
        if (State["UseFullPageImage"] != null)
        {
            PageImage.Width = 320;
            PageImage.Height = 460;
        }
        //get page fields
        XmlDocument doc = x_util.GetStagingAppXml(State);
        RadTreeNode PageRoot = new RadTreeNode(PageName);
        PageRoot.CssClass = "RadTreeView";
        PageRoot.ImageUrl = "../images/ascx.gif";
        PageRoot.Category = "page";
        PageRoot.Font.Size = FontUnit.Point(12);
        OnePageView.Nodes.Add(PageRoot);

        //do all fields
        XmlNode page = doc.SelectSingleNode("//pages/page/name[.  ='" + PageName + "']").ParentNode;
        XmlNode fields = page.SelectSingleNode("fields");

        if (fields != null)
        {
            //sort fields first
            SortedList list = new SortedList();
            SortableList<StoryBoardField> nameList = new SortableList<StoryBoardField>();

            foreach (XmlNode child in fields.ChildNodes)
            {
                Hashtable dict = new Hashtable();
                dict["field_type"] = child.Name;
                XmlNode id_node = child.SelectSingleNode("id");
                dict["id"] = id_node;
                string input_field = id_node.InnerText.Trim();
                if (child.SelectSingleNode("left") != null)
                    dict["left"] = child.SelectSingleNode("left").InnerText;
                else
                    dict["left"] = "0";

                if (child.SelectSingleNode("top") != null)
                    dict["top"] = child.SelectSingleNode("top").InnerText;
                else
                    dict["top"] = "0";

                dict["width"] = child.SelectSingleNode("width").InnerText;
                dict["height"] = child.SelectSingleNode("height").InnerText;
                string field_type = dict["field_type"].ToString();
                if (field_type == "button" ||
                    field_type == "image_button" ||
                    field_type == "table" ||
                    field_type == "switch")
                {
                    if(child.SelectSingleNode("submit") != null)
                        dict["submit"] = child.SelectSingleNode("submit").InnerText;
                }
                if (field_type == "table" )
                {
                    XmlNodeList sub_fields = child.SelectNodes("table_fields/table_field/name");
                    ArrayList table_list = new ArrayList();
                    foreach (XmlNode sub_field in sub_fields)
                    {
                        table_list.Add(sub_field.InnerText);
                    }
                    dict["sub_fields"] = table_list;
                }
                else if (field_type == "picker")
                {
                    XmlNodeList sub_fields = child.SelectNodes("picker_fields/picker_field/name");
                    ArrayList picker_list = new ArrayList();
                    foreach (XmlNode sub_field in sub_fields)
                    {
                        picker_list.Add(sub_field.InnerText);
                    }
                    dict["sub_fields"] = picker_list;
                }
                list[input_field] = dict;
                nameList.Add(new StoryBoardField(id_node.InnerText.Trim(), Convert.ToInt32(dict["top"].ToString()), Convert.ToInt32(dict["left"].ToString())));
            }

            nameList.Sort("Top", true);

            foreach (StoryBoardField input_field in nameList)
            {
                Hashtable dict = (Hashtable)list[input_field.FieldName];
                string field_type = dict["field_type"].ToString();
                RadTreeNode field_node = util.CreateFieldNode(PageRoot, input_field.FieldName, field_type);
                field_node.Value = "left:" +  dict["left"].ToString() + ";top:" + dict["top"].ToString() + ";width:" + dict["width"].ToString() + ";height:" + dict["height"].ToString() ;
                if (dict["submit"] != null && dict["submit"].ToString().Length > 0 && dict["submit"].ToString() != ";")
                {
                    field_node.BackColor = Color.PeachPuff;
                    string[] submit = dict["submit"].ToString().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    string target_page_name = null;
                    //this code is compatible with both old and new syntax
                    if (submit[0].StartsWith("post") && (submit[0].Contains("response_page:") || submit[0].Contains("response_page~")))
                    {
                        target_page_name = submit[0].Substring(19);
                        field_node.Value += ";next_page:" + target_page_name;
                    }
                    else if (submit[0].StartsWith("next_page"))
                    {
                        if (submit[0].Contains("next_page:page~"))
                            target_page_name = submit[0].Substring(15);
                        else
                            target_page_name = submit[0].Substring(10);

                        field_node.Value += ";next_page:" + target_page_name;
                    }

                 }
                if (field_type == "table" ||
                    field_type == "picker")
                {
                    ArrayList sub_field_list = (ArrayList)dict["sub_fields"];
                    foreach (string sub_field_name in sub_field_list)
                    {
                        RadTreeNode sub_field_node = util.CreateFieldNode(field_node, sub_field_name, field_type);
                    }
                }
            }
        }
        OnePageView.ExpandAllNodes();
        OnePageView.OnClientMouseOver = "onPageViewMouseOver";
        OnePageView.OnClientMouseOut = "onPageViewMouseOut";
    }
 private List<IFavorite> MergeWithNewTodays(SortableList<IFavorite> oldTodays)
 {
     List<IFavorite> newTodays = this.GetDateItems(HistoryIntervals.TODAY);
     if (oldTodays != null)
         newTodays = DataDispatcher.GetMissingFavorites(newTodays, oldTodays);
     return newTodays;
 }
        private static SortableList<IFavorite> SelectFavoritesFromHistoryItems(
            SortableList<IHistoryItem> groupedByDate)
        {
            var selection = new SortableList<IFavorite>();
            foreach (IHistoryItem favoriteTouch in groupedByDate)
            {
                IFavorite favorite = favoriteTouch.Favorite;
                if (favorite != null && !selection.Contains(favorite)) // add each favorite only once
                    selection.Add(favorite);
            }

            return selection;
        }
Example #45
0
 private static void CreateGroupNodes(TagTreeNode groupNode,
                                      SortableList<FavoriteConfigurationElement> groupFavorites)
 {
     foreach (FavoriteConfigurationElement favorite in groupFavorites)
     {
         FavoriteTreeNode favoriteNode = new FavoriteTreeNode(favorite);
         groupNode.Nodes.Add(favoriteNode);
     }
 }
        internal SortableList<FavoriteConfigurationElement> ToList()
        {
            var favorites = new SortableList<FavoriteConfigurationElement>();
            foreach (FavoriteConfigurationElement favorite in this)
            {
               favorites.Add(favorite);
            }

            return favorites;
        }
Example #47
0
        static void _callerQ_Load_Notify(object sender, EventArgs e)
        {
            SortableList<CallRecord> overdueItems = new SortableList<CallRecord>();

            foreach (CallRecord record in Settings.Default.Queue)
            {
                if (record.NotifyDate < DateTime.Now.AddMinutes(2) && !record.WasNotified && record.IsActive)
                {
                    overdueItems.Add(record);
                }
            }

            if (overdueItems.Count > 0)
            {
                overdueItems.Sort("NotifyDate", System.ComponentModel.ListSortDirection.Ascending);

                foreach (CallRecord record in overdueItems)
                {
                    using (Notifier notifier = new Notifier())
                    {
                        notifier.ShowDialog(record);
                    }
                }
            }
            Settings.Save();
            SetNotification();
        }
        private void btnLoadFromFile_Click(object sender, EventArgs e)
        {
            ClearBind();

            string sBase = Environment.CurrentDirectory;
            string sOfdBase = string.Format("{0}{1}Data", sBase, Path.DirectorySeparatorChar);
            ofdJson.InitialDirectory = sOfdBase;
            DialogResult dr = ofdJson.ShowDialog();
            if (dr != DialogResult.OK) return;

            string sFull = ofdJson.FileName;
            string s = FileHelper.ReadDataFile(sFull);
            rtbOut.Text = s;

            try
            {
                JArray jsonRoot = JArray.Parse(s);
                IList<JToken> arObjs = jsonRoot.Children().ToList();
                _arBiz = null; //new global data
                foreach (JToken aWmiObj in arObjs)
                {
                    var aServiceObj = JsonConvert.DeserializeObject<WmiServiceObj>(aWmiObj.ToString());
                    if (_arBiz == null) _arBiz = new SortableList<WmiServiceObj>();
                    _arBiz.Add(aServiceObj);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("File DeserializeObject Error for:\n" + ex.Message);
            }

            BindBiz();
        }
        /// <summary>
        /// Replace the favorites in binding source doesnt affect performance
        /// </summary>
        private void UpdateFavoritesBindingSource(SortableList<IFavorite> newData)
        {
            SortableList<FavoriteViewModel> data = ConvertFavoritesToViewModel(newData);

            DataGridViewColumn lastSortedColumn = this.dataGridFavorites.FindLastSortedColumn();
            if (lastSortedColumn != null) // keep last ordered column
            {
                SortOrder backupGliph = lastSortedColumn.HeaderCell.SortGlyphDirection;
                this.bsFavorites.DataSource = data.SortByProperty(lastSortedColumn.DataPropertyName, backupGliph);
                lastSortedColumn.HeaderCell.SortGlyphDirection = backupGliph;
            }
            else
            {
                this.bsFavorites.DataSource = data;
            }

            UpdateCountLabels();
        }
Example #50
0
            private SortableList<StatsDomainObject> GetStats(string mode, string filterTourType)
            {
                SortableList<StatsDomainObject> list = new SortableList<StatsDomainObject>();

                switch (mode)
                {
                    case "Fighter":
                        list = Registry.Instance.GetPilotStats(PilotName).FighterStatsList;
                        break;
                    case "Attack":
                        list = Registry.Instance.GetPilotStats(PilotName).AttackStatsList;
                        break;
                    case "Bomber":
                        list = Registry.Instance.GetPilotStats(PilotName).BomberStatsList;
                        break;
                    case "Vehicle/Boat":
                        list = Registry.Instance.GetPilotStats(PilotName).VehicleBoatStatsList;
                        break;
                }

                SortableList<StatsDomainObject> filteredList = new SortableList<StatsDomainObject>();

                foreach (StatsDomainObject statsObj in list)
                {
                    if (statsObj.TourType == filterTourType)
                        filteredList.Add(statsObj);
                }

                if (filteredList.Count > 0)
                {
                    filteredList.SortList("TourNumber", ListSortDirection.Ascending);
                }

                return filteredList;
            }
 private void FavoritesSearchBox_Canceled(object sender, EventArgs e)
 {
     this.foundFavorites = new SortableList<IFavorite>();
     this.UpdateFavoritesBindingSource();
 }