예제 #1
0
        public AssemblyComparerItem(string name, Guid?sourceId, string sourceVersion, Guid?otherId, string otherVersion)
        {
            var result = "";

            if (!string.IsNullOrWhiteSpace(sourceVersion) && !string.IsNullOrWhiteSpace(otherVersion))
            {
                var sv = new Version(sourceVersion);
                var ov = new Version(otherVersion);
                result = sv > ov ? ">" : sv < ov ? "<" : "";
            }
            else
            {
                result = string.IsNullOrWhiteSpace(sourceVersion) ? "<<" : ">>";
            }
            Text = name;
            SubItems.AddRange(new []
            {
                sourceId?.ToString() ?? "",
                sourceVersion ?? "",
                "",
                result, otherId?.ToString() ?? "",
                otherVersion ?? "",
                ""
            });
        }
예제 #2
0
        public WebResourceComparerItem(string name, Guid?sourceId, string sourceContent, Guid?otherId, string otherContent)
        {
            string result;

            if (sourceId != null && otherId != null)
            {
                var sourceContentLength = sourceContent?.Length ?? 0;
                var otherContentLength  = otherContent?.Length ?? 0;
                result = sourceContentLength > otherContentLength ? ">" : sourceContentLength < otherContentLength ? "<" : "";
            }
            else
            {
                result = sourceId == null ? "<<" : ">>";
            }
            Text = name;
            SubItems.AddRange(new[]
            {
                sourceId?.ToString() ?? "",
                "",
                sourceId != null ? sourceContent?.Length.ToString() ?? "0" : "",
                result,
                otherId?.ToString() ?? "",
                "",
                otherId != null ? otherContent?.Length.ToString() ?? "0" : ""
            });
        }
예제 #3
0
        public KeybindListViewItem(Keybind keybind) : base()
        {
            Keybind = keybind;

            Text = Keybind?.Name ?? "Unnamed Macro";

            Checked = (Keybind?.Enabled).GetValueOrDefault();

            string keys = string.Join(Keybind.KeysSeparator, Keybind?.Keys);

            SubItems.AddRange(new ListViewSubItem[]
            {
                //new ListViewSubItem(this, (Keybind?.Enabled).GetValueOrDefault() ? "✔" : "✕"){ Name = "Enabled" },
                new ListViewSubItem(this, !string.IsNullOrEmpty(keys) ? keys : "Not set")
                {
                    Name = "Keys"
                },
                new ListViewSubItem(this, Keybind?.Condition?.Name ?? "N/A")
                {
                    Name = "Condition"
                },
                new ListViewSubItem(this, Keybind?.Macro?.Name ?? "N/A - Blocking")
                {
                    Name = "Macro"
                },
            });
        }
예제 #4
0
 public LVI_Ex(IExposable value) : base()
 {
     Value = value;
     //SubItems are always at least 1
     SubItems.AddRange(value.TextValues().Select((t, i) => new LVSI_Ex(this, Value, i)).ToArray());
     SubItems.RemoveAt(0);
 }
예제 #5
0
 public ItemListViewItem(Item item) : base(item.Id.ToString())
 {
     ItemValue = item;
     SubItems.AddRange(new string[] { item.Loc, item.Cat.Name, item.Name, item.Desc,
                                      (item.Qt - SRIMSForm.Instance.CheckoutManager.QuantityCheckedOut(item)).ToString(),
                                      item.Qt.ToString() });
 }
예제 #6
0
        public async Task LoadFolder(bool shouldSetLoading = true)
        {
            try
            {
                if (shouldSetLoading)
                {
                    isLoadedSubject.OnNext(true);
                }

                var allFiles    = (await GetFiles())?.ToList();
                var directories = (await GetFolders())?.ToList();

                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (allFiles != null)
                    {
                        SubItems.AddRange(allFiles.Select(CreateNewFileItem));

                        if (directories != null)
                        {
                            if (allFiles.Count == 0 && directories.Count == 0)
                            {
                                CanExpand = false;
                            }

                            SubItems.AddRange(directories.Select(CreateNewFolderItem));

                            if (SubItems.ViewModels.Count > maxItemsCount)
                            {
                                CanExpand        = false;
                                WasContentLoaded = true;
                                isLoadedSubject.OnNext(true);
                                LoadingMessage = $"Too many items in folder ({SubItems.ViewModels.Count})";
                            }

                            RefreshType();
                            RaisePropertyChanged(nameof(SubItems));
                            OnGetFolderInfo();
                        }
                        else
                        {
                            CanExpand = false;
                        }
                    }
                    else
                    {
                        CanExpand = false;
                    }
                    WasContentLoaded = true;
                });
            }
            finally
            {
                if (shouldSetLoading && SubItems.ViewModels.Count < maxItemsCount)
                {
                    isLoadedSubject.OnNext(false);
                }
            }
        }
예제 #7
0
 public FolderItem(CloudBlobDirectory directory) : base(Path.GetFileName(directory.Prefix.Substring(0, directory.Prefix.Length - 1)))
 {
     ImageKey  = "folder.png";
     Directory = directory;
     SubItems.AddRange(new ListViewSubItem[] {
         new ListViewSubItem(), // spacer
         new ListViewSubItem(this, "File Folder")
     });
 }
예제 #8
0
        public MessageListViewItem(ListView lv, SmsMessage msg)
        {
            msg_     = msg;
            lvOwner_ = lv;
            msg_.lvi = this;

            SubItems.AddRange(new string[] { "", "", "", "", "", "" });
            UpdateState();
        }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugItem"/> class.
 /// </summary>
 /// <param name="dl">The download.</param>
 public DebugItem(WebDownload dl)
 {
     m_webDownload   = dl;
     m_startTime     = dl.DownloadStartTime;
     Text            = m_startTime.ToLongTimeString();
     m_url           = dl.Url;
     m_savedFilePath = dl.SavedFilePath == null ? "<Memory>" : dl.SavedFilePath;
     SubItems.AddRange(new string[] { "", "", m_status, "", m_url, m_savedFilePath, "", "" });
     ForeColor = Color.Blue;
 }
예제 #10
0
 public void SetSubItems()
 {
     SubItems.AddRange(new[]
     {
         Container,           //Container
         TypeString,          //Type
         m_PathID.ToString(), //PathID
         FullSize.ToString(), //Size
     });
 }
예제 #11
0
 public ServerListItem(Dictionary <string, object> info)
 {
     Text = info.ContainsKey("name") ? info["name"].ToString() : "<missing>";
     SubItems.AddRange(new[]
     {
         info.ContainsKey("gametype") ? info["gametype"].ToString() : "<missing>",
         info.ContainsKey("map") ? info["map"].ToString() : "<missing>",
         "- / -"
     });
 }
예제 #12
0
 public EpiListStatus(string SrvName, string Connection)
 {
     this.Text = SrvName;
     string[] splts = Connection.Split(':');
     this.Connection = splts[0];
     int.TryParse(splts[1], out Port);
     LastUpdate = DateTime.Now;
     SubItems.AddRange(new string[] { "", "" });
     SubItems[1].Text = "0";
     SubItems[2].Text = "Offline";
 }
예제 #13
0
 public FileItem(Models.File file, ImageList imageList) : base(file.DisplayName())
 {
     File     = file;
     ImageKey = FileSystem.AddIcon(imageList, file.Name ?? file.Path, FileSystem.IconSize.Small, "folder.png");
     SubItems.AddRange(new ListViewSubItem[]
     {
         new ListViewSubItem(this, file.Path),
         new ListViewSubItem(this, file.DateModified.ToString("M/d/yy h:mm t")),
         new ListViewSubItem(this, FileSystem.GetFileSize(file.Length))
     });
 }
예제 #14
0
 public void SetSubItems()
 {
     SubItems.AddRange(new[]
     {
         Container,           //Container
         TypeString,          //Type
         m_PathID.ToString(), //PathID
         StringHelper.GetSizeStr(FullSize),
         Info
     });
 }
예제 #15
0
 public BlobItem(CloudBlockBlob blob, ImageList imageList, bool showPath = false) : base((showPath) ? blob.Name : Path.GetFileName(blob.Name))
 {
     Blob     = blob;
     ImageKey = FileSystem.AddIcon(imageList, blob.Name, FileSystem.IconSize.Small);
     SubItems.AddRange(new ListViewSubItem[]
     {
         new ListViewSubItem(this, blob.Properties.LastModified.Value.DateTime.ToString()),
         new ListViewSubItem(this, FileSystem.GetFileType(blob.Name)),
         new ListViewSubItem(this, FileSystem.GetFileSize(blob.Properties.Length)),
         new ListViewSubItem(this, blob.Properties.ContentType)
     });
 }
예제 #16
0
        public ReputationViewItem(Reputation reputation)
        {
            Reputation = reputation;

            Text = reputation.Username;
            SubItems.AddRange(new[]
            {
                reputation.Number.ToString("+#;-#;0"),
                reputation.Comment,
                reputation.Time
            });
        }
예제 #17
0
            public AssemblyListViewItem(FileVersionInfo info)
            {
                AssemblyInfo = info;
                _filePath    = new FilePath(info.FileName);

                this.Text = _filePath.FileName;
                SubItems.AddRange(new string[]
                {
                    info.FileVersion,
                    _filePath.FullPath,
                });
            }
예제 #18
0
        public DomainViewItem(int number, string domain)
        {
            Domain = domain;

            Text = number.ToString();
            SubItems.AddRange(new []
            {
                domain,
                "Not Checked",
                "-"
            });
        }
예제 #19
0
        public ResourceListViewItem(IResourceInfo resource, bool multiEngine)
        {
            Resource    = resource;
            MultiEngine = multiEngine;

            //初始化结构
            Text = resource.Title.GetSubString(100);
            SubItems.AddRange(new[]
            {
                "",
                "",
                resource.HasSubResources ? "(多个资源)" : resource.DownloadSizeValue == null ? (resource.DownloadSizeCalcauted == 0L ? resource.DownloadSize.DefaultForEmpty("<未知>") : resource.DownloadSizeCalcauted.ToSizeDescription()) : resource.DownloadSizeValue.Value.ToSizeDescription(),
                resource.FileCount == null ? "----" : resource.FileCount.Value.ToString("N0"),
                "",
                resource.UpdateTime.HasValue ? resource.UpdateTime.Value.ToString("yyyy-MM-dd") : resource.UpdateTimeDesc
            });
            Resource_PreviewTypeChanged(this, null);

            UseItemStyleForSubItems = true;
            ImageKey = resource.HasSubResources ? "multiresource" : multiEngine ? "e_" + resource.Provider.Info.Name : GetImageKey(resource);

            //初始化标记
            RefreshItemMask();
            if (!resource.IsHashLoaded)
            {
                Resource.DetailLoaded += Resource_DetailLoaded;
            }
            else
            {
                RefreshDownloadStatus();
                RefreshIllegalStatus();
            }
            resource.PreviewTypeChanged += Resource_PreviewTypeChanged;

            CheckRowStyle();

            IsExpanded = false;
            if (resource.HasSubResources)
            {
                //多个资源项
                if (resource.SubResources == null)
                {
                    ChildItems.Add(new PaddingLoadingItem());
                    resource.SubResourceLoaded += (s, e) => AppContext.UiInvoke(LoadSubResources);
                }
                else
                {
                    LoadSubResources();
                    IsExpanded = true;
                }
            }
        }
예제 #20
0
 public TagReferenceListViewItem(TagDatum datum, int imageIndex = 0)
 {
     Reference = datum;
     Name      = Path.ChangeExtension(datum.Identifier.GetPath(datum.CacheKey), datum.Class.ToString());
     Text      = Path.ChangeExtension(Path.GetFileName(datum.Identifier.GetPath(datum.CacheKey)),
                                      datum.Class.ToString( ));
     ImageIndex = imageIndex;
     SubItems.AddRange(new[]
     {
         datum.Class.ToString( ),
         datum.Length.ToString( )
     });
 }
        public void UpdateItem(IFrame frame)
        {
            SubItems.Clear();
            Text = "IL_" + Instruction.Offset.ToString("X4");
            SubItems.AddRange(new string[]
            {
                string.Join(" ", Bytes.Select(x => x.ToString("X2"))),
                Instruction.OpCode.Name,
                Instruction.OperandToString()
            });

            BackColor = GetBackgroundColor(frame);
        }
예제 #22
0
        public DeviceListViewItem(KeybindDevice device) : base()
        {
            Device = device;

            Text = $"{(Device.Connected ? "" : "[Unplugged] ")}{Device.Name}";

            SubItems.AddRange(new ListViewSubItem[]
            {
                new ListViewSubItem(this, Device?.ID)
                {
                    Name = "ID"
                },
            });
        }
예제 #23
0
        public void UpdateItem(IFrame frame)
        {
            SubItems.Clear();
            Text = Instruction.Offset.ToString("X8");

            SubItems.AddRange(new string[]
            {
                string.Join(" ", Bytes.Select(x => x.ToString("X2"))),
                Formatter.FormatMnemonic(Instruction.Mnemonic),
                Formatter.FormatOperand(Instruction.Operand1),
                Formatter.FormatOperand(Instruction.Operand2),
            });

            BackColor = GetBackgroundColor(frame);
        }
예제 #24
0
 public ArkServerListViewItem(AtlasServerData ServerData)
 {
     Checked = true;
     SetServerData(ServerData);
     UseItemStyleForSubItems = false;
     Text = ServerData.ServerPort.ToString();
     SubItems.AddRange(new string[] { ServerData.ServerX.ToString().ToString(), ServerData.ServerY.ToString(), "Offline", "0", "0%", ServerData.AltSaveDirectory });
     SubItems[0].ForeColor = Color.LightSlateGray;
     SubItems[1].ForeColor = Color.LightSkyBlue;
     SubItems[2].ForeColor = Color.YellowGreen;
     SubItems[4].ForeColor = Color.LightSeaGreen;
     SubItems[5].ForeColor = Color.LightCoral;
     SubItems[6].ForeColor = Color.LightSlateGray;
     UpdateStatus();
 }
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="subitems">Die untergeordnetetn Einträge</param>
 public ControlFormularItemComboBoxItem(IEnumerable <ControlFormularItemComboBoxItem> subitems)
     : this()
 {
     SubItems.AddRange(subitems);
 }
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="subitems">Die untergeordnetetn Einträge</param>
 public ControlFormularItemComboBoxItem(params ControlFormularItemComboBoxItem[] subitems)
     : this()
 {
     SubItems.AddRange(subitems);
 }
예제 #27
0
			/// <summary>
			/// Constructor
			/// </summary>
			public MeasureLine(int segmentNumber)
			{
				SubItems.AddRange( new string[]{"","","", Units} );
				Text = "S"+segmentNumber.ToString();
			}
 public ArtistListViewItem(AllArtistsResult artist) : base(artist.Artist)
 {
     ArtistInfo = artist;
     SubItems.AddRange(new string[] { $"{artist.AlbumCount} albums", $"{artist.SongCount} songs" });
 }
예제 #29
0
 public LinkListViewItem(ILink assoc) : base(assoc.Name)
 {
     AssociatedLink = assoc;
     SubItems.AddRange(new string[] { string.Empty, string.Empty, string.Empty });
 }
        void InitSubItems(ListViewEx owner)
        {
            Font = owner.Font;
            UseItemStyleForSubItems = true;

            Text = Ticket.start_train_date_page.ToString("MM-dd HH:mm");

            //计算到达时间
            var(_, _, baseInfo) = AppContext.ExtensionManager.GlobalKernel.Resolve <ITrainBaseInfoStorageProvider>()
                                  .Find(
                Ticket.stationTrainDTO.TrainDto?.TrainNo,
                Ticket.stationTrainDTO.from_station_telecode,
                Ticket.stationTrainDTO.to_station_telecode);
            var elapsedMinute = baseInfo?.ElapsedMinutes;

            var arriveTime = Ticket.stationTrainDTO.arrive_time?.ToLongTimeString();

            if (elapsedMinute != null)
            {
                arriveTime = Ticket.start_train_date_page.AddMinutes(elapsedMinute.Value).ToString("MM-dd HH:mm");
            }

            //"抵达时间", "车次", "发站", "到站", "距离", "票种", "席别", "车厢", "座位", "票价", "乘客", "证件", "证件号码", "状态"
            var textArray = new[]
            {
                arriveTime?.PadRight(14, ' ') ?? "---",
                Ticket.stationTrainDTO.station_train_code,
                Ticket.stationTrainDTO.from_station_name,
                Ticket.stationTrainDTO.to_station_name,
                Ticket.stationTrainDTO.distance + "公里",
                Ticket.ticket_type_name,
                Ticket.seat_type_name,
                Ticket.coach_name + "车厢",
                Ticket.seat_name,
                "¥" + (Ticket.ticket_price / 100).ToString("#0.00  "),
                Ticket.Passenger.Name,
                Ticket.Passenger.IdTypeName,
                Ticket.Passenger.IdNo + "  ",
                Ticket.ticket_status_name
            };

            SubItems.AddRange(textArray);

            if (Ticket.OrderStatus == OrderStatus.NotPay || Ticket.OrderStatus == OrderStatus.ResignNotPaid)
            {
                SubItems[SubItems.Count - 1].Text += "(请在 " + Ticket.pay_limit_time.ToShortTimeString() + " 前支付)";
            }

            switch (Ticket.OrderStatus)
            {
            case OrderStatus.NotPay:
                ForeColor = System.Drawing.Color.Red;
                Font      = new Font(Font, FontStyle.Bold);
                break;

            case OrderStatus.TicketPrinted:
                ForeColor = System.Drawing.Color.Gray;
                Font      = new Font(Font, FontStyle.Strikeout);
                break;

            case OrderStatus.Used:
                ForeColor = System.Drawing.Color.Gray;
                Font      = new Font(Font, FontStyle.Strikeout);
                break;

            case OrderStatus.Refunded:
                ForeColor = System.Drawing.Color.Gray;
                Font      = new Font(Font, FontStyle.Strikeout);
                break;

            case OrderStatus.Resigned:
            case OrderStatus.ResignChagneTsed:
                ForeColor = System.Drawing.Color.Gray;
                Font      = new Font(Font, FontStyle.Strikeout);
                break;

            case OrderStatus.ResignTicket:
            case OrderStatus.ResignChagneTsTicket:
                if (Ticket.start_train_date_page < DateTime.Now)
                {
                    ForeColor = Color.Gray;
                    Font      = new Font(Font, FontStyle.Strikeout);
                }
                else
                {
                    ForeColor = Ticket.OrderStatus == OrderStatus.ResignTicket ? Color.Firebrick : Color.BlueViolet;
                    Font      = new Font(Font, FontStyle.Bold);
                }
                break;

            case OrderStatus.ResignNotPaid:
            case OrderStatus.ResignChangeTsNotPaid:
                Font      = new Font(Font, FontStyle.Bold);
                ForeColor = Color.MediumBlue;
                break;

            case OrderStatus.Queue:
                Font      = new Font(Font, FontStyle.Bold);
                ForeColor = Color.FromArgb(0x00, 0x66, 0x99);
                break;

            case OrderStatus.BeResigned:
            case OrderStatus.ResignChangeTsIng:
                ForeColor = Color.SaddleBrown;
                break;

            case OrderStatus.Failed:
                Font      = new Font(Font, FontStyle.Strikeout);
                ForeColor = System.Drawing.Color.Gray;
                break;

            case OrderStatus.Paid:
                if (Ticket.start_train_date_page < DateTime.Now)
                {
                    ForeColor = Color.Gray;
                    Font      = new Font(Font, FontStyle.Strikeout);
                }
                else
                {
                    ForeColor = Color.DarkGreen;
                    Font      = new Font(Font, FontStyle.Bold);
                }
                break;

            default:
                ForeColor = System.Drawing.Color.Gray;
                break;
            }


            UiUtility.ApplySubStyle(this);
        }