Beispiel #1
0
        /// <summary>
        /// Message-Display
        /// </summary>
        private void _DisplayMessage(string _Message, MessageType _Parameters, bool _NoTimestamp)
        {
            // stop Timer if needed
            if (_int_DelTimer.Enabled)
            {
                _int_DelTimer.Enabled = false;
            }
            // create Text for Label using StringBuilder
            StringBuilder _intMsg = new StringBuilder();

            // optional Timestamp
            if (_use_AddTimestamp && !_NoTimestamp)
            {
                _intMsg.Append(DateTime.Now.ToLongTimeString() + _str_AddTimestampSeparator);
            }
            // add message
            _intMsg.Append(_Message);

            // set LabelSettings
            LabelSettings _newSet = _FormatLabel(_Parameters); // get predefined LabelSettings

            _newSet.Text = _intMsg.ToString();                 // add text to object
            // FireEvent, DoEvents
            NewMessage(_newSet);
            System.Windows.Forms.Application.DoEvents();


            // if not static/attention and AutoDelete active, then start delete-timer
            if (_use_AutoDelete && (_Parameters != MessageType.Attention && _Parameters != MessageType.Static))
            {
                _int_DelTimer.Enabled = true;
            }
            // ToDo: create Attention-Code here
        }
Beispiel #2
0
 /// <summary>
 /// init a new instance
 /// </summary>
 public StatusMessages()
 {
     _int_LabelDefaults           = new LabelSettings();
     _int_LabelDefaults.Text      = "";
     _int_LabelDefaults.ForeColor = System.Drawing.Color.Black;
     _int_LabelDefaults.BackColor = System.Drawing.Color.Transparent;
     _int_LabelDefaults.Font      = new System.Drawing.Font("Tahoma", 10);
     _init_clsStatusMessage();
 }
Beispiel #3
0
    private void SplitCanvas(int numberOfSliders, int numberOfLabels)
    {
        // Find the size of the canvas
        //float heightOfCanvas = sliderCanvasTransform.sizeDelta.y;
        float height = labelCanvasTransform.rect.height / numberOfLabels;

        //float width = sliderCanvasTransform.rect.width / numberOfSliders;

        // Create labels
        for (int j = 0; j < numberOfLabels; j++)
        {
            GameObject    tmpLabel         = Instantiate(labelPrefab, labelCanvasTransform.transform) as GameObject;
            RectTransform tmpRectTransform = tmpLabel.GetComponent <RectTransform>();

            float x = 0;
            float y = 0;

            if (j != 0)
            {
                y = height * j;
            }

            tmpRectTransform.offsetMin = new Vector2(x, y);
            y = tmpRectTransform.offsetMin.y + height;
            tmpRectTransform.offsetMax = new Vector2(x, y - 100);
            tmpRectTransform.sizeDelta = new Vector2(140f, 30f);

            activeLabels.Add(tmpLabel);
            LabelSettings labelSettings = tmpLabel.GetComponent <LabelSettings>();
            labelSettings.UpdateIndex(j);
        }

        //// Update the sliders
        //for (int i = 0; i < numberOfSliders; i++)
        //{
        //    // Create a new Slider Item
        //    GameObject tmpSlider = Instantiate(sliderPrefab, sliderCanvasTransform.transform) as GameObject;

        //    RectTransform tmpRectTransform = tmpSlider.GetComponent<RectTransform>();

        //    float x = sliderCanvasTransform.rect.width / 2 + width * (i % numberOfSliders);
        //    float y = 0;

        //    tmpRectTransform.offsetMin = new Vector2(x, y);
        //    x = tmpRectTransform.offsetMin.x + width;
        //    tmpRectTransform.offsetMax = new Vector2(x - 1000, y);
        //    tmpRectTransform.sizeDelta = new Vector2(20f, 120f);

        //    // Add slider to list of active sliders
        //    this.activeSliders.Add(tmpSlider);
        //    SliderSettings sliderSettings = tmpSlider.GetComponent<SliderSettings>();
        //    sliderSettings.isMushra = false;
        //    sliderSettings.SetUpIndex(i);
        //}
    }
Beispiel #4
0
        private void tileSaveLabelSettings_Click(object sender, EventArgs e)
        {
            int variableContentsCount = rjDevice.GetVariableContentsCount();

            if (variableContentsCount <= 0)
            {
                MessageBox.Show("Brak wczytanej etykiety!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Information);
                UpdateCheckList(EventType.SETLABEL, false);
                return;
            }

            if (rjDevice.GetDatabaseMaxRecords() <= 0)
            {
                MessageBox.Show("Nie można zapisać danych jeżeli nie ma wczytanej bazy danych!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Information);
                UpdateCheckList(EventType.LOADEDDATABASE, false);
                return;
            }

            Stream         file;
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.InitialDirectory = labelSettingsPath;
            saveFileDialog.Filter           = "Label settings files (*.xml)|*.xml";
            saveFileDialog.FilterIndex      = 2;
            saveFileDialog.RestoreDirectory = true;

            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if ((file = saveFileDialog.OpenFile()) != null)
            {
                try
                {
                    LabelSettings labelSettings = new LabelSettings();
                    labelSettings.Save(file, txtFileName.Text, cmbJobFiles.Text, rjDevice.GetDTOLabelSettings());

                    txtLabelSettings.Text = saveFileDialog.FileName;
                    UpdateCheckList(EventType.SETLABEL, true);

                    DisplayLogsAndErrors("Ustawienia etykiety - zapis: " + txtLabelSettings.Text, null, null);
                }
                catch (Exception ex)
                {
                    string info = "Błąd podczas zapisu ustawień etykiety. Spróbuj ponownie! ";
                    MessageBox.Show(info, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    DisplayLogsAndErrors("Zapis ustawień etykiety", null, ex.ToString());
                    UpdateCheckList(EventType.SETLABEL, false);

                    AppLogger.GetLogger().Error("Błąd zapisu ustawień etykiety.", ex);
                }
            }
        }
        private void btnSaveLabelSettings_Click(object sender, EventArgs e)
        {
            LabelSettings labelSettings = new LabelSettings();

            labelSettings.LoginExampleInstanceUrl = txtLabelLoginExampleInstanceUrl.Text;
            labelSettings.Title = txtTitle.Text;

            Option.SaveLabelSettings(labelSettings);

            MessageBox.Show(UserInterfaceStrings.LabelSettingsChanged, UserInterfaceStrings.Settings, MessageBoxButtons.OK);
        }
Beispiel #6
0
        /// <summary>
        /// Worker for the Delete-Timer
        /// </summary>
        private void onDeleteTimer(Object sender, ElapsedEventArgs e)
        {
            // stop delete-timer
            _int_DelTimer.Enabled = false;
            // set LabelSettings
            LabelSettings _newSet = _FormatLabel(MessageType.Static); // get predefined LabelSettings

            // FireEvent, DoEvents
            NewMessage(_newSet);
            System.Windows.Forms.Application.DoEvents();
        }
        public static void SaveLabelSettings(LabelSettings settings)
        {
            if (Optiondb.LabelSettings.Count == 0)
            {
                Optiondb.LabelSettings.AddLabelSettingsRow(Optiondb.LabelSettings.NewLabelSettingsRow());
            }
            DataSet_Config.LabelSettingsRow row = Optiondb.LabelSettings[0];
            row.LoginExampleInstanceUrl = settings.LoginExampleInstanceUrl;
            row.Title = settings.Title;

            Save();
        }
        private void ReloadSettings()
        {
            Option.Read();

            LabelSettings labelSettings = Option.GetLabelSettings();

            if (labelSettings != null)
            {
                if (labelSettings.LoginExampleInstanceUrl != null)
                {
                    lblExampleUrl.Text = labelSettings.LoginExampleInstanceUrl;
                }
            }

            ImageSettings imageSettings = Option.GetimageSettings();

            if (imageSettings != null)
            {
                if (!String.IsNullOrWhiteSpace(imageSettings.Logo))
                {
                    System.Drawing.Image img = System.Drawing.Image.FromFile(imageSettings.Logo);
                    if (img.Width > 570 || img.Height > 90)
                    {
                        pictureBoxLogo.SizeMode = PictureBoxSizeMode.StretchImage;
                    }
                    else
                    {
                        pictureBoxLogo.SizeMode = PictureBoxSizeMode.CenterImage;
                    }


                    pictureBoxLogo.ImageLocation = imageSettings.Logo;
                }

                if (!String.IsNullOrWhiteSpace(imageSettings.Icon))
                {
                    this.Icon = new Icon(imageSettings.Icon);
                }
                //else
                //{
                //    this.Icon = new Icon("Resources/alfresco.ico");
                //}
            }
        }
Beispiel #9
0
        public void AssignSettingsToVariableContents(string fileName)
        {
            List <DTOLabelSettings> listDTO = new List <DTOLabelSettings>();

            LabelSettings labelSettings = new LabelSettings();

            listDTO = labelSettings.Load(fileName);

            //if (countVariableContents != listDTO.Count)
            //{
            //    string message = "Brak zgodności pomiędzy etykietą a zapisanymi danymi!\n sterownik: " + countVariableContents.ToString() + " wczytane dane: " + listDTO.Count.ToString();
            //    MessageBox.Show(message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    //UpdateCheckList(helper.Label, false);
            //    return;
            //}

            //Przypisuje ustawienia etykiety
            rjConnection.Job.AssignSettings(listDTO, database.GetHeadersCount());
        }
Beispiel #10
0
        /// <summary>
        /// define the Label-Format
        /// </summary>
        /// <param name="_Parameters">the Message-Type that should be used</param>
        /// <rreturns>new predefined LabelSettings with Empty Text</rreturns>
        private LabelSettings _FormatLabel(MessageType _Parameters)
        {
            LabelSettings _newSettings = new LabelSettings();

            _newSettings.Text = "";
            switch (_Parameters)
            {
            case MessageType.Green_BackColor:
                _newSettings.ForeColor = System.Drawing.Color.White;
                _newSettings.BackColor = System.Drawing.Color.Green;
                _newSettings.Font      = new System.Drawing.Font(_int_LabelDefaults.Font, System.Drawing.FontStyle.Bold);
                break;

            case MessageType.Green_ForeColor:
                _newSettings.ForeColor = System.Drawing.Color.Green;
                _newSettings.BackColor = System.Drawing.Color.Transparent;
                _newSettings.Font      = new System.Drawing.Font(_int_LabelDefaults.Font, System.Drawing.FontStyle.Bold);
                break;

            case MessageType.Red_BackColor:
                _newSettings.ForeColor = System.Drawing.Color.White;
                _newSettings.BackColor = System.Drawing.Color.Red;
                _newSettings.Font      = new System.Drawing.Font(_int_LabelDefaults.Font, System.Drawing.FontStyle.Bold);
                break;

            case MessageType.Red_ForeColor:
                _newSettings.ForeColor = System.Drawing.Color.Red;
                _newSettings.BackColor = System.Drawing.Color.Transparent;
                _newSettings.Font      = new System.Drawing.Font(_int_LabelDefaults.Font, System.Drawing.FontStyle.Bold);
                break;

            default:     // regular color-setting
                _newSettings.ForeColor = _int_LabelDefaults.ForeColor;
                _newSettings.BackColor = _int_LabelDefaults.BackColor;
                _newSettings.Font      = _int_LabelDefaults.Font;
                break;
            }
            return(_newSettings);
        }
        private void ReloadSettings()
        {
            Option.Read();

            DirectorySettings dirSettings = Option.GetDirectorySettings();

            if (dirSettings != null)
            {
                if (!String.IsNullOrWhiteSpace(dirSettings.DefaultFolderTag) && !String.IsNullOrWhiteSpace(dirSettings.DefaultFolder))
                {
                    DefaultFolderName = dirSettings.DefaultFolder;
                    DefaultFolderTag  = dirSettings.DefaultFolderTag;
                }
            }

            LabelSettings labelSettings = Option.GetLabelSettings();

            if (labelSettings != null)
            {
                if (labelSettings.LoginExampleInstanceUrl != null)
                {
                    LabelLoginExampleInstanceUrl = labelSettings.LoginExampleInstanceUrl;
                }
                if (labelSettings.Title != null)
                {
                    LabelTitle = labelSettings.Title;
                }
            }

            ActionSettings actionSettings = Option.GetActionSettings();

            if (actionSettings != null)
            {
                chkDisableStandardSaveButton.Checked = actionSettings.DisableStandardSave;
                chkDisableDefaultSaveButton.Checked  = actionSettings.DisableDefaultdSave;
                chkDisableLastUsedSaveButton.Checked = actionSettings.DisableLastSave;
            }

            ImageSettings imageSettings = Option.GetimageSettings();

            if (imageSettings != null)
            {
                if (!String.IsNullOrWhiteSpace(imageSettings.Logo))
                {
                    System.Drawing.Image img = System.Drawing.Image.FromFile(imageSettings.Logo);
                    if (img.Width > 570 || img.Height > 90)
                    {
                        pictureBoxLogo.SizeMode = PictureBoxSizeMode.StretchImage;
                    }
                    else
                    {
                        pictureBoxLogo.SizeMode = PictureBoxSizeMode.CenterImage;
                    }

                    pictureBoxLogo.ImageLocation = imageSettings.Logo;

                    pictureBoxLogoConfig.ImageLocation = imageSettings.Logo;
                    currentlogo = imageSettings.Logo;
                }
                else
                {
                    pictureBoxLogo.Image    = Properties.Resources.logoalfresco;
                    pictureBoxLogo.SizeMode = PictureBoxSizeMode.CenterImage;

                    pictureBoxLogoConfig.Image = Properties.Resources.logoalfresco;
                    currentlogo = null;
                }

                if (!String.IsNullOrWhiteSpace(imageSettings.HeadImage))
                {
                    pictureBoxImageConfig.ImageLocation = imageSettings.HeadImage;
                    currentImage = imageSettings.HeadImage;
                }
                else
                {
                    pictureBoxImageConfig.Image = Properties.Resources.logoalfrescosmall;
                    currentImage = null;
                }

                if (!String.IsNullOrWhiteSpace(imageSettings.Icon))
                {
                    pictureBoxIconConfig.ImageLocation = imageSettings.Icon;
                    currentIcon = imageSettings.Icon;
                    this.Icon   = new Icon(currentIcon);
                }
                else
                {
                    pictureBoxIconConfig.Image = Properties.Resources.alfresco;
                    currentIcon = null;
                    //this.Icon = new Icon("Resources/alfresco.ico");
                }
            }
        }
Beispiel #12
0
 /// <summary>
 /// init a new instance including label
 /// </summary>
 /// <param name="DefaultSettings">LabelSettings to use as default - Text is ignored</param>
 public StatusMessages(LabelSettings DefaultSettings)
 {
     _int_LabelDefaults = DefaultSettings;
     _init_clsStatusMessage();
 }
        private void ReloadSettings()
        {
            Option.Read();

            LabelSettings labelSettings = Option.GetLabelSettings();
            if (labelSettings != null)
            {
                if (labelSettings.Title != null)
                {
                    LabelTitle = labelSettings.Title;
                }
            }

            ActionSettings actionSettings = Option.GetActionSettings();
            if (actionSettings != null)
            {
                btnUploadSelectedFolder.Visible = !actionSettings.DisableStandardSave;
                btnUploadDefaultFolder.Visible = !actionSettings.DisableDefaultdSave;
                btnUploadLastFolder.Visible = !actionSettings.DisableLastSave;
                pnltxtDefaultFolder.Visible = !actionSettings.DisableDefaultdSave;
                pnltxtLastFolder.Visible = !actionSettings.DisableLastSave;
            }

            DirectorySettings dirSettings = Option.GetDirectorySettings();
            if (dirSettings != null)
            {
                DefaultFolderTag = dirSettings.DefaultFolderTag;
                DefaultFolderName = dirSettings.DefaultFolder;

                if (!String.IsNullOrWhiteSpace(DefaultFolderTag))
                {
                    btnUploadDefaultFolder.Enabled = true;

                }
                else
                {
                    btnUploadDefaultFolder.Enabled = false;
                }

                LastUsedFolder = dirSettings.LastUsedFolder;
                LastUsedFolderTag = dirSettings.LastUsedFolderTag;

                if (!String.IsNullOrWhiteSpace(LastUsedFolderTag))
                {
                    btnUploadLastFolder.Enabled = true;

                }
                else
                {
                    btnUploadLastFolder.Enabled = false;
                }
            }


            ImageSettings imageSettings = Option.GetimageSettings();
            if (imageSettings != null)
            {
                if (!String.IsNullOrWhiteSpace(imageSettings.HeadImage))
                {
                    pictureBoxHeadImage.ImageLocation = imageSettings.HeadImage;
                }
                else
                {
                    pictureBoxHeadImage.Image = Properties.Resources.logoalfrescosmall;
                }
                try
                {
                    if (!String.IsNullOrWhiteSpace(imageSettings.Icon))
                    {
                        this.Icon = new Icon(imageSettings.Icon);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString()); //added
                }

            }
        }