コード例 #1
0
ファイル: MakeLetterForm.cs プロジェクト: ivm23/Registration
        private void SendLetterB_Click(object sender, EventArgs e)
        {
            LetterType selectedLetterType            = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterType;
            ILetterPropertiesUIPlugin clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType);

            global::Registration.SerializationService.LetterProperties letterProp = clientUIPlugin.GetLetterProperties();
            LetterView letterView = clientUIPlugin.StandartLetter;

            if (SendLetter(letterView.Name, ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).Worker.Id, NamesAndLoginsReceivers, letterView.Text, letterProp.ToString(), selectedLetterType.Id))
            {
                MessageService.InfoMessage(Message.MessageResource.SentLetter);
                Close();
            }
        }
コード例 #2
0
        public void InitializeForm()
        {
            InitializeClientService();
            InitializeMessageService();
            InitializeBaseControls();

            LetterView letterView = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterView;

            LetterType selectedLetterType = ClientRequests.GetLetterType(letterView.Type);

            ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType);

            newControl.LetterView = letterView;

            newControl.ReadOnly = true;

            int tabIndex = 0;

            newControl.OnLoad(ServiceProvider);

            ((Control)newControl).TabIndex = tabIndex;

            int heightSize = 0;
            int locationY  = 0;

            foreach (Control control in BaseControls)
            {
                if (control.Location.Y + control.Size.Height > locationY)
                {
                    locationY = control.Location.Y + control.Size.Height;
                }

                heightSize += control.Size.Height;
            }

            this.Controls.Clear();
            ((Control)newControl).Location = new Point(0, locationY);

            this.Size = new Size(((Control)newControl).Size.Width, ((Control)newControl).Size.Height + heightSize);

            this.Controls.Add(((Control)newControl));

            foreach (Control control in BaseControls)
            {
                ++tabIndex;
                control.TabIndex = tabIndex;
                this.Controls.Add(control);
            }
        }
コード例 #3
0
ファイル: MakeLetterForm.cs プロジェクト: ivm23/Registration
        private void InitializeForm()
        {
            InitializeClientService();
            InitializeMessageService();

            var selectedLetterType = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterType;


            ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType);

            //   newControl.AddReceiver += new EventHandler(Click);
            newControl.ReadOnly = false;

            this.Size = new Size(((Control)newControl).Size.Width, ((Control)newControl).Height);
            this.Controls.Add(((Control)newControl));
        }
コード例 #4
0
        public void InitializeForm()
        {
            InitializeClientService();
            InitializeMessageService();
            InitializeBaseControls();

            LetterView letterView = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterView;

            LetterType selectedLetterType = ClientRequests.GetLetterType(letterView.Type);


            ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType);

            LetterProperties prop = new LetterProperties()
            {
            };

            int minXLocation        = int.MaxValue;
            int minYLocation        = int.MaxValue;
            int sizeForMinYLocation = 0;

            foreach (Control control in BaseControls)
            {
                minXLocation = Math.Min(control.Location.X, minXLocation);

                if (control.Location.Y < minYLocation)
                {
                    minYLocation        = control.Location.Y;
                    sizeForMinYLocation = control.Size.Height;
                }
            }
            ((Control)newControl).Location = new Point(minXLocation, minYLocation + sizeForMinYLocation);

            int width = Math.Max(BaseSizeHeight.X, ((Control)newControl).Width);

            this.Controls.Clear();

            this.Size = new Size(width, BaseSizeHeight.Y + ((Control)newControl).Size.Height);

            this.Controls.Add(((Control)newControl));

            foreach (Control control in BaseControls)
            {
                control.Location = new System.Drawing.Point(control.Location.X, control.Location.Y + ((Control)newControl).Size.Height);
                this.Controls.Add(control);
            }
        }
コード例 #5
0
ファイル: MakeLetterForm.cs プロジェクト: ivm23/DV
        private bool SendLetter(Guid workerId)
        {
            LetterType selectedLetterType            = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterType;
            ILetterPropertiesUIPlugin clientUIPlugin = ((ApplicationState)(ServiceProvider.GetService(typeof(ApplicationState)))).CurrentLetterPropertiesPlugin;

            LetterView letterView = clientUIPlugin.LetterView;


            if (string.IsNullOrEmpty(letterView.Name))
            {
                MessageService.ErrorMessage(Message.MessageResource.EmptyNameInLetter);
                return(false);
            }
            if (letterView.ReceiversName.Count() == 0)
            {
                MessageService.ErrorMessage(Message.MessageResource.EmptyListRecipient);
                return(false);
            }

            CreateLetter(letterView.Name, ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).Worker.Id, letterView.ReceiversName, letterView.Text, letterView.ExtendedData, ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterType.Id);
            return(true);
        }
コード例 #6
0
ファイル: MakeLetterForm.cs プロジェクト: ivm23/DV
        private void InitializeForm()
        {
            InitializeClientService();
            InitializeMessageService();
            int tabIndex = 0;

            var selectedLetterType = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterType;


            ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType);

            ((Control)newControl).TabIndex = tabIndex;

            newControl.OnLoad(ServiceProvider);
            newControl.ReadOnly = false;

            var clientService = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests));
            var workers       = clientService.GetAllWorkers();

            this.Size = new Size(((Control)newControl).Size.Width, ((Control)newControl).Height);
            this.Controls.Add(((Control)newControl));
            ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).CurrentLetterPropertiesPlugin = newControl;
        }