private void setThunb(string num, bool isOkBtn) { var isUser = !num.StartsWith("c"); Image img; if (ThumbnailManager.isExist(num, out img)) { var type = isUser ? "ユーザー" : "コミュニティ"; if (isUser) { userThumbBox.Image = new Bitmap(img, userThumbBox.Size); } else { comThumbBox.Image = new Bitmap(img, comThumbBox.Size); } var res = DialogResult.No; if (!isOkBtn && num != "co00") { res = MessageBox.Show(type + "画像を取得し直しますか?", type + "画像が既に存在します", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); } if (res == DialogResult.No) { if (isUser) { userThumbBox.Image = new Bitmap(img, userThumbBox.Size); } else { comThumbBox.Image = new Bitmap(img, comThumbBox.Size); } return; } } var newImg = ThumbnailManager.getImageId(num); if (newImg == null) { return; } if (bool.Parse(form.config.get("alartCacheIcon"))) { ThumbnailManager.saveImage(newImg, num); } if (isUser) { userThumbBox.Image = new Bitmap(newImg, userThumbBox.Size); } else { comThumbBox.Image = new Bitmap(newImg, comThumbBox.Size); } newImg.Dispose(); }
void setEditModeDisplay(AlartInfo editAi) { Text = "お気に入り編集"; communityId.Text = string.IsNullOrEmpty(editAi.communityId) ? "" : editAi.communityId; communityNameText.Text = string.IsNullOrEmpty(editAi.communityName) ? "" : editAi.communityName; userIdText.Text = string.IsNullOrEmpty(editAi.hostId) ? "" : editAi.hostId; userNameText.Text = string.IsNullOrEmpty(editAi.hostName) ? "" : editAi.hostName; keywordText.Text = string.IsNullOrEmpty(editAi.keyword) ? "" : editAi.keyword; memoText.Text = string.IsNullOrEmpty(editAi.memo) ? "" : editAi.memo; communityFollowChkBox.Checked = editAi.communityFollow == "フォロー解除する"; userFollowChkBox.Checked = editAi.hostFollow == "フォロー解除する"; isPopupChkBox.Checked = editAi.popup; isBaloonChkBox.Checked = editAi.baloon; isWebChkBox.Checked = editAi.browser; isMailChkBox.Checked = editAi.mail; isSoundChkBox.Checked = editAi.sound; appliAChkBox.Checked = editAi.appliA; appliBChkBox.Checked = editAi.appliB; appliCChkBox.Checked = editAi.appliC; appliDChkBox.Checked = editAi.appliD; appliEChkBox.Checked = editAi.appliE; appliFChkBox.Checked = editAi.appliF; appliGChkBox.Checked = editAi.appliG; appliHChkBox.Checked = editAi.appliH; appliIChkBox.Checked = editAi.appliI; appliJChkBox.Checked = editAi.appliJ; textColorBtn.BackColor = sampleColorText.ForeColor = editAi.textColor; backColorBtn.BackColor = sampleColorText.BackColor = editAi.backColor; defaultSoundList.SelectedIndex = editAi.soundType; isDefaultSoundIdChkBox.Checked = editAi.isSoundId; setMemberOnlyListInit(editAi); //memberOnlyList.SelectedIndex = editAi.memberOnlyMode; Image comThumb = null, userThumb = null; if (!string.IsNullOrEmpty(editAi.communityId) && editAi.communityId != "official") { if (ThumbnailManager.isExist(editAi.communityId, out comThumb)) { comThumbBox.Image = comThumb; } } if (!string.IsNullOrEmpty(editAi.hostId)) { if (ThumbnailManager.isExist(editAi.hostId, out userThumb)) { userThumbBox.Image = userThumb; } } isMustComChkBox.Checked = editAi.isMustCom; isMustUserChkBox.Checked = editAi.isMustUser; isMustKeywordChkBox.Checked = editAi.isMustKeyword; customKw = editAi.cki; if (customKw != null) { customKeywordBtn.Text = "カスタム設定(" + customKw[0].name + ")"; } if (editAi.isCustomKeyword) { isCustomKeywordRadioBtn.Checked = true; } isAutoReserveChkBox.Checked = editAi.isAutoReserve; }
public void getThumbBulkCore(ToolMenuLock _lock, MainForm form, bool isUser) { var getAiList = new List <AlartInfo>(); while (true) { try { foreach (var ai in form.alartListDataSource) { Image img = null; if (isUser && !string.IsNullOrEmpty(ai.hostId) && !ThumbnailManager.isExist(ai.hostId, out img) && getAiList.IndexOf(ai) == -1) { getAiList.Add(ai); } if (!isUser && !string.IsNullOrEmpty(ai.communityId) && !ThumbnailManager.isExist(ai.communityId, out img) && getAiList.IndexOf(ai) == -1) { getAiList.Add(ai); } } foreach (var ai in form.userAlartListDataSource) { Image img = null; if (isUser && !string.IsNullOrEmpty(ai.hostId) && !ThumbnailManager.isExist(ai.hostId, out img) && getAiList.IndexOf(ai) == -1) { getAiList.Add(ai); } if (!isUser && !string.IsNullOrEmpty(ai.communityId) && !ThumbnailManager.isExist(ai.communityId, out img) && getAiList.IndexOf(ai) == -1) { getAiList.Add(ai); } } break; } catch (Exception e) { util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite); } } _lock.all = getAiList.Count; setToolMenuStatusBar(); int got = 0, error = 0, no = 0; for (var i = 0; i < getAiList.Count; i++) { var ai = getAiList[i]; if ((isUser && userThumbLock != _lock) || (!isUser && comThumbLock != _lock)) { util.showModelessMessageBox("未取得" + (isUser ? "ユーザ" : "コミュ") + "画取得が中断されました", "", form); setToolMenuStatusBar(); return; } var id = isUser ? ai.hostId : ai.communityId; var img = ThumbnailManager.getImageId(id, form); if (img == null) { error++; form.alartListExistColorChange(id, isUser, 2); } else { ThumbnailManager.saveImage(img, id); got++; form.alartListExistColorChange(id, isUser, 0); } _lock.end = i; setToolMenuStatusBar(); Thread.Sleep(3000); } util.showModelessMessageBox("取得:" + got + " 画像無し:" + no + " エラー:" + error, "未取得" + (isUser ? "ユーザ" : "コミュ") + "画取得終了", form); if (isUser) { userThumbLock = null; } else { comThumbLock = null; } setToolMenuStatusBar(); }
public void setSamune(string url) { //if (string.IsNullOrEmpty(url)) return; if (isTest) { thumbnailPictureBox.Image = new Bitmap(Image.FromFile(ri.thumbnailUrl), thumbnailPictureBox.Size); return; } Image img; var dt0 = DateTime.Now; if (!ThumbnailManager.isExist(ri.comId, out img)) { util.debugWriteLine("is not exist thumbnail time " + (DateTime.Now - dt0) + " " + ri.comName); img = ThumbnailManager.getImageId(ri.comId); if (img != null) { ThumbnailManager.saveImage(img, ri.comId); } if (img == null && !string.IsNullOrEmpty(url)) { img = ThumbnailManager.getThumbnailRssUrl(url, true); } } else { util.debugWriteLine("is exist thumbnail time " + (DateTime.Now - dt0) + " " + ri.comName); } thumbnailPictureBox.Image = img; util.debugWriteLine("is set thumbnail time " + (DateTime.Now - dt0) + " " + ri.comName); /* * if (!util.isShowWindow) return; * if (IsDisposed) return; * WebClient cl = new WebClient(); * cl.Proxy = null; * * System.Drawing.Icon icon = null; * try { * byte[] pic = cl.DownloadData(url); * * * var st = new System.IO.MemoryStream(pic); * icon = Icon.FromHandle(new System.Drawing.Bitmap(st).GetHicon()); * st.Close(); * * * } catch (Exception e) { * util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite); * util.debugWriteLine("set samune error " + url); * return; * } * * try { * Invoke((MethodInvoker)delegate() { * try { * thumbnailPictureBox.Image = icon.ToBitmap(); * * } catch (Exception e) { * util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite); * } * }); * } catch (Exception e) { * util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite); * } * * * // Icon = new System.Drawing.Icon(url); */ }