예제 #1
0
        private void SetIcon(eMessageBoxIcons icon)
        {
            switch (icon)
            {
            case eMessageBoxIcons.eNone:
                break;

            case eMessageBoxIcons.eAsk:
                PicGeometry = Geometry.Parse(
                    "F1 M 145.891,115.634C 135.873,124.325 126.443,133.672 117.663,143.615L 85.6833,115.357C 95.7277,103.979 106.518,93.2833 117.983,83.343L 145.891,115.634 Z M 449.666,17.7478C 628.269,77.7566 724.462,271.344 664.517,450.138C 604.572,628.931 411.191,725.225 232.588,665.216C 53.9846,605.208 -42.2066,411.621 17.7368,232.825L 58.2446,246.399C 48.0511,276.871 42.8383,308.791 42.8077,340.925C 42.6531,505.792 176.038,639.571 340.73,639.724C 505.423,639.878 639.056,506.351 639.21,341.483C 639.363,176.616 505.979,42.84 341.287,42.6853C 283.127,42.6026 226.219,59.6034 177.615,91.5813L 154.163,55.9177C 209.722,19.3364 274.788,-0.106728 341.287,2.28882e-005C 378.135,0.0173569 414.734,6.01064 449.666,17.7478 Z M 93.3158,175.159C 85.9378,186.169 79.3207,197.672 73.5096,209.585L 35.1339,190.739C 41.8376,177.101 49.4515,163.931 57.9248,151.319L 93.3158,175.159 Z M 362.607,425.529L 362.607,512.223L 319.968,512.223L 319.968,384.167L 341.287,384.167C 411.935,384.167 469.207,326.834 469.207,256.112C 469.207,185.389 411.935,128.056 341.287,128.056C 270.64,128.056 213.368,185.389 213.368,256.112L 170.728,256.112C 170.736,170.073 234.695,97.4812 319.968,86.7258C 413.426,74.938 498.733,141.227 510.509,234.785C 522.284,328.343 456.066,413.742 362.607,425.529 Z M 319.968,554.908L 362.607,554.908L 362.607,597.594L 319.968,597.594L 319.968,554.908 Z ");

                break;

            case eMessageBoxIcons.eWarning:
                PicGeometry = Geometry.Parse(
                    "F1 M 775.158,729.691C 789.34,751.362 773.883,781.798 748.227,780.363L 747.909,780.363L 32.1042,780.363C 15.6911,781.32 -9.32702,762.038 2.94302,733.356L 361.005,17.8845C 367.697,1.31233 401.48,-12.8694 419.168,17.8845L 775.158,729.691 Z M 84.69,715.509L 695.323,715.509L 390.007,105.207L 84.69,715.509 Z M 357.499,306.145C 357.499,288.138 372,273.638 390.007,273.638C 408.013,273.638 422.514,288.138 422.514,306.145L 422.514,506.763C 422.514,524.77 408.013,539.27 390.007,539.27C 372,539.27 357.499,524.77 357.499,506.763L 357.499,306.145 Z M 390.007,588.509C 408.048,588.509 422.673,603.134 422.673,621.175C 422.673,639.216 408.048,653.841 390.007,653.841C 371.965,653.841 357.34,639.216 357.34,621.175C 357.34,603.134 371.965,588.509 390.007,588.509 Z ");
                break;

            case eMessageBoxIcons.eSucsess:
                PicGeometry = Geometry.Parse(
                    "F1 M 200.6,275.4L 306,380.8L 598.4,88.4L 646,136L 306,476L 153,323L 200.6,275.4 Z M 612,340L 680,340C 680,527 527,680 340,680C 153,680 0,527 0,340C 0,153 153,0 340,0C 384.2,0 428.4,10.2 469.2,23.8L 414.8,78.2C 391,71.4 367.2,67.9999 340,67.9999C 190.4,67.9999 68,190.4 68,340C 68,489.6 190.4,612 340,612C 489.6,612 612,489.6 612,340 Z ");
                break;

            case eMessageBoxIcons.eFreeze:
                PicGeometry = Geometry.Parse(
                    "F1 M 341.333,-2.28882e-005C 529.545,-2.28882e-005 682.667,153.121 682.667,341.333C 682.667,529.545 529.545,682.667 341.333,682.667C 153.121,682.667 0,529.545 0,341.333C 0,153.121 153.121,-2.28882e-005 341.333,-2.28882e-005 Z M 341.333,656.411C 515.068,656.411 656.411,515.068 656.411,341.333C 656.411,167.599 515.068,26.256 341.333,26.256C 167.599,26.256 26.256,167.599 26.256,341.333C 26.256,515.068 167.599,656.411 341.333,656.411 Z M 518.436,428.427C 524.715,432.052 526.867,440.08 523.239,446.355C 520.808,450.565 516.395,452.92 511.857,452.92C 509.631,452.92 507.373,452.353 505.307,451.159L 475.912,434.188L 482.124,457.374C 484,464.379 479.843,471.576 472.84,473.453C 471.703,473.759 470.56,473.904 469.435,473.904C 463.637,473.904 458.333,470.036 456.761,464.171L 443.755,415.624L 419.713,401.742L 426.589,464.975C 427.152,470.148 424.608,475.163 420.103,477.765C 418.064,478.941 415.799,479.522 413.54,479.522C 410.807,479.522 408.083,478.669 405.784,476.987L 354.46,439.415L 354.46,467.171L 390.001,502.712C 395.128,507.84 395.128,516.151 390.001,521.279C 387.437,523.841 384.077,525.123 380.717,525.123C 377.357,525.123 373.999,523.841 371.435,521.279L 354.46,504.304L 354.46,538.252C 354.46,545.501 348.583,551.38 341.332,551.38C 334.083,551.38 328.204,545.503 328.204,538.252L 328.204,504.308L 311.233,521.28C 306.105,526.405 297.795,526.405 292.667,521.28C 287.54,516.152 287.54,507.841 292.667,502.713L 328.205,467.175L 328.205,439.419L 276.885,476.988C 272.688,480.061 267.073,480.367 262.567,477.765C 258.063,475.163 255.517,470.148 256.08,464.975L 262.956,401.741L 238.919,415.62L 225.909,464.172C 224.337,470.037 219.032,473.905 213.236,473.905C 212.111,473.905 210.968,473.759 209.831,473.455C 202.827,471.577 198.669,464.379 200.547,457.376L 206.761,434.185L 177.36,451.16C 175.293,452.353 173.035,452.921 170.809,452.921C 166.271,452.921 161.859,450.568 159.428,446.356C 155.801,440.076 157.953,432.048 164.232,428.423L 193.631,411.449L 170.445,405.237C 163.441,403.36 159.284,396.161 161.161,389.159C 163.04,382.153 170.24,378.001 177.24,379.875L 225.788,392.883L 249.828,379.003L 191.631,353.343C 186.871,351.242 183.799,346.531 183.799,341.329C 183.799,336.128 186.871,331.416 191.631,329.317L 249.828,303.657L 225.788,289.779L 177.24,302.788C 176.103,303.093 174.96,303.239 173.835,303.239C 168.037,303.239 162.733,299.371 161.161,293.505C 159.285,286.501 163.443,279.304 170.445,277.427L 193.632,271.215L 164.231,254.24C 157.952,250.615 155.8,242.585 159.427,236.307C 163.051,230.025 171.08,227.876 177.36,231.503L 206.761,248.477L 200.548,225.289C 198.672,218.285 202.827,211.088 209.832,209.211C 216.837,207.341 224.033,211.492 225.911,218.495L 238.92,267.044L 262.957,280.923L 256.081,217.69C 255.519,212.517 258.063,207.504 262.568,204.902C 267.073,202.297 272.689,202.604 276.887,205.678L 328.207,243.246L 328.207,215.489L 292.668,179.951C 287.541,174.823 287.541,166.512 292.668,161.384C 297.796,156.259 306.107,156.259 311.235,161.384L 328.205,178.356L 328.205,144.412C 328.205,137.163 334.083,131.284 341.333,131.284C 348.583,131.284 354.461,137.161 354.461,144.412L 354.461,178.36L 371.436,161.385C 376.564,156.26 384.875,156.26 390.003,161.385C 395.129,166.513 395.129,174.824 390.003,179.952L 354.461,215.493L 354.461,243.251L 405.785,205.678C 409.983,202.607 415.597,202.298 420.104,204.902C 424.608,207.503 427.153,212.517 426.591,217.69L 419.715,280.921L 443.756,267.04L 456.763,218.495C 458.641,211.491 465.84,207.344 472.841,209.211C 479.845,211.088 484.001,218.287 482.125,225.289L 475.913,248.473L 505.308,231.503C 511.592,227.875 519.617,230.029 523.241,236.307C 526.868,242.585 524.716,250.613 518.437,254.239L 489.039,271.213L 512.228,277.427C 519.233,279.304 523.388,286.503 521.512,293.505C 519.94,299.371 514.635,303.239 508.839,303.239C 507.713,303.239 506.571,303.092 505.433,302.788L 456.881,289.777L 432.841,303.657L 491.041,329.319C 495.801,331.419 498.873,336.129 498.873,341.332C 498.873,346.535 495.801,351.245 491.041,353.345L 432.841,379.007L 456.881,392.887L 505.432,379.877C 512.436,378.001 519.632,382.156 521.511,389.161C 523.387,396.165 519.229,403.364 512.227,405.24L 489.039,411.453L 518.436,428.427 Z M 398.569,365.423L 453.204,341.333L 398.568,317.244C 393.332,314.935 390.195,309.5 390.813,303.811L 397.268,244.451L 349.087,279.721C 344.468,283.103 338.196,283.103 333.577,279.721L 285.396,244.451L 291.852,303.811C 292.471,309.5 289.333,314.935 284.097,317.244L 229.463,341.333L 284.097,365.424C 289.333,367.733 292.471,373.168 291.852,378.857L 285.397,438.217L 333.579,402.947C 335.888,401.255 338.611,400.411 341.333,400.411C 344.056,400.411 346.779,401.255 349.088,402.945L 397.269,438.216L 390.815,378.856C 390.196,373.167 393.333,367.732 398.569,365.423 Z ");
                break;
            }
        }
예제 #2
0
 public void SetParametrs(MessageBoxButton button, eMessageBoxIcons icon)
 {
     SetIcon(icon);
 }
        public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, eMessageBoxIcons icon,
                                            MessageBoxResult defaultResult = MessageBoxResult.None)
        {
            messageBox = new CustomMessageBox();

            if (!(messageBox.DataContext is MessageWindowViewModel window))
            {
                return(MessageBoxResult.None);
            }

            window.strMessage = messageBoxText;
            window.strHeader  = caption;
            window.SetParametrs(button, icon);

            ///Можно было сделать через value converter, но времени мало
            switch (button)
            {
            case MessageBoxButton.OK:
                window.LeftButtonCaption          = "Ок";
                messageBox.Ok.Visibility          = Visibility.Visible;
                messageBox.YesNo.Visibility       = Visibility.Hidden;
                messageBox.YesNoCancel.Visibility = Visibility.Hidden;
                break;

            case MessageBoxButton.OKCancel:

                window.LeftButtonCaption          = "Да";
                window.RightButtonCaption         = "Нет";
                messageBox.YesNo.Visibility       = Visibility.Visible;
                messageBox.Ok.Visibility          = Visibility.Hidden;
                messageBox.YesNoCancel.Visibility = Visibility.Hidden;
                break;

            case MessageBoxButton.YesNo:
                window.LeftButtonCaption          = "Да";
                window.RightButtonCaption         = "Нет";
                messageBox.YesNo.Visibility       = Visibility.Visible;
                messageBox.Ok.Visibility          = Visibility.Hidden;
                messageBox.YesNoCancel.Visibility = Visibility.Hidden;
                break;

            case MessageBoxButton.YesNoCancel:    //Todo: метод
                window.LeftButtonCaption          = "Да";
                window.RightButtonCaption         = "Нет";
                window.CancelButtonCaption        = "Отмена";
                messageBox.YesNoCancel.Visibility = Visibility.Visible;
                messageBox.Ok.Visibility          = Visibility.Hidden;
                messageBox.YesNo.Visibility       = Visibility.Hidden;
                break;
            }

            messageBox.ShowDialog();

            return(messageBox.Result);
        }