Esempio n. 1
0
        public void OpenPreview(Action <string, Color> logMessage)
        {
            if (previewForm == null || previewForm.IsDisposed)
            {
                previewPicture          = new PictureBox();
                previewPicture.Dock     = DockStyle.Fill;
                previewPicture.Image    = Resources.OpenFL;
                previewPicture.SizeMode = PictureBoxSizeMode.Zoom;


                StyleManager.RegisterControl(previewPicture, "default", "preview");

                previewForm = ContainerForm.CreateContainer(
                    previewPicture,
                    null,
                    "Preview: ",
                    Resources.OpenFL_Icon,
                    FormBorderStyle.SizableToolWindow
                    );

                ComputePreview(logMessage);
            }
            else
            {
                previewForm.Show();
            }
        }
Esempio n. 2
0
        protected override void OnClick(EventArgs e)
        {
            Store.CurrentUser = null;
            ContainerForm.AddForm(new SignInForm(), false);

            base.OnClick(e);
        }
Esempio n. 3
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 50, Configuration.FieldSeparator),
                       Id,
                       ExternalAccessionIdentifier?.ToDelimitedString(),
                       AccessionIdentifier?.ToDelimitedString(),
                       ContainerIdentifier?.ToDelimitedString(),
                       PrimaryParentContainerIdentifier?.ToDelimitedString(),
                       EquipmentContainerIdentifier?.ToDelimitedString(),
                       SpecimenSource,
                       RegistrationDateTime.HasValue ? RegistrationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ContainerStatus?.ToDelimitedString(),
                       CarrierType?.ToDelimitedString(),
                       CarrierIdentifier?.ToDelimitedString(),
                       PositionInCarrier?.ToDelimitedString(),
                       TrayTypeSac?.ToDelimitedString(),
                       TrayIdentifier?.ToDelimitedString(),
                       PositionInTray?.ToDelimitedString(),
                       Location != null ? string.Join(Configuration.FieldRepeatSeparator, Location.Select(x => x.ToDelimitedString())) : null,
                       ContainerHeight.HasValue ? ContainerHeight.Value.ToString(Consts.NumericFormat, culture) : null,
                       ContainerDiameter.HasValue ? ContainerDiameter.Value.ToString(Consts.NumericFormat, culture) : null,
                       BarrierDelta.HasValue ? BarrierDelta.Value.ToString(Consts.NumericFormat, culture) : null,
                       BottomDelta.HasValue ? BottomDelta.Value.ToString(Consts.NumericFormat, culture) : null,
                       ContainerHeightDiameterDeltaUnits?.ToDelimitedString(),
                       ContainerVolume.HasValue ? ContainerVolume.Value.ToString(Consts.NumericFormat, culture) : null,
                       AvailableSpecimenVolume.HasValue ? AvailableSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null,
                       InitialSpecimenVolume.HasValue ? InitialSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null,
                       VolumeUnits?.ToDelimitedString(),
                       SeparatorType?.ToDelimitedString(),
                       CapType?.ToDelimitedString(),
                       Additive != null ? string.Join(Configuration.FieldRepeatSeparator, Additive.Select(x => x.ToDelimitedString())) : null,
                       SpecimenComponent?.ToDelimitedString(),
                       DilutionFactor?.ToDelimitedString(),
                       Treatment?.ToDelimitedString(),
                       Temperature?.ToDelimitedString(),
                       HemolysisIndex.HasValue ? HemolysisIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       HemolysisIndexUnits?.ToDelimitedString(),
                       LipemiaIndex.HasValue ? LipemiaIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       LipemiaIndexUnits?.ToDelimitedString(),
                       IcterusIndex.HasValue ? IcterusIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       IcterusIndexUnits?.ToDelimitedString(),
                       FibrinIndex.HasValue ? FibrinIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       FibrinIndexUnits?.ToDelimitedString(),
                       SystemInducedContaminants != null ? string.Join(Configuration.FieldRepeatSeparator, SystemInducedContaminants.Select(x => x.ToDelimitedString())) : null,
                       DrugInterference != null ? string.Join(Configuration.FieldRepeatSeparator, DrugInterference.Select(x => x.ToDelimitedString())) : null,
                       ArtificialBlood?.ToDelimitedString(),
                       SpecialHandlingCode != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialHandlingCode.Select(x => x.ToDelimitedString())) : null,
                       OtherEnvironmentalFactors != null ? string.Join(Configuration.FieldRepeatSeparator, OtherEnvironmentalFactors.Select(x => x.ToDelimitedString())) : null,
                       ContainerLength?.ToDelimitedString(),
                       ContainerWidth?.ToDelimitedString(),
                       ContainerForm?.ToDelimitedString(),
                       ContainerMaterial?.ToDelimitedString(),
                       ContainerCommonName?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Esempio n. 4
0
 private void tsbNarudzbenicaSpremiZatvori_Click(object sender, EventArgs e)
 {
     if (SaveData())
     {
         ContainerForm.DialogResult = DialogResult.OK;
         ContainerForm.Close();
     }
 }
Esempio n. 5
0
 private void btnKreni_Click(object sender, EventArgs e)
 {
     if (SaveData())
     {
         ContainerForm.DialogResult = DialogResult.OK;
         ContainerForm.Close();
     }
 }
Esempio n. 6
0
        public static (Form, Panel) CreateProgressForm()
        {
            Panel         parent = CreateProgressPanel();
            ContainerForm c      = new ContainerForm(
                parent,
                null,
                "Unpacking",
                SystemIcons.Application,
                FormBorderStyle.SizableToolWindow,
                new Size(1, 1),
                new Size(3000, 3000)
                );

            c.Show();
            c.Size = new Size(700, 600);
            return(c, parent);
        }
Esempio n. 7
0
 private void lnkVisitor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     ContainerForm.AddForm(new VisitorForm());
     Close();
 }
Esempio n. 8
0
 private void lnkSignUp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     ContainerForm.AddForm(new SignUpForm(), false);
     Close();
 }
Esempio n. 9
0
        private async void btnSignIn_Click(object sender, EventArgs e)
        {
            var username = txtUsername.Text;
            var password = txtPassword.Text;

            if (username.IsNullOrEmpty())
            {
                txtUsername.UnderlineColor = Themes.CurrentTheme switch
                {
                    Theme.Light => Themes.Colors.Light.Error.ToColor(),
                    Theme.Dark => Themes.Colors.Dark.Error.ToColor(),
                    _ => Themes.Colors.Light.Error.ToColor()
                }
            }
            ;

            if (password.IsNullOrEmpty())
            {
                txtPassword.UnderlineColor = Themes.CurrentTheme switch
                {
                    Theme.Light => Themes.Colors.Light.Error.ToColor(),
                    Theme.Dark => Themes.Colors.Dark.Error.ToColor(),
                    _ => Themes.Colors.Light.Error.ToColor()
                }
            }
            ;

            if (username.IsNullOrEmpty() || password.IsNullOrEmpty())
            {
                return;
            }

            try
            {
                Cursor = Cursors.WaitCursor;

                var where = new Dictionary <string, string>()
                {
                    { "Username", username }
                };
                //var user = UserRepository.Find(where, true);
                var user = await UserRepository.FindAsync(where, true);

                if (user == null || !(await Hash.CompareAsync(password, user.Password)))
                {
                    MessageBox.Show(Resource_Localization.ErrorIncorrectCredentials);
                    return;
                }

                Store.CurrentUser = user;

                BaseForm yetkiForm = user.Role switch
                {
                    Role.Admin => new AdminForm(),
                    Role.Staff => new StaffForm(),
                    Role.User => new UserForm(),
                    Role.Visitor => new VisitorForm(),
                    _ => new VisitorForm()
                };
                ContainerForm.AddForm(yetkiForm);
                Close();
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                MessageBox.Show(Resource_Localization.ErrorUnknown);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Esempio n. 10
0
 private void tsbNarudzbenicaOdustani_Click(object sender, EventArgs e)
 {
     ContainerForm.DialogResult = DialogResult.Cancel;
     ContainerForm.Close();
 }
Esempio n. 11
0
        private async void btnSignUp_Click(object sender, EventArgs e)
        {
            var username  = txtUsername.Text;
            var email     = txtEmail.Text;
            var password  = txtPassword.Text;
            var firstName = txtFirstName.Text;
            var lastName  = txtLastName.Text;
            var phone     = txtPhone.Text;
            var address   = txtAddress.Text;

            if (username.IsNullOrEmpty())
            {
                txtUsername.UnderlineColor = Themes.CurrentTheme switch
                {
                    Theme.Light => Themes.Colors.Light.Error.ToColor(),
                    Theme.Dark => Themes.Colors.Dark.Error.ToColor(),
                    _ => Themes.Colors.Light.Error.ToColor()
                }
            }
            ;

            if (email.IsNullOrEmpty())
            {
                txtEmail.UnderlineColor = Themes.CurrentTheme switch
                {
                    Theme.Light => Themes.Colors.Light.Error.ToColor(),
                    Theme.Dark => Themes.Colors.Dark.Error.ToColor(),
                    _ => Themes.Colors.Light.Error.ToColor()
                }
            }
            ;

            if (password.IsNullOrEmpty())
            {
                txtPassword.UnderlineColor = Themes.CurrentTheme switch
                {
                    Theme.Light => Themes.Colors.Light.Error.ToColor(),
                    Theme.Dark => Themes.Colors.Dark.Error.ToColor(),
                    _ => Themes.Colors.Light.Error.ToColor()
                }
            }
            ;

            if (username.IsNullOrEmpty() || email.IsNullOrEmpty() || password.IsNullOrEmpty())
            {
                return;
            }

            try
            {
                Cursor = Cursors.WaitCursor;

                var user = new UserEntity
                {
                    Username  = username,
                    Email     = email,
                    Password  = password,
                    FirstName = firstName,
                    LastName  = lastName,
                    Phone     = phone,
                    Address   = address,
                    Role      = Role.User
                };
                await UserRepository.CreateAsync(user);

                ContainerForm.AddForm(new SignInForm(), false);
                Close();
            }
            catch (SqlException exception) when(exception.Number == 2601)
            {
                Debug.WriteLine(exception.Message);
                // TODO: write localized error messages
                MessageBox.Show(exception.Message, "SQL exception (TODO: Localize)");
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                MessageBox.Show(Resource_Localization.ErrorUnknown);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Runs the update for the current update feature.
        /// </summary>
        /// <returns>True if an update command dialog has been started.</returns>
        bool RunUpdate()
        {
            // Get the operation that created the feature selected for update.
            Operation pop = GetOp();

            if (pop == null)
            {
                return(false);
            }

            // There shouldn't already be a command running.
            if (m_Cmd != null)
            {
                MessageBox.Show("UpdateUI.RunUpdate - Update already running?");
                return(false);
            }

            // The IControlContainer is a bit of a dodo.
            IControlContainer cc = new ContainerForm("Update");

            switch (pop.EditId)
            {
            case EditingActionId.LineExtend:
            {
                m_Cmd = new LineExtensionUI(cc, pop.EditId, this);
                break;
            }

            case EditingActionId.LineSubdivision:
            {
                m_Cmd = new LineSubdivisionUI(cc, pop.EditId, this);
                break;
            }

            // SS20101011 - In the past, you were allowed to change the lines that were intersected
            // as part of Direction-Line and Line-Line intersects. This would not be a problem if
            // the lines were left un-split. However, if you split the lines, it is possible that
            // subsequent edits would refer to the resultant sections. So if you later refer to a
            // different line, those edits would become invalid. That's why the ability to change
            // Line-Line intersects has been removed. The Direction-Line option is still valid,
            // because you are allowed to change the direction.

            // In the future, it would be better to modify the Direction-Line and Line-Line edits
            // to prohibit splits. That would probably be better handled by a new edit that would
            // let users split a line at an intersection (although I haven't thought that through -
            // it's possible that such an edit would also be subject to similar issues).

            case EditingActionId.DirIntersect:
            case EditingActionId.DirDistIntersect:
            case EditingActionId.DirLineIntersect:
            case EditingActionId.DistIntersect:
                //case EditingActionId.LineIntersect:
            {
                m_Cmd = new IntersectUI(pop.EditId, this);
                break;
            }

            case EditingActionId.NewPoint:
            case EditingActionId.GetControl:
            {
                m_Cmd = new NewPointUI(cc, pop.EditId, this);
                break;
            }

            case EditingActionId.NewCircle:
            {
                m_Cmd = new NewCircleUI(cc, pop.EditId, this);
                break;
            }

            case EditingActionId.Path:
            {
                m_Cmd = new PathUI(cc, pop.EditId, this);
                break;
            }

            case EditingActionId.Parallel:
            {
                m_Cmd = new ParallelLineUI(cc, pop.EditId, this);
                break;
            }

            case EditingActionId.Radial:
            {
                m_Cmd = new RadialUI(cc, pop.EditId, this);
                break;
            }

            case EditingActionId.SimpleLineSubdivision:
            {
                m_Cmd = new SimpleLineSubdivisionUI(cc, pop.EditId, this);
                break;
            }
            }

            if (m_Cmd != null)
            {
                m_Cmd.Run();
                return(true);
            }

            MessageBox.Show("You cannot update the selected feature this way.");
            return(false);
        }
Esempio n. 13
0
 public ContainerPresenter(ContainerForm view) => _view = view;
Esempio n. 14
0
 private void btnZatvori_Click(object sender, EventArgs e)
 {
     ContainerForm.DialogResult = DialogResult.OK;
     ContainerForm.Close();
 }
Esempio n. 15
0
 public void ClosePreview()
 {
     previewForm?.Close();
     previewForm    = null;
     previewPicture = null;
 }