private void CalculateLabels()
 {
     lblFileSize.Content          = sourceBitmap.FileSize;
     lblMaxCapacity.Content       = sourceBitmap.GetMaxCapacity();
     lblUsedCapacity.Content      = tbInput.Text.Length;
     lblRemainingCapacity.Content = (sourceBitmap.GetMaxCapacity() - tbInput.Text.Length);
     lblTotalWrittenBits.Content  = tbInput.Text.Length * 8;
     lblChangeInR.Content         = Stego.CalculateChange(sourceBitmap.RedChannel, Stego.StringToByteArray(tbInput.Text));
     lblChangeInG.Content         = Stego.CalculateChange(sourceBitmap.GreenChannel, Stego.StringToByteArray(tbInput.Text));
     lblChangeInB.Content         = Stego.CalculateChange(sourceBitmap.BlueChannel, Stego.StringToByteArray(tbInput.Text));
 }
        private void Ofd_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            sourceBitmap     = new StegoBitmap(ofd.FileName);
            imgSource.Source = GetSource(sourceBitmap.GetImage());
            Channel?result = Stego.HasHiddenValue(sourceBitmap);

            if (result.HasValue)
            {
                tbInput.Text = Stego.GetHiddenValue(sourceBitmap, result.Value);
            }
            else
            {
                CalculateLabels();
            }
        }
        private void BtnHide_Click(object sender, RoutedEventArgs e)
        {
            Channel channel;

            if (((ComboBoxItem)cmbChannel.SelectedItem).Content.ToString() == "Otomatik")
            {
                int changeInRed   = Stego.CalculateChange(sourceBitmap.RedChannel, Stego.StringToByteArray(tbInput.Text));
                int changeInGreen = Stego.CalculateChange(sourceBitmap.GreenChannel, Stego.StringToByteArray(tbInput.Text));
                int changeInBlue  = Stego.CalculateChange(sourceBitmap.BlueChannel, Stego.StringToByteArray(tbInput.Text));
                int min           = changeInRed;
                if (changeInGreen < min)
                {
                    min = changeInGreen;
                }
                if (changeInBlue < min)
                {
                    min = changeInBlue;
                }
                if (min == changeInRed)
                {
                    channel = Channel.R;
                }
                else if (min == changeInGreen)
                {
                    channel = Channel.G;
                }
                else
                {
                    channel = Channel.B;
                }
            }
            else
            {
                channel = (Channel)(cmbChannel.SelectedIndex - 1);
            }
            modifiedBitmap     = new StegoBitmap(Stego.Hide(sourceBitmap, tbInput.Text, channel));
            imgModified.Source = GetSource(modifiedBitmap.GetImage());
            DrawHistogram(sourceBitmap, modifiedBitmap);
        }