Inheritance: IdentifiedEntity
Example #1
0
        private async void EditWorkplaceForm_Load(object sender, EventArgs e)
        {
            if (workplaceId != Guid.Empty)
            {
                Enabled = false;

                try
                {
                    using (var channel = WorkplaceChannelManager.CreateChannel())
                    {
                        Workplace = await taskPool.AddTask(channel.Service.GetWorkplace(workplaceId));
                    }

                    Enabled = true;
                }
                catch (OperationCanceledException) { }
                catch (CommunicationObjectAbortedException) { }
                catch (ObjectDisposedException) { }
                catch (InvalidOperationException) { }
                catch (FaultException exception)
                {
                    UIHelper.Warning(exception.Reason.ToString());
                }
                catch (Exception exception)
                {
                    UIHelper.Warning(exception.Message);
                }
            }
            else
            {
                Workplace = new Workplace()
                {
                    Number = 1
                };
            }
        }
Example #2
0
        private async void saveButton_Click(object sender, EventArgs e)
        {
            using (var channel = WorkplaceChannelManager.CreateChannel())
            {
                try
                {
                    saveButton.Enabled = false;

                    Workplace = await taskPool.AddTask(channel.Service.EditWorkplace(workplace));

                    if (Saved != null)
                    {
                        Saved(this, EventArgs.Empty);
                    }
                }
                catch (OperationCanceledException) { }
                catch (CommunicationObjectAbortedException) { }
                catch (ObjectDisposedException) { }
                catch (InvalidOperationException) { }
                catch (FaultException exception)
                {
                    UIHelper.Warning(exception.Reason.ToString());
                }
                catch (Exception exception)
                {
                    UIHelper.Warning(exception.Message);
                }
                finally
                {
                    saveButton.Enabled = true;
                }
            }
        }
Example #3
0
 private void WorkplacesGridViewRenderRow(DataGridViewRow row, Workplace workplace)
 {
     row.Cells["typeColumn"].Value = Translater.Enum(workplace.Type);
     row.Cells["numberColumn"].Value = workplace.Number;
     row.Cells["modificatorColumn"].Value = Translater.Enum(workplace.Modificator);
     row.Cells["commentColumn"].Value = workplace.Comment;
     row.Cells["displayDeviceIdColumn"].Value = workplace.DisplayDeviceId;
     row.Cells["qualityPanelDeviceId"].Value = workplace.QualityPanelDeviceId;
     row.Tag = workplace;
 }