internal static void BeforeQueryStatus(object sender) { ThreadHelper.ThrowIfNotOnUIThread(); var menuCommand = sender as OleMenuCommand; menuCommand.Visible = Utility.IsWebResourceExtension(VsixHelper.GetSelectedItemExtension()); }
private void LoadConnections() { ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var devKitConnections = VsixHelper.GetDevKitConnections(); comboBoxSavedConnection.ItemsSource = devKitConnections.CrmConnections; if (devKitConnections.DefaultCrmConnection != null) { comboBoxSavedConnection.SelectedItem = devKitConnections.CrmConnections.FirstOrDefault(x => x.Name == devKitConnections.DefaultCrmConnection); } buttonOK.IsEnabled = comboBoxSavedConnection.Items.Count > 0; }); }
private async Task Analyze(string filePath) { if (null == VsixHelper.GetProjectItem(filePath)) { return; } Cancel(); _source = new CancellationTokenSource(TimeSpan.FromSeconds(10)); await _provider.Analyze(filePath, _source.Token) .ConfigureAwait(false); }
private void ButtonCheckConnection_Click(object sender, System.Windows.RoutedEventArgs e) { if (!IsValid()) { return; } var crmConnection = new CrmConnection { Name = textboxName.Text, Password = comboBoxType.Text == "ClientSecret" ? textboxPassword.Password : EncryptDecrypt.EncryptString(textboxPassword.Password), Type = comboBoxType.Text, Url = textboxUrl.Text, UserName = textboxUser.Text }; stackPanelForm.IsEnabled = false; progressBar.Visibility = System.Windows.Visibility.Visible; _ = Task.Factory.StartNew(() => { var crmServiceClient = XrmHelper.IsConnected(crmConnection); ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); stackPanelForm.IsEnabled = true; progressBar.Visibility = System.Windows.Visibility.Hidden; }); if (crmServiceClient != null) { var devKitConnections = VsixHelper.GetDevKitConnections(); devKitConnections.DefaultCrmConnection = crmConnection.Name; devKitConnections.CrmConnections.Add(crmConnection); VsixHelper.SaveDevKitConnections(devKitConnections); LoadConnections(); ClearData(); } else { ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); await VS.MessageBox.ShowErrorAsync(@"Something wrong with your connection. Please try it again"); }); } }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); }
private bool IsValid() { if (comboBoxType.Text.Length == 0) { VS.MessageBox.ShowError($"Please select Type"); comboBoxType.Focus(); return(false); } if (textboxName.Text.Length == 0) { VS.MessageBox.ShowError($"Please enter {Const.CrmString} Name"); textboxName.Focus(); return(false); } if (textboxUrl.Text.Length == 0) { VS.MessageBox.ShowError("Please enter Url"); textboxUrl.Focus(); return(false); } if (textboxUser.Text.Length == 0) { VS.MessageBox.ShowError($"Please enter {labelUser.Content}"); textboxUser.Focus(); return(false); } if (textboxPassword.Password.Length == 0) { VS.MessageBox.ShowError($"Please enter {labelPassword.Content}"); textboxPassword.Focus(); return(false); } if (VsixHelper.GetDevKitConnections().CrmConnections.Any(x => x.Name == textboxName.Text)) { VS.MessageBox.ShowError($"Name already used"); textboxName.Focus(); return(false); } return(true); }
public override bool TryGetValue(int index, string columnName, out object content) { content = null; if (index < 0 || _markers.Count <= index) { return(false); } var marker = _markers[index]; switch (columnName) { case StandardTableKeyNames.BuildTool: // todo get analyzer name content = Vsix.Name; return(true); case StandardTableKeyNames.Column: var position = marker.Span.Start; var line = position.GetContainingLine(); content = position.Position - line.Start.Position; return(true); case StandardTableKeyNames.DocumentName: content = _filePath; return(null != content); case StandardTableKeyNames.ErrorCodeToolTip: case StandardTableKeyNames.HelpLink: content = GetRuleUrl(marker.Message.IsFatal, marker.Message.RuleId, marker.Message.Message); return(null != content); case StandardTableKeyNames.ErrorCode: content = GetErrorCode(marker.Message.IsFatal, marker.Message.RuleId); return(true); case StandardTableKeyNames.ErrorSeverity: content = GetErrorCategory(marker.Message.IsFatal, marker.Message.Severity); return(true); case StandardTableKeyNames.ErrorSource: content = marker.Message.Source; return(null != content); case StandardTableKeyNames.Line: content = marker.Span.Start.GetContainingLine().LineNumber; return(true); case StandardTableKeyNames.ProjectName: if (string.IsNullOrEmpty(_projectName)) { _projectName = VsixHelper.GetProjectName(_filePath); } content = _projectName; return(null != content); case StandardTableKeyNames.Text: content = marker.Message.Message; return(null != content); default: return(false); } }