Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            var other = obj as FormatGeneratorOptions;

            if (other == null)
            {
                throw new PSInvalidOperationException("Object to be compared is of different type "
                                                      + obj.GetType().Name);
            }
            if (((Properties == null) != (other.Properties == null)) ||
                ((GroupBy == null) != (other.GroupBy == null))
                )
            {
                return(false);
            }
            return(
                Expand.Equals(other.Expand) &&
                Force.Equals(other.Force) &&
                ((GroupBy == null && other.GroupBy == null) || GroupBy.Equals(other.GroupBy)) &&
                DisplayError.Equals(other.DisplayError) &&
                ShowError.Equals(other.ShowError) &&
                String.Equals(View, other.View) &&
                ((Properties == null && other.Properties == null) || Properties.Equals(other.Properties))
                );
        }
Exemplo n.º 2
0
        static void handleError(string err)
        {
            ShowError s = window.showError;

            window.Invoke(s, err);
            Environment.Exit(1);
        }
Exemplo n.º 3
0
        private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (progressBar != null && progressBarGrid != null)
            {
                progressBarGrid.Visibility  = Visibility.Hidden;
                progressBar.IsIndeterminate = true;
            }

            if (!processingError)
            {
                var inputFile = new DriverlessInputFile(InputFileManager.LastID + 1, FileNameWithoutPath, channels);

                //TODO: ha lesz standard input file is, akkor azt még előbb kell eldönteni vagy utána rögtön válassza ki és utána nézzem meg hogy ezek benne vannak e.
                var yChannel = inputFile.GetChannel("y");
                if (yChannel == null)
                {
                    ShowError.ShowErrorMessage("Can't find 'y' channel, so the track will not shown");
                }

                var c0refChannel = inputFile.GetChannel("c0ref");
                if (c0refChannel == null)
                {
                    ShowError.ShowErrorMessage("Can't find 'c0ref' channel, so the track will not shown");
                }

                InputFileManager.AddInputFile(inputFile);
                InputFileManager.ActiveInputFileName = FileNameWithoutPath;
                ((InputFilesSettings)((SettingsMenu)MenuManager.GetTab(TextManager.SettingsMenuName).Content).GetTab(TextManager.FilesSettingsName).Content).AddInputFileSettingsItem(inputFile);
                ((DriverlessMenu)MenuManager.GetTab(TextManager.DriverlessMenuName).Content).UpdateAfterReadFile();
                ((GroupSettings)((SettingsMenu)MenuManager.GetTab(TextManager.SettingsMenuName).Content).GetTab(TextManager.GroupsSettingsName).Content).UpdateAfterReadFile(FileNameWithoutPath);
            }
        }
Exemplo n.º 4
0
 private void WriteToFile(string message)
 {
     try
     {
         using (var file = new StreamWriter(filePath, true, Encoding.Default))
             file.WriteLine(message);
     }
     catch (UnauthorizedAccessException)
     {
         ShowError?.Invoke("Отказано в доступе");
     }
     catch (ArgumentException)
     {
         ShowError?.Invoke("Пустой путь файла");
     }
     catch (DirectoryNotFoundException)
     {
         ShowError?.Invoke("Указан недопустимый путь к файлу");
     }
     catch (IOException)
     {
         ShowError?.Invoke("Неверный или недопустимый синтаксис имени файла, каталога или диска");
     }
     catch (SecurityException)
     {
         ShowError?.Invoke("У вызывающего кода отсутствуют необходимые разрешения");
     }
 }
        private void HexColorTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            string hexColor = HexColorTextBox.Text;

            if (hexColor.Length == 4 || hexColor.Length == 7 || hexColor.Length == 9)
            {
                Regex regex = new Regex(@"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}|[a-fA-F0-9]{8})");
                if (regex.IsMatch(hexColor))
                {
                    HexColorTextBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ColorManager.Secondary900));
                    try
                    {
                        ColorPicker.Color = (Color)ColorConverter.ConvertFromString(hexColor);
                    }
                    catch (Exception exception)
                    {
                        ShowError.ShowErrorMessage(exception.Message);
                    }
                }
                else
                {
                    HexColorTextBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ColorManager.Primary900));
                }
            }
            else
            {
                HexColorTextBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ColorManager.Primary900));
            }
        }
Exemplo n.º 6
0
 public Form1()
 {
     InitializeComponent();
     showError += new ShowError(ShowErrorByConsole);
     showError += new ShowError(ShowErrorByMessageBox);
     pictureBoxPreviewInitSize = pictureBoxPreview.Size;
 }
Exemplo n.º 7
0
    public void SetAdditionalGroupName(GroupID group, InputField name, InputField link)
    {
        if ((name.text == "" || name.text == " ") || link.text == "" || link.text == " ")
        {
            switch (PlayerPrefs.GetString("Localization"))
            {
            case "rus": ShowError.Show("Оба поля должны быть заполнены!"); break;

            case "ukr": ShowError.Show("Обидва поля мають бути заповнені!"); break;

            case "eng": ShowError.Show("Both fields must be filled out!"); break;
            }
            return;
        }
        var    request    = "aGroupId=" + group.ID + "&newName=" + name.text + "&newLink=" + link.text;
        string requestUrl = string.Format(NetworkRequests.SetAdditionalGroupName + request, RequestSendHandler.BaseServerUrl);

        var uri = new Uri(requestUrl);

        clickedAdditionalGroupID = group;
        var token = LoginController.TokenType + " " + LoginController.UserToken;


        RequestSendHandler.RequestTypeInt = 29;
        RequestSendHandler.SendRequest(uri, "", HttpMethod.Get, ContentType.ApplicationJson, token);
    }
Exemplo n.º 8
0
        private void button2_Click(object sender, EventArgs e)
        {
            string[]  files = textBox1.Text.Split(';');
            string[]  typs  = textBox2.Text.Split(';');
            ShowError se    = mbox;

            libs.head(se, checkBox1.Checked, new List <string>(typs), files);
        }
 public void Dispose()
 {
     isBusy?.Dispose();
     items?.Dispose();
     disposables?.Dispose();
     ShowError?.Dispose();
     Fetch?.Dispose();
 }
Exemplo n.º 10
0
 public ProfileManager(WindowMonitor windowMonitor,
                       AudioSwitcher audioSwitcher,
                       IAudioDeviceLister activeDeviceLister,
                       ShowError showError)
 {
     _windowMonitor      = windowMonitor;
     _audioSwitcher      = audioSwitcher;
     _activeDeviceLister = activeDeviceLister;
     _showError          = showError;
 }
Exemplo n.º 11
0
 private void SendrecOnError(string errorText)
 {
     if (InvokeRequired)
     {
         var str = new ShowError(SendrecOnError);
         Invoke(str, errorText);
     }
     else
     {
         MessageBox.Show(errorText);
     }
 }
Exemplo n.º 12
0
 public long Insert(User user)
 {
     try
     {
         db.Users.Add(user);
         db.SaveChanges();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
     {
         ShowError.ErrorMessage(dbEx);
     }
     return(user.UserID);
 }
Exemplo n.º 13
0
 public long Insert(Post post)
 {
     try
     {
         db.Posts.Add(post);
         db.SaveChanges();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
     {
         ShowError.ErrorMessage(dbEx);
     }
     return(post.PostID);
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            typs = new List <string>();
            List <string> files = new List <string>();

            if (args.Length == 0)
            {
                typs.Add(".srt");
                files.Add(Directory.GetCurrentDirectory());
            }
            else
            {
                List <string> tmp = files;
                foreach (string item in args)
                {
                    if (item == "-f" || item == "--files")
                    {
                        tmp = files;
                    }
                    else if (item == "-t" || item == "--types")
                    {
                        tmp = typs;
                    }
                    else if (item == "--no-subdir")
                    {
                        subDir = false;
                    }
                    else
                    {
                        tmp.Add(item);
                    }
                }
                if (files.Count == 0)
                {
                    files.Add(Directory.GetCurrentDirectory());
                }
                if (typs.Count == 0)
                {
                    typs.Add("srt");
                }
                for (int j = typs.Count, i = 0; i < j; i++)
                {
                    typs[i] = $".{typs[i]}";
                }
            }
            ShowError se = Console.WriteLine;

            libs.head(se, subDir, typs, files.ToArray());
            Console.WriteLine("done");
            Console.ReadKey();
        }
Exemplo n.º 15
0
 public bool Create(Contact model)
 {
     try
     {
         db.Contacts.Add(model);
         db.SaveChanges();
         return(true);
     }
     catch (DbEntityValidationException dbEx)
     {
         ShowError.ErrorMessage(dbEx);
         return(false);
     }
 }
Exemplo n.º 16
0
        private static void CurrentDomainOnUnhandledException(
            object sender, UnhandledExceptionEventArgs e)
        {
            var now         = DateTime.UtcNow;
            var logFileName = $"ErrorReport-{now.Year}-{now.Month}-{now.Day}-{now.Hour}-{now.Minute}-{now.Second}-{now.Millisecond}.txt";
            var logFilePath = Path.GetFullPath(Path.Combine(LogDirectory, logFileName));

            try
            {
                Directory.CreateDirectory(LogDirectory);
                using (var file = File.OpenWrite(logFilePath))
                    using (var writer = new StreamWriter(file))
                    {
                        var fileVersionInfo = FileVersionInfo;
                        writer.WriteLine("======================================================");
                        writer.WriteLine("==================== Error Report ====================");
                        writer.WriteLine("======================================================");
                        writer.WriteLine();
                        writer.WriteLine("========== Product Information ==========");
                        writer.WriteLine($"Product Name     {fileVersionInfo.ProductName}");
                        writer.WriteLine($"Company Name     {fileVersionInfo.CompanyName}");
                        writer.WriteLine($"Product Version  {fileVersionInfo.ProductVersion}");
                        writer.WriteLine($"File Version     {fileVersionInfo.FileVersion}");
                        writer.WriteLine();
                        writer.WriteLine("========== Environment Information ==========");
                        writer.WriteLine($"Opering System   {Environment.OSVersion}");
                        writer.WriteLine($"Version          {Environment.Version}");
                        writer.WriteLine($"Current Date     {now.ToString(CultureInfo.InvariantCulture)}");
                        writer.WriteLine();
                        writer.WriteLine("========== Exception ==========");
                        writer.WriteLine((Exception)e.ExceptionObject);
                    }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                ShowError?.Invoke(null, new MessageEventArgs(
                                      "An error has occurred and the application must now close.\n" +
                                      "\n" +
                                      "An error report could not created. The application will now close."));
                return;
            }

            ShowError?.Invoke(null, new MessageEventArgs(
                                  "An error has occurred and the application must now close.\n" +
                                  "\n" +
                                  "A report of this error has been created at the following location:\n\n" +
                                  $"{logFilePath}"));
        }
Exemplo n.º 17
0
 public ProfileManager(ForegroundProcess foregroundProcess,
                       AudioSwitcher audioSwitcher,
                       IAudioDeviceLister activeDeviceLister,
                       ShowError showError)
 {
     _foregroundProcess    = foregroundProcess;
     _audioSwitcher        = audioSwitcher;
     _activeDeviceLister   = activeDeviceLister;
     _showError            = showError;
     _profileByApplication =
         AppConfigs.Configuration.ProfileSettings
         .Where((setting) => setting.ApplicationPath != null)
         .ToDictionary(setting => setting.ApplicationPath !.ToLower());
     _profileByHotkey =
         AppConfigs.Configuration.ProfileSettings
         .Where((setting) => setting.HotKey != null)
         .ToDictionary(setting => setting.HotKey) !;
 }
Exemplo n.º 18
0
 public bool Edit(Contact model)
 {
     try
     {
         var contact = db.Contacts.Find(model.ContactID);
         contact.Email   = model.Email;
         contact.Fax     = model.Fax;
         contact.Phone   = model.Phone;
         contact.Slogan  = model.Slogan;
         contact.Address = model.Address;
         db.Entry(model);
         db.SaveChanges();
         return(true);
     }
     catch (DbEntityValidationException dbEx)
     {
         ShowError.ErrorMessage(dbEx);
         return(false);
     }
 }
Exemplo n.º 19
0
        public MainWindow()
        {
            InitializeComponent();
            CheckEventLog();
            LoadConfig();
            CheckInstanceInitialization();

            m_tbSterowanie.m_mainWnd   = this;
            this.tabSterowanie.Content = m_tbSterowanie;
            m_tbSterowanie.tbFilesCount.DataContext = 0;
            m_tbSerwery.m_mainWnd        = this;
            this.tabSerwery.Content      = m_tbSerwery;
            m_tbHarmonogramy.m_mainWnd   = this;
            this.tabHarmonogramy.Content = m_tbHarmonogramy;

            this.m_showError = this.ShowErrorInfo;
            this.Title       = $"FtpDiligent [instance {m_instance}]";

            m_tbSerwery.LoadEndpoints();
            m_tbHarmonogramy.LoadSchedules(0);
        }
Exemplo n.º 20
0
        private void WorkerDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                ProcessFile(fileName);
            }
            catch (Exception exception)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    ShowError.ShowErrorMessage(exception.Message);
                    processingError = true;
                });
            }

            Application.Current.Dispatcher.Invoke(() =>
            {
                progressBar.Value           = 0;
                progressBar.IsIndeterminate = true;
            });
        }
        //constructor
        public ChatProxy(ShowReceivedMessage srm, ShowError sst, ShowStatusMsg stm, string token, Patient patient, AppSettings settings, string username)
        {
            _patient  = patient;
            _token    = token;
            _settings = settings;
            _username = username;
            //start chat on port 1138 and connect to server
            StartChatServer("1138");
            if (Status)
            {
                //setting method calls
                _srm = srm;
                _sst = sst;
                _stm = stm;

                _clients = new List <Tuple <string, string, HttpClient> >();

                //catching event throwing
                ChatController.ThrowMessageArrivedEvent += (sender, args) => { ShowMessage(args.Message); };
            }
        }
Exemplo n.º 22
0
        public static void head(ShowError errorHandler, bool subDir, List <string> typs, params string[] paths)
        {
            libs.subDir       = subDir;
            libs.typs         = typs;
            libs.errorHandler = errorHandler;

            FileAttributes fattr;

            foreach (string item in paths)
            {
                fattr = File.GetAttributes(item);
                if (fattr.HasFlag(FileAttributes.Directory))
                {
                    find(item);
                }
                else
                {
                    fix(item);
                }
            }
        }
Exemplo n.º 23
0
 public long InsertForFacbook(User user)
 {
     try
     {
         var checkEmail = db.Users.SingleOrDefault(x => x.Email == user.Email);
         if (checkEmail == null)
         {
             db.Users.Add(user);
             db.SaveChanges();
             return(user.UserID);
         }
         else
         {
             return(checkEmail.UserID);
         }
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
     {
         ShowError.ErrorMessage(dbEx);
         return(0);
     }
 }
Exemplo n.º 24
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool status = true;

            try
            {
                string username = txtUserName.Text;
                string password = txtPassword.Text;
                if (username.ToString() == "" && password.ToString() == "")
                {
                    MessageBox.Show("Enter username and password");
                    return;
                }
                else
                {
                    using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                    {
                        PurelifeErpClient.Result res = purelifeErpClient.UserLogin(PurelifeErpClient.PageName.MSTUserDetails, username, password);
                        if (res.Id.ToInt() > 0)
                        {
                            SessionManager.UserCode = res.Id;
                            SessionManager.UserName = username;
                            this.Close();
                            _k.Value = "true";
                            Close();
                        }
                        else
                        {
                            ShowError.SetError(txtPassword, "Please enter correct details");
                            base.ShowMessage("Invalid user, Please enter correct details");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Login failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 25
0
    public void ChangeNickNameTrue()
    {
        string month, year, day;

        string[] time = YearOfBirth.text.Split('/');

        DateTime correctDate;

        if (time.Length < 3)
        {
            ShowError.Show("Не корректно введена дата народження!");
            return;
        }

        print(YearOfBirth.text + DateTime.TryParse(YearOfBirth.text, out correctDate));
        month = time[0];
        day   = time[1];
        year  = time[2];

        if (Nickname.text == "" || day == "" || day.Contains("/") || month == "" || month.Contains("/") || year == "" ||
            year.Contains("/") || DateTime.TryParse(YearOfBirth.text, out correctDate) == false)
        {
            ShowError.Show("Не корректно введена дата народження!");
            return;
        }

        string requestUrl = string.Format(NetworkRequests.NickNameChangeRequest, RequestSendHandler.BaseServerUrl);

        var uri = new Uri(requestUrl);

        _rNickname = new RequestNickName {
            Name = Nickname.text, DateOfBirth = year + "-" + month + "-" + day + " 00:00:00.00"
        };
        RequestSendHandler.RequestTypeInt = 2;
        RequestSendHandler.SendRequest(uri, _rNickname, HttpMethod.Post, ContentType.ApplicationJson, TokenType + " " + UserToken);
    }
Exemplo n.º 26
0
 public static void SendShowError(Exception ex)
 {
     ShowError?.Invoke(null, ex);
 }
Exemplo n.º 27
0
 public override int GetHashCode()
 {
     return(Expand.GetHashCode() ^ Force.GetHashCode() ^ GroupBy.GetHashCode() ^ DisplayError.GetHashCode()
            ^ ShowError.GetHashCode() ^ View.GetHashCode() ^ Properties.GetHashCode());
 }
Exemplo n.º 28
0
 public static void SendShowError(Exception ex)
 {
     Debug.WriteLine(ex.ToString());
     ShowError?.Invoke(null, ex);
 }
Exemplo n.º 29
0
        public static List <AzureIoTHub> GetIotHubList(
            ShowProgress progressCallback,
            ShowError errorCallback,
            RunPSCommand PSCallback)
        {
            List <AzureIoTHub> hubList = new List <AzureIoTHub>();

            try
            {
                if (MSAHelper.Subscriptions.Count == 0)
                {
                    // no subscritions means no IoT Hubs
                    return(hubList);
                }

                double progressPerSubscription = 85.0f / MSAHelper.Subscriptions.Count;
                for (int k = 0; k < MSAHelper.Subscriptions.Count; k++)
                {
                    List <Task> tasks            = new List <Task>();
                    string      subscriptionName = MSAHelper.Subscriptions[k];

                    PSCallback?.Invoke("az account set --subscription '" + subscriptionName + "'");

                    Collection <string> hubListResults = PSCallback?.Invoke("az iot hub list");
                    if (hubListResults != null && hubListResults.Count != 0)
                    {
                        for (int i = 0; i < hubListResults.Count; i++)
                        {
                            string hubName = hubListResults[i];
                            if (hubName.Contains("\"name\""))
                            {
                                hubName = hubName.Substring(hubName.IndexOf(":"));
                                hubName = hubName.Substring(hubName.IndexOf("\"") + 1);
                                hubName = hubName.Substring(0, hubName.IndexOf("\""));

                                // filter
                                if (hubName == "$fallback" || hubName == "S1" || hubName == "F1" || hubName == "B1")
                                {
                                    continue;
                                }

                                tasks.Add(Task.Run(() =>
                                {
                                    Collection <string> results2 = PSCallback("az iot hub show-connection-string --name '" + hubName + "'");
                                    if (results2 != null && results2.Count != 0)
                                    {
                                        for (int j = 0; j < results2.Count; j++)
                                        {
                                            string connectionString = results2[j];
                                            if (connectionString.Contains("\"connectionString\""))
                                            {
                                                // we have access
                                                lock (hubListLock)
                                                {
                                                    hubList.Add(new AzureIoTHub(hubName, subscriptionName));
                                                }
                                            }
                                        }
                                    }
                                }));
                            }
                        }
                    }

                    Task.WhenAll(tasks).Wait();
                    tasks.Clear();
                    progressCallback?.Invoke(progressPerSubscription, false);
                }
            }
            catch (Exception ex)
            {
                errorCallback?.Invoke(ex.Message);
            }

            return(hubList);
        }
        /// <summary>
        /// Builds one <see cref="Chart"/> with the <paramref name="group"/>s values.
        /// </summary>
        /// <param name="group"><see cref="Group"/> that will shown on the <see cref="Chart"/></param>
        /// <returns>A <see cref="Chart"/> with the <paramref name="group"/>s values.</returns>
        private Chart BuildGroupChart(Group group)
        {
            var chart = new Chart(group.Name);

            int dataIndex = (int)DataSlider.Value;

            var addedChannelNames = new List <string>();

            foreach (var channelName in ChannelNames)
            {
                var attribute = group.GetAttribute(channelName.Item1);
                if (attribute != null)
                {
                    foreach (var inputFile in channelName.Item2)
                    {
                        int lineWidth = group.GetAttribute(channelName.Item1).LineWidth;
                        var channel   = GetChannel(inputFile.Item1, channelName.Item1);

                        if (inputFile.Item2) // aktiv e a channel
                        {
                            var actHorizontalAxisData = GetChannel(inputFile.Item1, group.HorizontalAxis).Data;
                            if (actHorizontalAxisData == null)
                            {
                                ShowError.ShowErrorMessage($"Can't find '{group.HorizontalAxis}', so can't show diagram properly");
                            }

                            if (actHorizontalAxisData.Count > horizontalAxisData.Count)
                            {
                                horizontalAxisData = new List <double>(actHorizontalAxisData);
                            }

                            var channelDataPlotData = ConvertChannelDataToPlotData(channel.Data.ToArray(), actHorizontalAxisData);

                            var color = group.GetAttribute(channel.Name).Color;

                            chart.AddPlot(xAxisValues: channelDataPlotData.Item1,
                                          yAxisValues: channelDataPlotData.Item2,
                                          lineWidth: lineWidth,
                                          lineColor: ColorTranslator.FromHtml(color),
                                          xAxisLabel: group.HorizontalAxis);

                            chart.AddSideValue(channelName: channelName.Item1,
                                               xAxisValues: channelDataPlotData.Item2,
                                               isActive: true,
                                               inputFileID: inputFile.Item1,
                                               color: color,
                                               lineWidth: lineWidth);
                        }
                        else
                        {
                            chart.AddSideValue(channelName: channelName.Item1, xAxisValues: new double[0], inputFileID: inputFile.Item1);
                        }

                        chart.AddChannelName(channelName.Item1);

                        addedChannelNames.Add(channelName.Item1);
                    }
                }
            }

            foreach (var attribute in group.Attributes)
            {
                if (!addedChannelNames.Contains(attribute.Name))
                {
                    chart.AddChannelName(attribute.Name);
                    chart.AddSideValue(channelName: attribute.Name, xAxisValues: new double[0]);
                }
            }

            if (horizontalAxisData.Count > 0)
            {
                double xValue = dataIndex < horizontalAxisData.Count ? horizontalAxisData[dataIndex] : horizontalAxisData.Last();
                chart.UpdateHighlight(xValue);
            }

            chart.SetAxisLimitsToAuto();

            return(chart);
        }