コード例 #1
0
        public void ShowMessage(string Message, string Caption, MessageStyle msg_style, MessageType msg_type)
        {
            lblMessage.Text = Message;
            lblCaption.Text = Caption;
            if (msg_style == MessageStyle.Information)
            {
                imgInfo.ImageUrl = "~/images/msg_information.png";
            }
            else if (msg_style == MessageStyle.Critical)
            {
                imgInfo.ImageUrl = "~/images/msg_critical.png";
            }
            else if (msg_style == MessageStyle.Successfull)
            {
                imgInfo.ImageUrl = "~/images/msg_success.png";
            }
            else if (msg_style == MessageStyle.Question)
            {
                imgInfo.ImageUrl = "~/images/msg_question.png";
            }

            if (msg_type == MessageType.OkOnly)
            {
                btnYes.Visible = false; btnOk.Text = "Ok";
            }
            else if (msg_type == MessageType.YesNo)
            {
                btnYes.Visible = true; btnOk.Text = "No";
            }

            tdCaption.Visible = true;
            mpext.Show();
        }
コード例 #2
0
        private void BatchTaskForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.comboBox_taskName.Text = MainForm.AppInfo.GetString(
                "BatchTaskForm",
                "BatchTaskName",
                "");

            this.webBrowser_info.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_info_DocumentCompleted);


            // 使得菜单显示正确
            this.MessageStyle = this.MessageStyle;

            //
            API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
        }
コード例 #3
0
        public String getMessage(MessageStyle style = MessageStyle.Default)
        {
            String        result = null;
            List <String> holder;

            try
            {
                switch (style)
                {
                case MessageStyle.Default:
                    holder = new List <string>();
                    holder.Add(this?.message);
                    var           data    = this?.getData <object[]>();
                    List <String> message = data?.Cast <JObject>().Select(x => Convert.ToString(x?.GetValue("message")))?.ToList();
                    if ((message?.Count ?? 0) > 0)
                    {
                        holder.AddRange(message);
                    }
                    result = String.Join("\n", holder);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogUtils.Default.Write(ex);
            }

            return(result);
        }
コード例 #4
0
 public MessageStyle CooperationMessageRecordProcessor(System.Collections.Generic.List<CooperationMessageRecord> records, MessageStyle ms, int i)
 {
     switch (records[i].type)
     {
     case 0:
         ms = new MessageStyle(records[i].style);
         break;
     case 1:
         ms = new MessageStyle(records[i].style);
         break;
     case 2:
         ms = this.CooperationStaffEndFileDownloadMessageRecord(records, ms, i);
         break;
     case 3:
         ms = this.CooperationStaffErrorFileUpLoadMessageRecord(records, ms, i);
         break;
     case 4:
         ms = this.CooperationStaffErrorFileDownloadMessageRecord(records, ms, i);
         break;
     case 5:
         ms = this.CooperationStaffReJectFileDownloadMessagRecord(records, ms, i);
         break;
     case 6:
         ms = this.CooperationStaffEndFileUpLoadMessageRecord(records, ms, i);
         break;
     }
     if (records[i].type == 0)
     {
         ms = new MessageStyle(records[i].style);
     }
     return ms;
 }
コード例 #5
0
ファイル: BatchTaskForm.cs プロジェクト: KinKir/dp2
 private void ToolStripMenuItem_progress_Click(object sender, EventArgs e)
 {
     if ((this.MessageStyle & MessageStyle.Progress) != 0)
         this.MessageStyle -= MessageStyle.Progress;
     else
         this.MessageStyle |= MessageStyle.Progress;
 }
コード例 #6
0
ファイル: BatchTaskForm.cs プロジェクト: KinKir/dp2
 private void ToolStripMenuItem_result_Click(object sender, EventArgs e)
 {
     if ((this.MessageStyle & MessageStyle.Result) != 0)
         this.MessageStyle -= MessageStyle.Result;
     else
         this.MessageStyle |= MessageStyle.Result;
 }
コード例 #7
0
        /// <summary>
        /// Search Loyalty Customers
        /// </summary>
        /// <param name="searchTerm"></param>
        /// <param name="totalResults"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList <Customer> SearchLoyaltyCustomer(string searchTerm, out int totalResults, int pageIndex = 1,
                                                      int pageSize = 100)
        {
            var dateStart = DateTime.Now;

            Performancelog.Debug(
                $"Start,CustomerManager,SearchLoyaltyCustomer,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}");

            var customers = _customerService.SearchLoyaltyCustomer(searchTerm, out totalResults, pageIndex, pageSize);

            Performancelog.Debug(
                $"End,CustomerManager,SearchLoyaltyCustomer,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");

            if (customers?.Count > 0)
            {
                return(customers);
            }

            string tempAvoidedValuesString = "";

            var error = new MessageStyle();

            var customerByCard = SearchCustomerCard(searchTerm, true, out error);

            if (customerByCard != null)
            {
                //check if get by card
                totalResults = -999;
                customers.Add(customerByCard);
            }

            return(customers);
        }
コード例 #8
0
ファイル: ShowApp.cs プロジェクト: ltinter/Toilluminate
        public void SetDrawMessageStyle(string message, MessageStyle drawStyle, int drawStyleIndex)
        {
            if (drawStyleIndex >= 0 && drawStyleIndex < this.drawStyleListValue.Count)
            {
                DrawMessageStyle drawMessageStyle = this.drawStyleListValue[drawStyleIndex];
                int oldWidthValue = drawMessageStyle.Width;
                drawMessageStyle.SetDrawMessageStyle(message, drawStyle.Width);

                this.widthValue = this.widthValue - oldWidthValue + drawMessageStyle.Width;

                if (this.heightValue < drawStyle.Height)
                {
                    this.heightValue = drawStyle.Height;
                }
                else
                {
                    this.heightValue = 0;
                    foreach (DrawMessageStyle drawStyleTemp in this.drawStyleListValue)
                    {
                        if (this.heightValue < drawStyleTemp.Height)
                        {
                            this.heightValue = drawStyleTemp.Height;
                        }
                    }
                }

                this.moveState = MoveStateType.NotMove;
            }
        }
コード例 #9
0
 public VendorPayout()
 {
     Reasons = new List <VendorReason>();
     Vendors = new List <PayoutVendor>();
     Taxes   = new List <Tax>();
     Message = new MessageStyle();
 }
コード例 #10
0
ファイル: ScrollbackLine.cs プロジェクト: JGunning/OpenAIM
 /// <summary>
 /// Creates a new instance of content line
 /// </summary>
 /// <param name="_style">Style</param>
 /// <param name="Text">Value</param>
 /// <param name="when">Time</param>
 /// <param name="_notice">Whether it should trigger notification</param>
 public ContentLine(MessageStyle _style, string Text, DateTime when, bool _notice)
 {
     style = _style;
     time = when;
     text = Text;
     notice = _notice;
 }
コード例 #11
0
ファイル: Message.xaml.cs プロジェクト: DaVinciUA/xvid4psp
        //Выводим инфу в окно
        private void SetUpWindow(string text, string info, string title, MessageStyle style)
        {
            this.Title        = title;
            text_message.Text = text;
            if (!string.IsNullOrEmpty(info))
            {
                text_info.Text    = info;
                btInfo.Visibility = Visibility.Visible;
            }

            mstyle = style;
            if (mstyle == MessageStyle.Ok)
            {
                btYes.Visibility = Visibility.Hidden;
                btNo.Content     = Languages.Translate("OK");
            }
            else if (mstyle == MessageStyle.YesNo)
            {
                btYes.Content = Languages.Translate("Yes");
                btNo.Content  = Languages.Translate("No");
            }
            else if (mstyle == MessageStyle.OkCancel)
            {
                btYes.Content = Languages.Translate("OK");
                btNo.Content  = Languages.Translate("Cancel");
            }
            else
            {
                btYes.Visibility = Visibility.Hidden;
                btNo.Content     = Languages.Translate("OK");
            }

            cm_copy.Header = Languages.Translate("Copy");
            ShowDialog();
        }
コード例 #12
0
 public static void RepertoryImage(Graphics drawDestination, MessageStyle style, MscStyle style2)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 28, 60, 15);
     Pen pen = new Pen(Color.Black);
     float[] pattern = {3f,3f};
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("Message",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     drawDestination.DrawLine(Pens.DarkGray,5,10,5,70);
     drawDestination.DrawLine(Pens.DarkGray,75,10,75,70);
     if (style2 == MscStyle.SDL){
         if((style == MessageStyle.Normal)||(style == MessageStyle.Synchron)){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
         }
         else if (style == MessageStyle.Dashed){
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
         }
     }
     else if(style2 == MscStyle.UML2){
         if( style == MessageStyle.Normal){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40-4);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40+4);
         }
         else if( style == MessageStyle.Dashed){
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,5,40,75,40);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40-4);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40+4);
         }
         else if( style == MessageStyle.Synchron){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
         }
     }
     pen.Dispose();
     itemStringFormat.Dispose();
 }
コード例 #13
0
ファイル: ShowApp.cs プロジェクト: ltinter/Toilluminate
 public void AddDrawMessage(string message, MessageStyle drawStyle)
 {
     this.drawStyleListValue.Add(new ToilluminateClient.DrawMessageStyle(message, widthValue, drawStyle.Font, drawStyle.Color, drawStyle.Width, drawStyle.Height));
     this.widthValue = this.widthValue + drawStyle.Width;
     if (this.heightValue < drawStyle.Height)
     {
         this.heightValue = drawStyle.Height;
     }
 }
コード例 #14
0
ファイル: Message.cs プロジェクト: kg/rlms2013
 public Message(Game game, string[] pages, MessageStyle style)
 {
     Game = game;
     Pages = pages;
     ActivePage = 0;
     HoldDuration = HoldTime + (HoldTimePerCharacter * Text.Length);
     OpenedWhen = (float)Time.Seconds;
     Style = style;
 }
コード例 #15
0
        public void loadArchiveSelectedUserDate(string selectedUser, string search, string date)
        {
            String HTMLResult = "<p></p>";

            if (this.InvokeRequired)
            {
                BeginInvoke(new loadArchiveSelectedUserDateDelegate(loadArchiveSelectedUserDate), new object[] { selectedUser, search });
                return;
            }
            ResetHTML();

            Emoticons myEmoticons = new Emoticons(Directory.GetCurrentDirectory() + "\\Emoticons\\");

            List <Remwave.Client.Storage.StorageMessage> list = mStorage.GetMessageFromArchiveByDate(selectedUser, search, 2048, date);

            for (int i = list.Count - 1; i >= 0; i--)
            {
                JabberUser jabberUser = null;

                MessageStyle        incomingStyle = new MessageStyle(Color.White, new System.Drawing.Font("Trebuchet MS", 8.5F, System.Drawing.FontStyle.Regular), Color.Black, Color.Red);
                MessageStyle        outgoingStyle = new MessageStyle(Color.White, new System.Drawing.Font("Trebuchet MS", 8.5F, System.Drawing.FontStyle.Regular), Color.Black, Color.Blue);
                MessageTemplateType template      = MessageTemplateType.Notification;
                MessageStyle        style         = new MessageStyle(Color.White, new System.Drawing.Font("Trebuchet MS", 8.5F, System.Drawing.FontStyle.Regular), Color.Gray, Color.Gray);

                String messageHTML = "";


                if (list[i].ContentHTML != "")
                {
                    messageHTML = list[i].ContentHTML;
                }
                else
                {
                    messageHTML = list[i].ContentText;
                }



                //Compatibility with legacy text only messages
                if (list[i].Direction == StorageItemDirection.In)
                {
                    style      = incomingStyle;
                    template   = MessageTemplateType.In;
                    jabberUser = new JabberUser(list[i].JID);
                }
                else
                {
                    style      = outgoingStyle;
                    template   = MessageTemplateType.Out;
                    jabberUser = new JabberUser(mStorage.Username);
                }
                IMMessage message = new IMMessage(jabberUser.Nick, messageHTML, list[i].GUID, list[i].Created, style, template, myEmoticons);
                HTMLResult += message.HTML;
            }
            wbConversation.Document.Body.InnerHtml += HTMLResult;
        }
コード例 #16
0
 public StockMessage()
 {
     AddStockPage        = new AddStockPage();
     RestrictionPage     = new RestrictionPage();
     GiftCertPage        = new GiftCertPage();
     GivexPage           = new GiftCardPage();
     RegularPriceMessage = new MessageStyle();
     QuantityMessage     = new MessageStyle();
     PSInetPage          = new PSInetPage();
 }
コード例 #17
0
ファイル: MessageLine.cs プロジェクト: xueliu/MSC_Generator
 public MessageLine(string identifier, uint line, int source, int destination, MessageStyle style)
 {
     this.mLineBeginn 			= line;
     this.mMessageSource 		= source;
     this.mMessageDestination 	= destination;
     this.mLineEnd 				= 0;
     this.mItemPen 				= new Pen(Color.Black, 1);
     this.mStyle 				= style;
     this.mIdentifier 			= identifier;
 }
コード例 #18
0
 private void DisplayMessage(string title, string detail, MessageStyle iconStyle)
 {
     ClientMessage = new ClientMessageOptions
     {
         Title          = title,
         Message        = detail,
         Style          = iconStyle,
         AutoCloseDelay = 0
     };
 }
コード例 #19
0
ファイル: MessageEnd.cs プロジェクト: xueliu/MSC_Generator
 public MessageEnd(uint fileLine, string identifier, uint line, int messageSource, int messageDestination, MessageStyle style)
 {
     this.mLine 					= line;
     this.mMessageSource 		= messageSource;
     this.mMessageDestination 	= messageDestination;
     this.mItemPen 				= new Pen(Color.Black, 1);
     this.mStyle 				= style;
     this.mIdentifier 			= identifier;
     mInitialHeight				= 1;
     this.mFileLine 				= fileLine;
 }
コード例 #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchCriteria"></param>
        /// <param name="totalResults"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public List <Customer> Search(string searchCriteria, out int totalResults, int pageIndex = 1, int pageSize = 100)
        {
            var dateStart = DateTime.Now;

            Performancelog.Debug($"Start,CustomerManager,Search,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}");
            var cardNumber = searchCriteria;

            var customer = _customerService.Search(searchCriteria, out totalResults, pageIndex, pageSize);

            if (customer.Count > 0)
            {
                return(customer);
            }
            string tempAvoidedValuesString = "";

            SqlQueryCheck(ref searchCriteria, ref tempAvoidedValuesString);
            var customerByCard = _customerService.GetClientCardByCardNumber(searchCriteria);

            if (customerByCard != null && customer.All(c => c.Code != customerByCard.ClientCode))
            {
                //check if get by card
                totalResults = -999;
                var cardCustomer = _customerService.GetClientByClientCode(customerByCard.ClientCode);
                customer.Add(cardCustomer);
            }
            else
            {
                string   strExp;
                string   strStatus;
                DateTime dExpiryDate;
                var      boolExpiredCard = false;
                var      blnFoundCst     = false;

                tempAvoidedValuesString = "";
                MessageStyle message   = null;
                var          crdNumber = EvaluateCardString(cardNumber, out message);
                if (!string.IsNullOrEmpty(message.Message))
                {
                    return(null);
                }
                SqlQueryCheck(ref crdNumber, ref tempAvoidedValuesString);
                var strCustomerCode = GetCustomerBasedOnClientCard(crdNumber, out strExp, out strStatus, out dExpiryDate);
                var crd             = _customerService.GetClientByClientCode(strCustomerCode);
                if (crd != null)
                {
                    totalResults = -999;
                    customer.Add(crd);
                }
            }
            Performancelog.Debug(
                $"End,CustomerManager,Search,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");
            return(customer);
        }
コード例 #21
0
ファイル: Message.cs プロジェクト: xueliu/MSC_Generator
 public Message(uint fileLine, string name, uint line, int messageSource, int messageDestination)
 {
     this.mName 					= name;
     this.mLine 					= line;
     this.mMessageSource 		= messageSource;
     this.mMessageDestination 	= messageDestination;
     this.mItemPen 				= new Pen(Color.Black, 1);
     this.mStyle 				= MessageStyle.Normal;
     this.mFileLine 				= fileLine;
     this.mInitialHeight 		= 4;
     if (messageSource==messageDestination) mInitialHeight=30; else mInitialHeight=0;
 }
コード例 #22
0
ファイル: MessageBeginn.cs プロジェクト: xueliu/MSC_Generator
 public MessageBegin(uint fileLine, string identifier, string name, uint line, int messageSource, int messageDestination)
 {
     this.mName 					= name;
     this.mLine 					= line;
     this.mMessageSource 		= messageSource;
     this.mMessageDestination 	= messageDestination;
     this.mItemPen 				= new Pen(Color.Black, 1);
     this.mStyle 				= MessageStyle.Normal;
     this.mIdentifier 			= identifier;
     mInitialHeight				= 0;
     this.mFileLine 				= fileLine;
 }
コード例 #23
0
 public MessageBuilder(IUser userData, string baseMessage, bool success, string title, Color?color = null,
                       string thumbnailUrl = null, MessageStyle style = MessageStyle.Embed,
                       params OutputFieldMessage[] outputFieldMessages)
 {
     UserData            = userData;
     BaseMessage         = baseMessage;
     Success             = success;
     Title               = title;
     Color               = color ?? Color.Purple;
     ThumbnailUrl        = thumbnailUrl;
     Style               = style;
     OutputFieldMessages = outputFieldMessages?.ToList();
 }
コード例 #24
0
 private void DisplayMessage(string title, string detail, MessageStyle iconStyle)
 {
     pnlMsgContainer.Controls.Clear();
     GalleryServerPro.Web.Controls.usermessage msgBox = (GalleryServerPro.Web.Controls.usermessage)Page.LoadControl(Util.GetUrl("/controls/usermessage.ascx"));
     msgBox.IconStyle      = iconStyle;
     msgBox.MessageTitle   = title;
     msgBox.MessageDetail  = detail;
     msgBox.CssClass       = "um3ContainerCss gsp_rounded10 gsp_floatcontainer";
     msgBox.HeaderCssClass = "um1HeaderCss";
     msgBox.DetailCssClass = "um1DetailCss";
     pnlMsgContainer.Controls.Add(msgBox);
     pnlMsgContainer.Visible = true;
 }
コード例 #25
0
 private void EntStaffMessageRecordMessageCenter(System.Collections.Generic.List <MessageRecord> records)
 {
     try
     {
         if (records.Count > 0)
         {
             Message[]    messages = new Message[records.Count];
             MessageStyle ms       = null;
             for (int i = 0; i < messages.Length; i++)
             {
                 ms                        = this.StaffMessageRecordProcessor(records, ms, i);
                 messages[i]               = new Message();
                 messages[i].FromJid       = records[i].from_uid + "@null/null";
                 messages[i].CreateTime    = records[i].createTime;
                 messages[i].MessageBlocks = this.utilService.MessageDecode(records[i].message);
                 messages[i].Style         = ms;
                 messages[i].RecordId      = records[i].id;
                 messages[i].IsMark        = records[i].isMark;
                 messages[i].Gid           = records[i].from_uid;
                 messages[i].FileName      = records[i].fileName;
                 messages[i].Icon          = records[i].icon;
                 messages[i].Url           = records[i].url;
                 if (this.sessionService.Uid == records[i].to_uid)
                 {
                     messages[i].ToJid = records[i].from_uid.ToString();
                 }
                 else
                 {
                     messages[i].ToJid = records[i].to_uid.ToString();
                 }
                 messages[i].Style = ms;
             }
             IDKin.IM.Core.Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(messages[0].FromJid)));
             if (staff != null && WindowModel.Instance.IsOpenMessageCenterWindow())
             {
                 WindowModel.Instance.MsgRecordPage.MessageCenterRecordStaff(messages, staff, records[0].total);
                 System.GC.Collect();
             }
         }
         else
         {
             WindowModel.Instance.MsgRecordPage.ClearPage();
         }
     }
     catch (System.Exception e)
     {
         System.Console.WriteLine(e.ToString());
     }
 }
コード例 #26
0
        private void DisplayCooperationMessageRecordToChatPanel(System.Collections.Generic.List <CooperationMessageRecord> records, int total)
        {
            string projectid = records[0].project_id;
            long   staffUid;

            if (records[0].from_uid != this.sessionService.Uid)
            {
                staffUid = records[0].from_uid;
            }
            else
            {
                staffUid = records[0].to_uid;
            }
            Message[]    messages = new Message[records.Count];
            MessageStyle ms       = null;

            for (int i = 0; i < messages.Length; i++)
            {
                ms                     = this.CooperationMessageRecordProcessor(records, ms, i);
                messages[i]            = new Message();
                messages[i].FromJid    = records[i].from_uid + "@null/null";
                messages[i].CreateTime = records[i].createTime;
                messages[i].FileName   = records[i].fileName;
                messages[i].Icon       = records[i].icon;
                messages[i].Url        = records[i].url;
                messages[i].toUid      = records[i].to_uid;
                messages[i].ProjectId  = records[i].project_id;
                if (this.sessionService.Uid == records[i].to_uid)
                {
                    messages[i].ToJid = records[i].from_uid.ToString();
                }
                else
                {
                    messages[i].ToJid = records[i].to_uid.ToString();
                }
                messages[i].MessageBlocks = this.utilService.MessageDecode(records[i].message);
                messages[i].Style         = ms;
            }
            CoopStaffTab item = this.dataService.GetCooperationStaffChatTab(staffUid, projectid) as CoopStaffTab;

            if (item != null)
            {
                CoopStaffChatTabControl tab = item.TabContent;
                if (tab != null)
                {
                    tab.ChatComponent.AddCooperationStaffMessageRecords(messages, total);
                }
            }
        }
コード例 #27
0
        private static void LoadImage(MessageStyle style, string butlerFolder)
        {
            string       file  = Path.Combine(butlerFolder, style.BackgroundFile);
            BitmapSource image = BitmapUtil.ToBitmapSource(LoadImage(file));

            style.Background = new ImageBrush(image);

            if (style.Width == 0)
            {
                style.Width = image.Width;
            }

            if (style.Height == 0)
            {
                style.Height = image.Height;
            }
        }
コード例 #28
0
        public static void Draw(InfoMessage infoMessage, float width)
        {
            Color color = GUI.color;

            if (DGUI.FadeOut.Begin(infoMessage.Show.faded, false))
            {
                Color headerIconAndTextColor = HeaderIconAndTextColor(infoMessage).WithAlpha(GUI.color.a);
                var   titleContent           = new GUIContent(string.IsNullOrEmpty(infoMessage.Title) ? GetTitleText(infoMessage.Type) : infoMessage.Title);
                var   messageContent         = new GUIContent(infoMessage.Message);
                float headerHeight           = HEADER_HEIGHT * infoMessage.Show.faded;
                float iconSize    = ICON_SIZE * infoMessage.Show.faded;
                float iconPadding = ICON_PADDING * infoMessage.Show.faded;

                GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                {
                    GUILayout.Space(TopVerticalSpace * infoMessage.Show.faded);
                    GUI.color = HeaderBackgroundColor(infoMessage).WithAlpha(GUI.color.a);
                    GUILayout.Label(GUIContent.none, Styles.GetStyle(Styles.StyleName.InfoMessageHeader), GUILayout.ExpandWidth(true), GUILayout.Height(headerHeight));
                    GUI.color = color;
                    GUILayout.Space(-headerHeight);
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.Height(headerHeight));
                    {
                        GUILayout.Space(iconPadding);
                        DGUI.Icon.Draw(infoMessage.Icon, iconSize, headerHeight, headerIconAndTextColor);
                        GUILayout.Space(iconPadding);
                        DGUI.Label.Draw(titleContent, DGUI.Colors.ColorTextOfGUIStyle(TitleStyle, headerIconAndTextColor), headerHeight);
                    }
                    GUILayout.EndHorizontal();

                    float messageContentHeight = MessageStyle.CalcHeight(messageContent, width);

                    GUI.color = BodyColor.WithAlpha(GUI.color.a);
                    GUILayout.Label(GUIContent.none, Styles.GetStyle(Styles.StyleName.InfoMessageMessage), GUILayout.ExpandWidth(true), GUILayout.Height(messageContentHeight));
                    GUILayout.Space(-messageContentHeight);
                    GUI.color = color.WithAlpha(GUI.color.a);
                    GUILayout.Label(messageContent, DGUI.Colors.ColorTextOfGUIStyle(MessageStyle, MessageTextColor(infoMessage).WithAlpha(GUI.color.a)), GUILayout.ExpandWidth(true));
                    GUILayout.Space(BottomVerticalSpace * infoMessage.Show.faded);
                }
                GUILayout.EndVertical();
            }

            DGUI.FadeOut.End(infoMessage.Show.faded, false, color.a);
            GUI.color = color;
        }
コード例 #29
0
 private void SetParagraphStyle(Paragraph para, MessageStyle style)
 {
     if (para != null && style != null)
     {
         try
         {
             para.FontSize = (double)this.ms.FontSizeList[style.FontSize];
         }
         catch (System.IndexOutOfRangeException e)
         {
             ServiceUtil.Instance.Logger.Error(e.ToString());
             style.FontSize = 1;
             para.FontSize  = 12.0;
         }
         try
         {
             para.FontFamily = new FontFamily(this.ms.FontFamilyList[style.FontFamily]);
         }
         catch (System.IndexOutOfRangeException e)
         {
             ServiceUtil.Instance.Logger.Error(e.ToString());
             style.FontFamily = 0;
             para.FontFamily  = new FontFamily(this.ms.FontFamilyList[0]);
         }
         if (style.Bold == 1)
         {
             para.FontWeight = FontWeights.Bold;
         }
         else
         {
             para.FontWeight = FontWeights.Normal;
         }
         if (style.Italic == 1)
         {
             para.FontStyle = FontStyles.Italic;
         }
         else
         {
             para.FontStyle = FontStyles.Normal;
         }
         para.Foreground = new SolidColorBrush(Color.FromArgb(255, style.FontColorR, style.FontColorG, style.FontColorB));
     }
 }
コード例 #30
0
ファイル: BatchTaskForm.cs プロジェクト: pxmarc/dp2
        private void BatchTaskForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.comboBox_taskName.Text = MainForm.AppInfo.GetString(
                "BatchTaskForm",
                "BatchTaskName",
                "");

            this.webBrowser_info.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_info_DocumentCompleted);


            // 使得菜单显示正确
            this.MessageStyle = this.MessageStyle;

            // 删除一些不需要的任务名
            for (int i = 0; i < this.comboBox_taskName.Items.Count; i++)
            {
                string strTaskName = this.comboBox_taskName.Items[i] as string;
                if (strTaskName.StartsWith("~"))
                {
                    this.comboBox_taskName.Items.RemoveAt(i);
                    i--;
                }
            }

            //
            API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
        }
コード例 #31
0
        /// <summary>
        /// Method to read price change notification
        /// </summary>
        /// <returns>Message</returns>
        public MessageStyle ReadPricheChangeNotificationHo()
        {
            MessageStyle msg = null;

            if (_policyManager.FUELPR_HO)
            {
                if (modGlobalFunctions.BoolFuelPriceApplied)
                {
                    WriteToLogFile("Fuel price change from HeadOffice: boolFuelPriceApplied is " + System.Convert.ToString(modGlobalFunctions.BoolFuelPriceApplied) + " counter was reset to 0.");
                }
                modGlobalFunctions.BoolFuelPriceApplied = false;
                if (_fuelPumpService.IsPriceChangeFromHo())
                {
                    var offSet = _policyManager.LoadStoreInfo().OffSet;
                    msg = _resourceManager.CreateMessage(offSet, 38, 71, null, _policyManager.FPR_USER ? MessageType.YesNoCancel : MessageType.YesNo);
                }
            }
            return(msg);
        }
コード例 #32
0
 private void SetParagraphStyle(Paragraph para, MessageStyle style)
 {
     if (para != null && style != null)
     {
         try
         {
             para.FontSize = (double)this.ms.FontSizeList[style.FontSize];
         }
         catch (System.IndexOutOfRangeException)
         {
             style.FontSize = 1;
             para.FontSize  = 12.0;
         }
         try
         {
             para.FontFamily = new System.Windows.Media.FontFamily(this.ms.FontFamilyList[style.FontFamily]);
         }
         catch (System.IndexOutOfRangeException)
         {
             style.FontFamily = 0;
             para.FontFamily  = new System.Windows.Media.FontFamily(this.ms.FontFamilyList[0]);
         }
         if (style.Bold == 1)
         {
             para.FontWeight = FontWeights.Bold;
         }
         else
         {
             para.FontWeight = FontWeights.Normal;
         }
         if (style.Italic == 1)
         {
             para.FontStyle = FontStyles.Italic;
         }
         else
         {
             para.FontStyle = FontStyles.Normal;
         }
         para.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, style.FontColorR, style.FontColorG, style.FontColorB));
     }
 }
コード例 #33
0
        private MessageStyle GroupMessageRecordProcessor(System.Collections.Generic.List <GroupMessageRecord> records, MessageStyle ms, int i)
        {
            switch (records[i].type)
            {
            case 0:
                ms = new MessageStyle(records[i].style);
                break;

            case 2:
                records[i].message = "[{T:" + records[i].message + "}]";
                ms = this.SetRedColorStyle(records, ms, i);
                break;

            case 3:
                if (records[i].from_uid == this.sessionService.Uid)
                {
                    records[i].message = "[{T:" + records[i].message + "}]";
                }
                ms = this.SetRedColorStyle(records, ms, i);
                break;

            case 4:
                records[i].message = "[{T:" + records[i].message + "}]";
                ms = this.SetRedColorStyle(records, ms, i);
                break;

            case 5:
                records[i].message = "[{T:" + records[i].message + "}]";
                ms = this.SetRedColorStyle(records, ms, i);
                break;

            case 6:
                if (records[i].from_uid == this.sessionService.Uid)
                {
                    records[i].message = "[{T:" + records[i].message + "}]";
                }
                ms = this.SetRedColorStyle(records, ms, i);
                break;
            }
            return(ms);
        }
コード例 #34
0
        public string IconToBase64(Icon icon)
        {
            string str = string.Empty;
            string result;

            if (icon == null)
            {
                result = str;
            }
            else
            {
                Bitmap bitmap             = null;
                System.IO.MemoryStream ms = null;
                try
                {
                    ms     = new System.IO.MemoryStream();
                    bitmap = icon.ToBitmap();
                    bitmap.Save(ms, ImageFormat.Png);
                    byte[] array = new byte[ms.Length];
                    ms.Position = 0L;
                    ms.Read(array, 0, (int)ms.Length);
                    str = System.Convert.ToBase64String(array);
                }
                finally
                {
                    if (ms != null)
                    {
                        ms.Dispose();
                    }
                    if (bitmap != null)
                    {
                        bitmap.Dispose();
                    }
                }
                result = str;
            }
            return(result);
        }
コード例 #35
0
        public MessageStyle CooperationMessageRecordProcessor(System.Collections.Generic.List <CooperationMessageRecord> records, MessageStyle ms, int i)
        {
            switch (records[i].type)
            {
            case 0:
                ms = new MessageStyle(records[i].style);
                break;

            case 1:
                ms = new MessageStyle(records[i].style);
                break;

            case 2:
                ms = this.CooperationStaffEndFileDownloadMessageRecord(records, ms, i);
                break;

            case 3:
                ms = this.CooperationStaffErrorFileUpLoadMessageRecord(records, ms, i);
                break;

            case 4:
                ms = this.CooperationStaffErrorFileDownloadMessageRecord(records, ms, i);
                break;

            case 5:
                ms = this.CooperationStaffReJectFileDownloadMessagRecord(records, ms, i);
                break;

            case 6:
                ms = this.CooperationStaffEndFileUpLoadMessageRecord(records, ms, i);
                break;
            }
            if (records[i].type == 0)
            {
                ms = new MessageStyle(records[i].style);
            }
            return(ms);
        }
コード例 #36
0
ファイル: Console.cs プロジェクト: nagyistoce/SharpJS
            /// <summary>
            /// Logs a message to the console.
            /// </summary>
            /// <param name="style"> A style which influences the icon and text color. </param>
            /// <param name="objects"> The objects to output to the console. These can be strings or
            /// ObjectInstances. </param>
            public void Log(MessageStyle style, object[] objects)
            {
                // Convert the objects to a string.
                var message = new System.Text.StringBuilder();
                if (Prefix != null && Prefix.Length > 0) {
                    message.Append(Prefix);
                    message.Append(' ');
                }
                for (int i = 0; i < objects.Length; i++) {
                    if (i > 0)
                        message.Append(' ');
                    message.Append(TypeConverter.ToString(objects[i]));
                }

                // Allow event handlers to override default behaviour
                if (DoLog != null) {
                    DoLog(this, new LogEventArgs(style, message.ToString()));
                    return;
                }

                #if !SILVERLIGHT
                var original = System.Console.ForegroundColor;
                switch (style) {
                    case MessageStyle.Information:
                        System.Console.ForegroundColor = ConsoleColor.White;
                        break;
                    case MessageStyle.Warning:
                        System.Console.ForegroundColor = ConsoleColor.Yellow;
                        break;
                    case MessageStyle.Error:
                        System.Console.ForegroundColor = ConsoleColor.Red;
                        break;
                }
                #endif

                // Output the message to the console.
                System.Console.WriteLine(message.ToString());

                #if !SILVERLIGHT
                if (style != MessageStyle.Regular)
                    System.Console.ForegroundColor = original;
                #endif
            }
コード例 #37
0
 private void RosterMessageEvent(RosterMessage response)
 {
     try
     {
         if (response != null)
         {
             Message msg = new Message();
             MessageStyle ms = new MessageStyle(response.style);
             msg.CreateTime = response.date;
             msg.FromJid = response.fromJID;
             msg.MessageBlocks = this.utilService.MessageDecode(response.message);
             msg.Style = ms;
             msg.VOType = response.type;
             msg.MessageObjectType = MessageActorType.Roster;
             if (this.IsNotifyFlashing(msg))
             {
                 NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.Roster);
                 NotifyIconUtil.Instance.StartFlashing();
                 this.dataModel.AddMessage((long)((ulong)Jid.GetUid(msg.FromJid)), MessageActorType.Roster, msg);
                 if (this.IsAddMessageBox())
                 {
                     MessageBoxWindow mbw = this.dataModel.GetMessageBox();
                     if (mbw == null)
                     {
                         mbw = new MessageBoxWindow();
                         this.dataModel.SetMessageBox(mbw);
                     }
                     mbw.Refresh();
                     mbw.Show();
                 }
             }
             else
             {
                 this.RosterAddMessage(msg);
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine(ex.ToString());
     }
 }
コード例 #38
0
 private void SetParagraphStyle(Paragraph para, MessageStyle style)
 {
     if (para != null && style != null)
     {
         try
         {
             para.FontSize = (double)this.ms.FontSizeList[style.FontSize];
         }
         catch (System.IndexOutOfRangeException)
         {
             style.FontSize = 1;
             para.FontSize = 12.0;
         }
         try
         {
             para.FontFamily = new System.Windows.Media.FontFamily(this.ms.FontFamilyList[style.FontFamily]);
         }
         catch (System.IndexOutOfRangeException)
         {
             style.FontFamily = 0;
             para.FontFamily = new System.Windows.Media.FontFamily(this.ms.FontFamilyList[0]);
         }
         if (style.Bold == 1)
         {
             para.FontWeight = FontWeights.Bold;
         }
         else
         {
             para.FontWeight = FontWeights.Normal;
         }
         if (style.Italic == 1)
         {
             para.FontStyle = FontStyles.Italic;
         }
         else
         {
             para.FontStyle = FontStyles.Normal;
         }
         para.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, style.FontColorR, style.FontColorG, style.FontColorB));
     }
 }
コード例 #39
0
 public string IconToBase64(Icon icon)
 {
     string str = string.Empty;
     string result;
     if (icon == null)
     {
         result = str;
     }
     else
     {
         Bitmap bitmap = null;
         System.IO.MemoryStream ms = null;
         try
         {
             ms = new System.IO.MemoryStream();
             bitmap = icon.ToBitmap();
             bitmap.Save(ms, ImageFormat.Png);
             byte[] array = new byte[ms.Length];
             ms.Position = 0L;
             ms.Read(array, 0, (int)ms.Length);
             str = System.Convert.ToBase64String(array);
         }
         finally
         {
             if (ms != null)
             {
                 ms.Dispose();
             }
             if (bitmap != null)
             {
                 bitmap.Dispose();
             }
         }
         result = str;
     }
     return result;
 }
コード例 #40
0
		private void DisplayMessage(string title, string detail, MessageStyle iconStyle)
		{
			pnlMsgContainer.Controls.Clear();
			GalleryServerPro.Web.Controls.usermessage msgBox = (GalleryServerPro.Web.Controls.usermessage)Page.LoadControl(Util.GetUrl("/controls/usermessage.ascx"));
			msgBox.IconStyle = iconStyle;
			msgBox.MessageTitle = title;
			msgBox.MessageDetail = detail;
			msgBox.CssClass = "um3ContainerCss gsp_rounded10 gsp_floatcontainer";
			msgBox.HeaderCssClass = "um1HeaderCss";
			msgBox.DetailCssClass = "um1DetailCss";
			pnlMsgContainer.Controls.Add(msgBox);
			pnlMsgContainer.Visible = true;
		}
コード例 #41
0
ファイル: GeneratorAdds.cs プロジェクト: xueliu/MSC_Generator
 public InterpretResult addMessageLineBeginn(uint fileLine, string identifier, uint line, int source, int destination, MessageStyle style)
 {
     IEnumerator enumerator = lines.GetEnumerator();
     for(uint i=0;i<lines.Count;i++){
         enumerator.MoveNext();
         if ( enumerator.Current is MessageLine)
             if((((MessageLine) enumerator.Current).LineEnd==0)&&(((MessageLine) enumerator.Current).Identifier == identifier)) return InterpretResult.LineAllreadyExists;
     }
     lines.Add(new MessageLine(identifier,line+1, source, destination, style));
     return InterpretResult.Ok;
 }
コード例 #42
0
ファイル: BatchTaskForm.cs プロジェクト: renyh1013/dp2
 private void ToolStripMenuItem_result_Click(object sender, EventArgs e)
 {
     if ((this.MessageStyle & MessageStyle.Result) != 0)
         this.MessageStyle -= MessageStyle.Result;
     else
         this.MessageStyle |= MessageStyle.Result;
 }
コード例 #43
0
 private void EntMessageEvent(MessageResponse response)
 {
     try
     {
         if (response != null)
         {
             if (response.type != 3 && response.type != 6)
             {
                 Message msg = new Message();
                 MessageStyle ms = new MessageStyle(response.style);
                 msg.CreateTime = response.date;
                 msg.FromJid = response.from_jid;
                 msg.MessageBlocks = this.utilService.MessageDecode(response.message);
                 msg.MessageString = response.message;
                 msg.Style = ms;
                 msg.VOType = response.type;
                 msg.MessageObjectType = MessageActorType.EntStaff;
                 this.AutoReplyProcessor(msg);
                 if (this.IsNotifyFlashing(msg))
                 {
                     NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.EntStaff);
                     NotifyIconUtil.Instance.StartFlashing();
                     this.dataModel.AddMessage((long)((ulong)Jid.GetUid(msg.FromJid)), MessageActorType.EntStaff, msg);
                     if (this.IsAddMessageBox())
                     {
                         MessageBoxWindow mbw = this.dataModel.GetMessageBox();
                         if (mbw == null)
                         {
                             mbw = new MessageBoxWindow();
                             this.dataModel.SetMessageBox(mbw);
                         }
                         mbw.Refresh();
                         mbw.Show();
                     }
                 }
                 else
                 {
                     this.StaffAddMessage(msg);
                 }
                 INWindow inWindow = this.dataService.INWindow as INWindow;
                 if (inWindow != null)
                 {
                     inWindow.Employee.RecentLinkListItem.AddRecentLink(RecentLinkType.EntStaffChat, (long)((ulong)Jid.GetUid(msg.FromJid)));
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine(ex.ToString());
     }
 }
コード例 #44
0
        private void PostMessage(Message message, MessageStyle style, ChatControlBackEnd engine)
        {
            if (style == MessageStyle.Notify && !ChatSettings.Instance.ShowNotifications)
            {
                return;
            }
            var nickName = "";
            var user     = AllUsers.Instance.GetUser(message.Sender);

            if (user != null)
            {
                nickName = user.NickName + ": ";
                style    = MessageStyle.Others;
            }
            if (message.Sender == ChatSettings.Instance.Id) // detect own
            {
                style = MessageStyle.Mine;
            }
            else // detect owner
            {
                var room = engine.GetActiveRooms().Find(r => r.Name == message.Room);
                if (room != null && message.Sender == room.Owner)
                {
                    style = MessageStyle.Owner;
                }
            }
            var text   = "[" + message.TimeStamp.ToString(ChatSettings.Instance.DateTimeFormat) + "] " + nickName + message.Text;
            var length = allMessagesRichTextBox.TextLength;

            allMessagesRichTextBox.AppendText(text + Environment.NewLine);
            if (style == MessageStyle.None)
            {
                return;
            }
            allMessagesRichTextBox.SelectionStart  = length;
            allMessagesRichTextBox.SelectionLength = text.Length;
            switch (style)
            {
            case MessageStyle.Mine:
                allMessagesRichTextBox.SelectionColor = ChatSettings.Instance.OwnColor;
                allMessagesRichTextBox.SelectionFont  = ChatSettings.Instance.OwnFont;
                break;

            case MessageStyle.Owner:
                allMessagesRichTextBox.SelectionColor = ChatSettings.Instance.OwnerColor;
                allMessagesRichTextBox.SelectionFont  = ChatSettings.Instance.OwnerFont;
                break;

            case MessageStyle.Others:
                allMessagesRichTextBox.SelectionColor = ChatSettings.Instance.OthersColor;
                allMessagesRichTextBox.SelectionFont  = ChatSettings.Instance.OthersFont;
                break;

            case MessageStyle.Error:
                allMessagesRichTextBox.SelectionColor = Color.DarkRed;
                allMessagesRichTextBox.SelectionFont  = Font;
                break;

            case MessageStyle.Notify:
                allMessagesRichTextBox.SelectionColor = Color.Gray;
                allMessagesRichTextBox.SelectionFont  = Font;
                break;
            }
            allMessagesRichTextBox.SelectionStart = allMessagesRichTextBox.TextLength;
            allMessagesRichTextBox.ScrollToCaret();
        }
コード例 #45
0
ファイル: BatchTaskForm.cs プロジェクト: renyh1013/dp2
 private void ToolStripMenuItem_progress_Click(object sender, EventArgs e)
 {
     if ((this.MessageStyle & MessageStyle.Progress) != 0)
         this.MessageStyle -= MessageStyle.Progress;
     else
         this.MessageStyle |= MessageStyle.Progress;
 }
コード例 #46
0
 private void PostMessage(Message message, MessageStyle style, ChatControlBackEnd engine)
 {
     if (style == MessageStyle.Notify && !ChatSettings.Instance.ShowNotifications)
         return;
     var nickName = "";
     var user = AllUsers.Instance.GetUser(message.Sender);
     if (user != null)
     {
         nickName = user.NickName + ": ";
         style = MessageStyle.Others;
     }
     if (message.Sender == ChatSettings.Instance.Id) // detect own
         style = MessageStyle.Mine;
     else // detect owner
     {
         var room = engine.GetActiveRooms().Find(r => r.Name == message.Room);
         if (room != null && message.Sender == room.Owner)
             style = MessageStyle.Owner;
     }
     var text = "[" + message.TimeStamp.ToString(ChatSettings.Instance.DateTimeFormat) + "] " + nickName + message.Text;
     var length = allMessagesRichTextBox.TextLength;
     allMessagesRichTextBox.AppendText(text + Environment.NewLine);
     if (style == MessageStyle.None)
         return;
     allMessagesRichTextBox.SelectionStart = length;
     allMessagesRichTextBox.SelectionLength = text.Length;
     switch (style)
     {
         case MessageStyle.Mine:
             allMessagesRichTextBox.SelectionColor = ChatSettings.Instance.OwnColor;
             allMessagesRichTextBox.SelectionFont = ChatSettings.Instance.OwnFont;
             break;
         case MessageStyle.Owner:
             allMessagesRichTextBox.SelectionColor = ChatSettings.Instance.OwnerColor;
             allMessagesRichTextBox.SelectionFont = ChatSettings.Instance.OwnerFont;
             break;
         case MessageStyle.Others:
             allMessagesRichTextBox.SelectionColor = ChatSettings.Instance.OthersColor;
             allMessagesRichTextBox.SelectionFont = ChatSettings.Instance.OthersFont;
             break;
         case MessageStyle.Error:
             allMessagesRichTextBox.SelectionColor = Color.DarkRed;
             allMessagesRichTextBox.SelectionFont = Font;
             break;
         case MessageStyle.Notify:
             allMessagesRichTextBox.SelectionColor = Color.Gray;
             allMessagesRichTextBox.SelectionFont = Font;
             break;
     }
     allMessagesRichTextBox.SelectionStart = allMessagesRichTextBox.TextLength;
     allMessagesRichTextBox.ScrollToCaret();
 }
コード例 #47
0
ファイル: ProlificLEDBadge.cs プロジェクト: dcolli/badgeup
        /// <summary>
        /// Creates the message byte pattern expected by the Prolific LED Badge
        /// </summary>
        /// <param name="msg">A string containing the message, must be less/== 250 chars</param>
        /// <param name="msgId">An int identifying which message this is</param>
        /// <param name="msgStyle">A MessageStyle value (hold, snowing, etc)</param>
        /// <param name="msgSpeed">A MessageSpeed (one through five)</param>
        /// <returns>Message byte array</returns>
        private byte[] CreateMessageBytePattern(string msg, int msgId, MessageStyle msgStyle, MessageSpeed msgSpeed)
        {
            //Get the message offsets to use
            MessageOffsetFirst offset1  = MessageOffsetFirst.One;
            MessageOffsetSecond offset2 = MessageOffsetSecond.One;
            switch(msgId)
            {
                case 0:
                    offset1 = MessageOffsetFirst.One;
                    offset2 = MessageOffsetSecond.One;
                    break;
                case 1:
                    offset1 = MessageOffsetFirst.Two;
                    offset2 = MessageOffsetSecond.Two;
                    break;
                case 2:
                    offset1 = MessageOffsetFirst.Three;
                    offset2 = MessageOffsetSecond.Three;
                    break;
                case 3:
                    offset1 = MessageOffsetFirst.Four;
                    offset2 = MessageOffsetSecond.Four;
                    break;
                case 4:
                    offset1 = MessageOffsetFirst.Five;
                    offset2 = MessageOffsetSecond.Five;
                    break;
                case 5:
                    offset1 = MessageOffsetFirst.Six;
                    offset2 = MessageOffsetSecond.Six;
                    break;
            }

            //ensure length is within bounds
            if(msg.Length > MaxLength)
                msg = msg.Substring(0, MaxLength);

            //Assuming English and using ASCIIEncoding
            byte[] msgBytes = ASCIIEncoding.ASCII.GetBytes(msg);
            byte msgLength  = Convert.ToByte(msgBytes.Length);

            //Initialize data and looping counters
            byte[] msgData;
            int msgBytesRead = 0;
            byte messageBatch = 0x00;
            using (MemoryStream ms = new MemoryStream())
            {
                //Build the 4 message groups
                for (int group = 0; group < 4; group++)
                {
                    //checksum for each group
                    //calculated by: (control bits - 0x02 + data) % 0x100
                    uint checksum = 0;

                    switch (group)
                    {
                        case 0:

                            ms.WriteByte(ControlByteOne);
                            ms.WriteByte(ControlByteTwo);
                            ms.WriteByte((byte)offset1);
                            ms.WriteByte(messageBatch);
                            ms.WriteByte((byte)msgSpeed);
                            ms.WriteByte((byte)offset2);
                            ms.WriteByte((byte)msgStyle);
                            ms.WriteByte(msgLength);
                            checksum += (uint)(ControlByteTwo + (byte)offset1 + messageBatch + (byte)msgSpeed + (byte)offset2 + (byte)msgStyle + msgLength);
                            //write data for this message - only 60 chars/bytes because of control bytes
                            for (int m = 0; m < 60; m++)
                            {
                                //write message data
                                if (msgBytesRead < msgBytes.Length)
                                {
                                    byte current = msgBytes[msgBytesRead];
                                    ms.WriteByte(current);
                                    checksum += (uint)current;

                                    msgBytesRead++;
                                }
                                else
                                {
                                    ms.WriteByte(PaddingByte);
                                }
                            }
                            ms.WriteByte((byte)(checksum % 256));
                            break;
                        case 1:
                        case 2:
                            ms.WriteByte(ControlByteOne);
                            ms.WriteByte(ControlByteTwo);
                            ms.WriteByte((byte)offset1);
                            ms.WriteByte(messageBatch);
                            checksum += (uint)(ControlByteTwo + (byte)offset1 + messageBatch);
                            //write data for this message - 64 chars/bytes since no extra control bits
                            for (int m = 0; m < 64; m++)
                            {
                                //write message data
                                if (msgBytesRead < msgBytes.Length)
                                {
                                    byte current = msgBytes[msgBytesRead];
                                    ms.WriteByte(current);
                                    checksum += (uint)current;

                                    msgBytesRead++;
                                }
                                else
                                {
                                    ms.WriteByte(PaddingByte);
                                }
                            }
                            ms.WriteByte((byte)(checksum % 256));
                            break;
                        case 3:
                            ms.WriteByte(ControlByteOne);
                            ms.WriteByte(ControlByteTwo);
                            ms.WriteByte((byte)offset1);
                            ms.WriteByte(messageBatch);
                            checksum += (uint)(ControlByteTwo + (byte)offset1 + messageBatch);
                            //write data for this message - 62 chars/bytes
                            for (int m = 0; m < 62; m++)
                            {
                                //write message data
                                if (msgBytesRead < msgBytes.Length)
                                {
                                    byte current = msgBytes[msgBytesRead];
                                    ms.WriteByte(current);
                                    checksum += (uint)current;

                                    msgBytesRead++;
                                }
                                else
                                {
                                    ms.WriteByte(PaddingByte);
                                }
                            }
                            ms.WriteByte(PaddingByte);
                            ms.WriteByte(PaddingByte);
                            ms.WriteByte((byte)(checksum % 256));
                            break;
                    }
                    messageBatch += 0x40;
                }

                msgData = ms.ToArray();
            }

            return msgData;
        }
コード例 #48
0
 public void AddMessage(Message message, ChatControlBackEnd engine, MessageStyle style = MessageStyle.None)
 {
     messageHistory.Add(new Cortege2<Message, MessageStyle>(message, style));
     PostMessage(message, style, engine);
 }
コード例 #49
0
ファイル: Console.cs プロジェクト: nagyistoce/SharpJS
 public LogEventArgs(MessageStyle style, string message)
 {
     Style = style;
     Message = message;
 }
コード例 #50
0
ファイル: ConFetti.cs プロジェクト: Bloodfly/HelloWorld
        /// <summary>
        /// Prints a message to the console with a predefined style.
        /// </summary>
        /// <param name="message">The text to be stylized before printing.</param>
        /// <param name="accents">Flag determining if we should have special characters in front of our message.</param>
        /// <param name="timestamp">Flag determining whether a timestamp should be included with the message.</param>
        /// <param name="line">Flag determining if the entire message line should be stylized or not.</param>
        /// <param name="style">The style or color choice for the message we are printing.</param>
        public static void Print(string message, bool accents = true, bool timestamp = false, bool line = false, MessageStyle style = MessageStyle.None)
        {
            switch (style)
            {
            case MessageStyle.General:
                if (line)
                {
                    Console.ForegroundColor = ConsoleColor.Gray;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.WriteLine("[-]: " + message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.Write("[");
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.Write("-");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("]: ");
                    }
                    Console.WriteLine(message);
                }
                break;

            case MessageStyle.Notice:
                if (line)
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.WriteLine("[*]: " + message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.Write("[");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.Write("*");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("]: ");
                    }
                    Console.WriteLine(message);
                }
                break;

            case MessageStyle.Success:
                if (line)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.WriteLine("[+]: " + message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.Write("[");
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.Write("+");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("]: ");
                    }
                    Console.WriteLine(message);
                }
                break;

            case MessageStyle.Warning:
                if (line)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.WriteLine("[!]: " + message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.Write("[");
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.Write("!");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("]: ");
                    }
                    Console.WriteLine(message);
                }
                break;

            case MessageStyle.Error:
                if (line)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.WriteLine("[x]: " + message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    if (timestamp)
                    {
                        Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                    }
                    if (accents)
                    {
                        Console.Write("[");
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("x");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("]: ");
                    }
                    Console.WriteLine(message);
                }
                break;

            case MessageStyle.None:
                Console.ForegroundColor = ConsoleColor.White;
                if (timestamp)
                {
                    Console.Write(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " ");
                }
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(message);
                break;
            }
        }
コード例 #51
0
ファイル: GeneratorAdds.cs プロジェクト: xueliu/MSC_Generator
 public InterpretResult addMessageBeginn(uint fileLine, string identifier, int source, int destination, uint line, string name, MessageStyle style)
 {
     if (source >= processes.Count)
         return InterpretResult.InstanceNotFound;
     if (destination >= processes.Count)
         return InterpretResult.InstanceNotFound;
     items.Add(new MessageBegin(fileLine, identifier,name, line, source, destination, style));
     return addMessageLineBeginn(fileLine, identifier, line, source,destination,style);
 }
コード例 #52
0
 private void CooperationStaffMessageEvent(CooperationMessageResponse response)
 {
     try
     {
         if (response != null)
         {
             if (response.type != 3 && response.type != 6)
             {
                 Message msg = new Message();
                 MessageStyle ms = new MessageStyle(response.style);
                 msg.CreateTime = response.date;
                 msg.FromJid = response.from_jid;
                 msg.ProjectId = response.project_id;
                 msg.MessageBlocks = this.utilService.MessageDecode(response.message);
                 msg.MessageString = response.message;
                 msg.Style = ms;
                 msg.VOType = response.type;
                 msg.MessageObjectType = MessageActorType.CooperationStaff;
                 this.AutoReplyCooperationMessageProcessor(msg);
                 if (this.IsNotifyFlashing(msg))
                 {
                     NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.EntStaff);
                     NotifyIconUtil.Instance.StartFlashing();
                     this.dataModel.AddCooperationStatffMessage((long)((ulong)Jid.GetUid(msg.FromJid)), msg.ProjectId, MessageActorType.CooperationStaff, msg);
                     if (this.IsAddMessageBox())
                     {
                         MessageBoxWindow mbw = this.dataModel.GetMessageBox();
                         if (mbw == null)
                         {
                             mbw = new MessageBoxWindow();
                             this.dataModel.SetMessageBox(mbw);
                         }
                         mbw.Refresh();
                         mbw.Show();
                     }
                 }
                 else
                 {
                     this.CooperationStaffAddMessage(msg);
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine(ex.ToString());
     }
 }
コード例 #53
0
ファイル: GeneratorAdds.cs プロジェクト: xueliu/MSC_Generator
 public InterpretResult AddMessage(uint fileLine, string sourceName, string destinationName, uint line, string name, MessageStyle style)
 {
     Process process;
     IEnumerator enumerator = processes.GetEnumerator();
     int source=-1, destination=-1;
     if(sourceName==ENV_LEFT_STRING){
         source = ENV_LEFT;
     }
     if(sourceName==ENV_RIGHT_STRING){
         source = ENV_RIGHT;
     }
     if(destinationName==ENV_LEFT_STRING){
         destination = ENV_LEFT;
     }
     if(destinationName==ENV_RIGHT_STRING){
         destination = ENV_RIGHT;
     }
     for(int i=0;i<processes.Count;i++){
         enumerator.MoveNext();
         process = (Process) enumerator.Current;
         if(process.ProcessName == sourceName){
             source=i;
         }
         if(process.ProcessName == destinationName){
             destination=i;
         }
     }
     if((source != -1)&&(destination != -1)){
         items.Add(new mscElements.Message(fileLine, name, line,source,destination, style));
         mLines = Math.Max(mLines, line);
         return InterpretResult.Ok;
     }
     else
         return InterpretResult.InstanceNotFound;
 }
コード例 #54
0
ファイル: Message.cs プロジェクト: kg/rlms2013
 public Message(Game game, string text, MessageStyle style)
     : this(game, new string[] { text }, style)
 {
 }
コード例 #55
0
 public void AddMessage(Message message, ChatControlBackEnd engine, MessageStyle style = MessageStyle.None)
 {
     messageHistory.Add(new Cortege2 <Message, MessageStyle>(message, style));
     PostMessage(message, style, engine);
 }
コード例 #56
0
ファイル: Message.xaml.cs プロジェクト: MaksHDR/xvid4psp
        //Выводим инфу в окно
        private void SetUpWindow(string text, string info, string title, MessageStyle style)
        {
            this.Title = title;
            text_message.Text = text;
            if (!string.IsNullOrEmpty(info))
            {
                text_info.Text = info;
                btInfo.Visibility = Visibility.Visible;
            }

            mstyle = style;
            if (mstyle == MessageStyle.Ok)
            {
                btYes.Visibility = Visibility.Hidden;
                btNo.Content = Languages.Translate("OK");
            }
            else if (mstyle == MessageStyle.YesNo)
            {
                btYes.Content = Languages.Translate("Yes");
                btNo.Content = Languages.Translate("No");
            }
            else if (mstyle == MessageStyle.OkCancel)
            {
                btYes.Content = Languages.Translate("OK");
                btNo.Content = Languages.Translate("Cancel");
            }
            else
            {
                btYes.Visibility = Visibility.Hidden;
                btNo.Content = Languages.Translate("OK");
            }

            cm_copy.Header = Languages.Translate("Copy");
            ShowDialog();
        }
コード例 #57
0
ファイル: Message.xaml.cs プロジェクト: MaksHDR/xvid4psp
 public void ShowMessage(string text, MessageStyle style)
 {
     SetUpWindow(text, null, "Message", style);
 }
コード例 #58
0
ファイル: Message.xaml.cs プロジェクト: MaksHDR/xvid4psp
 public void ShowMessage(string text, string info, string title, MessageStyle style)
 {
     SetUpWindow(text, info, title, style);
 }
コード例 #59
0
ファイル: BatchTaskForm.cs プロジェクト: renyh1013/dp2
        private void BatchTaskForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.comboBox_taskName.Text = MainForm.AppInfo.GetString(
"BatchTaskForm",
"BatchTaskName",
    "");

            this.webBrowser_info.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_info_DocumentCompleted);


            // 使得菜单显示正确
            this.MessageStyle = this.MessageStyle;

            // 
            API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
        }
コード例 #60
0
 private void EntGroupMessageEvent(GroupMessageResponse response)
 {
     try
     {
         if (response != null && response.from_jid != this.sessionService.Jid && response.type == 0)
         {
             Message msg = new Message();
             MessageStyle ms = new MessageStyle(response.style);
             msg.CreateTime = response.date;
             msg.FromJid = response.from_jid;
             msg.MessageBlocks = this.utilService.MessageDecode(response.message);
             msg.Gid = response.gid;
             msg.Style = ms;
             msg.MessageObjectType = MessageActorType.EntGroup;
             if (this.IsNotifyFlashing(msg))
             {
                 if (this.IsShieldMessage(msg))
                 {
                     INWindow inWindow = this.dataService.INWindow as INWindow;
                     if (inWindow != null)
                     {
                         ItemGroup group = inWindow.Employee.listEntGroup.FindItemGroup(msg.Gid);
                         if (group != null)
                         {
                             group.AddMessageCache(msg);
                             group.UpdateShieldCount();
                         }
                     }
                 }
                 else
                 {
                     NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.EntGroup);
                     NotifyIconUtil.Instance.StartFlashing();
                     this.dataModel.AddMessage(msg.Gid, MessageActorType.EntGroup, msg);
                     if (this.IsAddMessageBox())
                     {
                         MessageBoxWindow mbw = this.dataModel.GetMessageBox();
                         if (mbw == null)
                         {
                             mbw = new MessageBoxWindow();
                             this.dataModel.SetMessageBox(mbw);
                         }
                         mbw.Refresh();
                         mbw.Show();
                     }
                 }
             }
             else
             {
                 this.GroupAddMessage(msg);
             }
         }
     }
     catch (System.Exception ex)
     {
         ServiceUtil.Instance.Logger.Error(ex.ToString());
     }
 }