protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.PostActivityLayout);

            Task t = Task.Run(async () => 
            {
                var res = await PostAPI.GetPostById(Intent.GetIntExtra("PostID", 0), AppPersistent.UserToken);
                if(res.error)
                {
                    FeedbackHelper.ShowPopup(this, res.message);
                    return;
                }
                m_PostData = res.data[0];
            });

            t.Wait();
            InitContent();
            m_CommentsList = FindViewById<ListView>(Resource.Id.PostCommentsList);
            Button sendBtn = FindViewById<Button>(Resource.Id.PostSendComment);
            sendBtn.Click += SendBtn_Click;
            //t.ContinueWith(ct => InitContent());
            t = Task.Run(async () =>
            {
                var res = await PostAPI.GetCommentsForPost(Intent.GetIntExtra("PostID", 0));
                if(res.error)
                {
                    return;
                }
                m_CommentsList.Adapter = new CommentAdapter(this, res.data);
            });
        }
Exemple #2
0
        private void DrawCurve(DrawingContext dc)
        {
            PathGeometry path    = this.vpFitter.Path;
            Pen          thinPen = FeedbackHelper.GetThinPen(this.ActiveView.Zoom);

            dc.DrawGeometry((Brush)null, thinPen, (System.Windows.Media.Geometry)path);
        }
Exemple #3
0
        public override void Draw(DrawingContext ctx, Matrix matrix)
        {
            if (!this.shouldDraw)
            {
                return;
            }
            bool  flag        = this.AdornerSet is RectangleGeometryAdornerSetBase;
            Point anchorPoint = this.GetAnchorPoint(matrix);
            Brush brush       = this.IsActive ? (flag ? FeedbackHelper.GetActiveBrush(AdornerType.ClipPath) : this.ActiveBrush) : this.InactiveBrush;
            Pen   pen         = flag ? FeedbackHelper.GetThinPen(AdornerType.ClipPath) : this.ThinPen;
            Rect  targetRect  = this.TargetRect;
            AdornerRenderLocation location = AdornerRenderLocation.Outside;

            if (this.DesignerContext.SelectionManager.ElementSelectionSet != null && this.DesignerContext.SelectionManager.ElementSelectionSet.Selection.Count > 1 && !this.ElementSet.AdornsMultipleElements)
            {
                location = AdornerRenderLocation.Inside;
            }
            SizeAdorner.DrawSizeAdorner(ctx, anchorPoint, this.EdgeFlags, matrix, brush, pen, targetRect, location);
            if (!this.IsActive)
            {
                return;
            }
            Matrix transformMatrix = this.ElementSet.GetTransformMatrix(this.DesignerContext.ActiveView.ViewRoot);

            SizeAdorner.DrawDimensions(ctx, matrix, transformMatrix, pen, targetRect, this.EdgeFlags);
        }
Exemple #4
0
 public void Feedback(FeedbackInfo info)
 {
     if (this.observer != null)
     {
         FeedbackHelper.Feedback(this.observer, info);
     }
 }
        public override string ParseDefinition(string definition)
        {
            definition = base.ParseDefinition(definition);

            #region Handle join cluase for mysql which has no "on", so it needs to make up that.
            try
            {
                StringBuilder sb = new StringBuilder();

                if (this.sourceDbInterpreter.GetType() == typeof(MySqlInterpreter))
                {
                    bool   hasError            = false;
                    string formattedDefinition = this.FormatSql(definition, out hasError);

                    if (!hasError)
                    {
                        string[] lines = formattedDefinition.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                        Regex joinRegex = new Regex(@"\b(join)\b", RegexOptions.IgnoreCase);
                        Regex onRegex   = new Regex(@"\b(on)\b", RegexOptions.IgnoreCase);
                        Regex wordRegex = new Regex("([a-zA-Z(]+)", RegexOptions.IgnoreCase);

                        sb = new StringBuilder();
                        foreach (string line in lines)
                        {
                            bool hasChanged = false;

                            if (joinRegex.IsMatch(line))
                            {
                                string leftStr = line.Substring(line.ToLower().LastIndexOf("join") + 4);
                                if (!onRegex.IsMatch(line) && !wordRegex.IsMatch(leftStr))
                                {
                                    hasChanged = true;
                                    sb.AppendLine($"{line} ON 1=1 ");
                                }
                            }

                            if (!hasChanged)
                            {
                                sb.AppendLine(line);
                            }
                        }

                        definition = sb.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                FeedbackInfo info = new FeedbackInfo()
                {
                    InfoType = FeedbackInfoType.Error, Message = ExceptionHelper.GetExceptionDetails(ex), Owner = this
                };
                FeedbackHelper.Feedback(info);
            }
            #endregion

            return(definition.Trim());
        }
Exemple #6
0
        public void Feedback(FeedbackInfoType infoType, string message)
        {
            FeedbackInfo info = new FeedbackInfo() { Owner = this, InfoType = infoType, Message = StringHelper.ToSingleEmptyLine(message) };

            if (this.observer != null)
            {
                FeedbackHelper.Feedback(this.observer, info);
            }
        }
        public override void Draw(DrawingContext drawingContext, Matrix matrix)
        {
            Point pointBegin;
            Point pointEnd;

            this.GetPoints(matrix, out pointBegin, out pointEnd);
            Pen pen = this.dimmed ? FeedbackHelper.GetThinPen(AdornerType.Inactive) : this.ThinPen;

            drawingContext.DrawLine(pen, pointBegin, pointEnd);
        }
Exemple #8
0
 private void SetupFeedback()
 {
     if (!_feedbackPanel)
     {
         _feedbackPanel = _finalScoreFeedbackPanel?.GetComponentInChildren <FeedbackHelper>(true);
     }
     if (!_feedbackElementGameObject)
     {
         _feedbackElementGameObject = Resources.Load <GameObject>("Prefabs/FeedbackElement");
     }
 }
 protected override bool OnDrag(Point dragStartPosition, Point dragCurrentPosition, bool scrollNow)
 {
     if (this.enableAreaZoom)
     {
         SceneView activeView = this.ActiveView;
         activeView.EnsureVisible(dragCurrentPosition, scrollNow);
         FeedbackHelper.DrawDashedRectangle(this.OpenFeedback(), activeView.Zoom, dragStartPosition, dragCurrentPosition);
         this.CloseFeedback();
     }
     return(true);
 }
Exemple #10
0
        private async Task ChangeUserData(ProfileData data)
        {
            var res = await UsersAPI.EditProfile(data, AppPersistent.UserToken);

            if (res.error)
            {
                FeedbackHelper.ShowPopup(Activity, res.message);
            }
            else
            {
                FeedbackHelper.ShowPopup(Activity, "Success");
            }
        }
Exemple #11
0
        internal void SendFeedback()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(UserSettings.All.TemporaryFolderResolved))
                {
                    return;
                }

                var path = Path.Combine(UserSettings.All.TemporaryFolderResolved, "ScreenToGif", "Feedback");

                if (!Directory.Exists(path))
                {
                    return;
                }

                var list = new DirectoryInfo(path).EnumerateFiles("*.html", SearchOption.TopDirectoryOnly);

                foreach (var file in list)
                {
                    //Get zip with same name as file
                    var zip = Path.Combine(file.DirectoryName, file.Name.Replace(".html", ".zip"));

                    List <string> fileList = null;

                    if (File.Exists(zip))
                    {
                        fileList = new List <string> {
                            zip
                        }
                    }
                    ;

                    if (!FeedbackHelper.Send(File.ReadAllText(file.FullName), fileList))
                    {
                        continue;
                    }

                    File.Delete(file.FullName);

                    if (File.Exists(zip))
                    {
                        File.Delete(zip);
                    }
                }
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Automatic feedback");
            }
        }
Exemple #12
0
        public void Feedback(object owner, string content, FeedbackInfoType infoType = FeedbackInfoType.Info, bool enableLog = true, bool suppressError = false)
        {
            FeedbackInfo info = new FeedbackInfo()
            {
                InfoType = infoType, Message = StringHelper.ToSingleEmptyLine(content), Owner = owner
            };

            FeedbackHelper.Feedback(suppressError ? null : this.observer, info, enableLog);

            if (this.OnFeedback != null)
            {
                this.OnFeedback(info);
            }
        }
Exemple #13
0
        private async void ChangeBanner_Click(object sender, EventArgs e)
        {
            var res = await UsersAPI.GetUserProfileByID(AppPersistent.LocalUserId);

            if (!res.error)
            {
                res.data[0].banner = m_ProfilePicURL.Text;
                await ChangeUserData(res.data[0]);
            }
            else
            {
                FeedbackHelper.ShowPopup(Activity, res.message);
            }
        }
        private async void SendBtn_Click(object sender, EventArgs e)
        {
            EditText content = FindViewById<EditText>(Resource.Id.PostCommentText);
            CheckBox anonCheck = FindViewById<CheckBox>(Resource.Id.PostCommentAnon);

            var res = await PostAPI.SendComment(Intent.GetIntExtra("PostID", 0), content.Text, anonCheck.Checked, AppPersistent.UserToken);

            if(res.error)
            {
                FeedbackHelper.ShowPopup(this, res.message);
            }
            else
            {
                FeedbackHelper.ShowPopup(this, "S U C C");
            }
        }
Exemple #15
0
        private void DrawLines(DrawingContext dc)
        {
            if (this.pointList.Count < 2)
            {
                return;
            }
            Pen   thinPen = FeedbackHelper.GetThinPen(this.ActiveView.Zoom);
            Point point0  = this.pointList[0];

            for (int index = 1; index < this.pointList.Count; ++index)
            {
                Point point1 = this.pointList[index];
                dc.DrawLine(thinPen, point0, point1);
                point0 = point1;
            }
        }
        private void DrawFeedback(Point pointBegin, Point pointEnd)
        {
            Rect rect = new Rect(pointBegin, pointEnd);

            this.ToolBehaviorContext.SnappingEngine.UpdateTargetBounds(rect);
            DrawingContext drawingContext = this.OpenFeedback();
            Pen            thinPen        = FeedbackHelper.GetThinPen(this.ActiveView.Zoom);

            System.Windows.Media.Geometry rectangleGeometry = Adorner.GetTransformedRectangleGeometry(this.ActiveView, this.ActiveSceneInsertionPoint.SceneElement, rect, thinPen.Thickness, false);
            drawingContext.DrawGeometry((Brush)null, thinPen, rectangleGeometry);
            if (!Adorner.NonAffineTransformInParentStack(this.ActiveSceneInsertionPoint.SceneElement))
            {
                Matrix computedTransformToRoot = this.ActiveView.GetComputedTransformToRoot(this.ActiveSceneInsertionPoint.SceneElement);
                double scale = 1.0 / this.ActiveView.Zoom;
                SizeAdorner.DrawDimension(drawingContext, ElementLayoutAdornerType.Right, computedTransformToRoot, computedTransformToRoot, thinPen, rect, scale);
                SizeAdorner.DrawDimension(drawingContext, ElementLayoutAdornerType.Bottom, computedTransformToRoot, computedTransformToRoot, thinPen, rect, scale);
            }
            this.CloseFeedback();
        }
        internal async Task ReportOnKnownContactAsync(CandidateMockContactInfo candidate)
        {
            if (IsInit)
            {
                using (var client = new XConnectClient(cfg))
                {
                    var retrievedContact = await RetrieveContactAsync(client, candidate.MarketingIdentifierId);

                    if (retrievedContact != null)
                    {
                        var feedbackHelper = new FeedbackHelper(retrievedContact);
                        feedbackHelper.ReportContactData(client);
                    }
                }
            }
            else
            {
                Console.WriteLine("Broker not init");
            }
        }
        public override void Draw(DrawingContext context, Matrix matrix)
        {
            Point       position;
            double      length;
            Orientation orientation;

            if (this.baseFlowInsertionPoint.IsEmpty || MoveStrategy.GetContainerHost((SceneElement)this.baseFlowInsertionPoint.Element) == null || !this.GetInsertionInfo((SceneElement)this.baseFlowInsertionPoint.Element, this.baseFlowInsertionPoint.Index, this.baseFlowInsertionPoint.IsCursorAtEnd, out position, out length, out orientation))
            {
                return;
            }
            Point point1 = position;
            Point point2 = position;

            switch (orientation)
            {
            case Orientation.Horizontal:
                point2.Y += length;
                break;

            case Orientation.Vertical:
                point2.X += length;
                break;
            }
            Brush  activeBrush = FeedbackHelper.GetActiveBrush(AdornerType.Default);
            Pen    thinPen     = FeedbackHelper.GetThinPen(AdornerType.Default);
            Point  point0      = this.TransformPoint(point1);
            Point  point1_1    = this.TransformPoint(point2);
            Vector vector      = point1_1 - point0;

            if (!Tolerances.NearZero(vector))
            {
                vector.Normalize();
                context.PushTransform((Transform) new MatrixTransform(new Matrix(vector.X, vector.Y, -vector.Y, -vector.X, point0.X, point0.Y)));
                context.DrawGeometry(activeBrush, thinPen, BaseFlowInsertionPointAdorner.ArrowGeometry);
                context.Pop();
                context.PushTransform((Transform) new MatrixTransform(new Matrix(-vector.X, -vector.Y, vector.Y, -vector.X, point1_1.X, point1_1.Y)));
                context.DrawGeometry(activeBrush, thinPen, BaseFlowInsertionPointAdorner.ArrowGeometry);
                context.Pop();
            }
            context.DrawLine(thinPen, point0, point1_1);
        }
Exemple #19
0
 private void Application_CustomizeTemplate(object sender, CustomizeTemplateEventArgs e)
 {
     if (e.Context == TemplateContext.ApplicationWindow)
     {
         if (e.Template is IDockManagerHolder)
         {
             ((IDockManagerHolder)e.Template).DockManager.TopZIndexControls.Add("DevExpress.DXperience.Demos.XafFeedbackPanelControl");
         }
         FeedbackPanel feedbackPanel = FeedbackHelper.AddFeedbackPanelToXtraFrom(e.Template as XtraForm, (string)ConfigurationManager.AppSettings["FeedbackDescription"]);
         if (feedbackPanel != null)
         {
             feedbackPanel.PostFeedback += (s, args) => {
                 FeedbackHelper.PostFeedbackAsync(new FeedbackObject()
                 {
                     ModuleName = (string)ConfigurationManager.AppSettings["FeedbackDemoName"], Feedback = GetOpenedViews() + args.Feedback, Value = args.Value, Email = string.Empty
                 });
                 openedViews.Clear();
             };
         }
     }
 }
        /// <summary>
        /// Initialize page helpers.
        /// </summary>
        public override void InitHelpers()
        {
            /*
             * Base helpers
             */
            base.InitHelpers();

            /*
             * Feedback helper
             */
            Feedback = new FeedbackHelper(Html);

            /*
             * Globalization helper
             */
            var globalizationContext = (ViewContext.HttpContext.Items[nameof(GlobalizationContext)] as GlobalizationContext);

            if (globalizationContext == null)
            {
                throw new ArgumentException(nameof(InitHelpers), new ArgumentNullException(nameof(globalizationContext)));
            }

            Globalization = new GlobalizationHelper(globalizationContext.RegionCulture, globalizationContext.LanguageCulture, globalizationContext.TimeZoneInfo);
        }
Exemple #21
0
        private string ParseDefinition(string definition)
        {
            var tokens = this.ParseTokens(definition);
            bool changed = false;

            definition = this.HandleDefinition(definition, tokens, out changed);



            StringBuilder sb = new StringBuilder();

            bool ignore = false;

            if (changed)
            {
                tokens = this.ParseTokens(definition);
            }

            TSQLTokenType previousType = TSQLTokenType.Whitespace;
            string previousText = "";

            for (int i = 0; i < tokens.Count; i++)
            {
                if (ignore)
                {
                    ignore = false;
                    continue;
                }

                var token = tokens[i];

                var tokenType = token.Type;
                string text = token.Text;

                switch (tokenType)
                {
                    case TSQLTokenType.Identifier:

                        if (dataTypes.Contains(text))
                        {
                            sb.Append(text);
                            continue;
                        }

                        var nextToken = i + 1 < tokens.Count ? tokens[i + 1] : null;

                        //Remove owner name
                        if (nextToken != null && nextToken.Text.Trim() != "(" &&
                            text.Trim('"') == sourceOwnerName && i + 1 < tokens.Count && tokens[i + 1].Text == "."
                            )
                        {
                            ignore = true;
                            continue;
                        }
                        else if (nextToken != null && nextToken.Text.Trim() == "(") //function handle
                        {
                            IEnumerable<FunctionMapping> funcMappings = functionMappings.FirstOrDefault(item => item.Any(t => t.DbType == sourceDbInterpreter.DatabaseType.ToString() && t.Function.Split(',').Any(m => m.ToLower() == text.ToLower())));
                            if (funcMappings != null)
                            {
                                string targetFunction = funcMappings.FirstOrDefault(item => item.DbType == targetDbInterpreter.DatabaseType.ToString())?.Function.Split(',')?.FirstOrDefault();

                                if (!string.IsNullOrEmpty(targetFunction))
                                {
                                    sb.Append(targetFunction);
                                }
                            }
                            else
                            {
                                sb.Append(text);
                            }
                        }
                        else
                        {
                            sb.Append($"{targetDbInterpreter.QuotationLeftChar}{text.Trim('"')}{targetDbInterpreter.QuotationRightChar}");
                        }
                        break;
                    case TSQLTokenType.StringLiteral:
                        if (previousType != TSQLTokenType.Whitespace && previousText.ToLower() == "as")
                        {
                            sb.Append($"{targetDbInterpreter.QuotationLeftChar}{text.Trim('\'', '"')}{targetDbInterpreter.QuotationRightChar}");
                        }
                        else
                        {
                            sb.Append(text);
                        }
                        break;
                    case TSQLTokenType.SingleLineComment:
                    case TSQLTokenType.MultilineComment:
                        continue;
                    case TSQLTokenType.Keyword:
                        switch (text.ToUpper())
                        {
                            case "AS":
                                if (targetDbInterpreter is OracleInterpreter)
                                {
                                    var previousKeyword = (from t in tokens where t.Type == TSQLTokenType.Keyword && t.EndPosition < token.BeginPosition select t).LastOrDefault();
                                    if (previousKeyword != null && previousKeyword.Text.ToUpper() == "FROM")
                                    {
                                        continue;
                                    }
                                }
                                break;
                        }
                        sb.Append(token.Text);
                        break;
                    default:
                        sb.Append(token.Text);
                        break;
                }

                if (!string.IsNullOrWhiteSpace(text))
                {
                    previousText = text;
                    previousType = tokenType;
                }

            }

            definition = sb.ToString();

            #region Handle join cluase for mysql which has no "on", so it needs to make up that.
            try
            {
                if (this.sourceDbInterpreter.GetType() == typeof(MySqlInterpreter))
                {
                    bool hasError = false;
                    string formattedDefinition = this.FormatSql(definition, out hasError);

                    if (!hasError)
                    {
                        string[] lines = formattedDefinition.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                        Regex joinRegex = new Regex("\\b(join)\\b", RegexOptions.IgnoreCase);
                        Regex onRegex = new Regex("\\b(on)\\b", RegexOptions.IgnoreCase);
                        Regex wordRegex = new Regex("([a-zA-Z(]+)", RegexOptions.IgnoreCase);

                        sb = new StringBuilder();
                        foreach (string line in lines)
                        {
                            bool hasChanged = false;

                            if (joinRegex.IsMatch(line))
                            {
                                string leftStr = line.Substring(line.ToLower().LastIndexOf("join") + 4);
                                if (!onRegex.IsMatch(line) && !wordRegex.IsMatch(leftStr))
                                {
                                    hasChanged = true;
                                    sb.AppendLine($"{line} ON 1=1 ");
                                }
                            }

                            if (!hasChanged)
                            {
                                sb.AppendLine(line);
                            }
                        }

                        definition = sb.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                FeedbackInfo info = new FeedbackInfo() { InfoType = FeedbackInfoType.Error, Message = ExceptionHelper.GetExceptionDetails(ex), Owner = this };
                FeedbackHelper.Feedback(info);
            } 
            #endregion

            return definition.Trim();
        }
Exemple #22
0
 private void SendFeedbackButton_Click(object sender, RoutedEventArgs e)
 {
     FeedbackHelper.SendFeedback(FeedbackTextBox.Text);
 }
Exemple #23
0
 public void SendFeedback(string subject = "Feedback", string body = "")
 {
     FeedbackHelper.SendFeedback(subject, body, _publishedAppVersion);
 }