Esempio n. 1
0
        public Toggle(string Text = "", bool InitialValue = false)
        {
            this.Text     = Text;
            ToggleState   = InitialValue;
            ThumbPosition = ToggleState ? 1 : 0;

            MainGrid.Background = BGBrush;
            MainGrid.Focusable  = true;

            Label.HorizontalAlignment        = HorizontalAlignment.Stretch;
            Label.VerticalAlignment          = VerticalAlignment.Stretch;
            Label.HorizontalContentAlignment = HorizontalAlignment.Center;
            Label.VerticalContentAlignment   = VerticalAlignment.Center;
            Label.Foreground = FGBrush;

            MainGrid.Children.Add(Label);

            ThumbHolderGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            ThumbHolderGrid.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

            MainGrid.Children.Add(ThumbHolderGrid);

            ThumbGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            ThumbGrid.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

            ThumbGrid.Background = FGBrush;

            ThumbHolderGrid.Children.Add(ThumbGrid);

            UpdatePosition();
            UpdateSize();
            UpdateColors();

            MainGrid.SizeChanged += (object sender, System.Windows.SizeChangedEventArgs e) =>
            {
                UpdatePosition();
                UpdateSize();
                if (MainGrid.ActualHeight > 1)
                {
                    Label.FontSize = MainGrid.ActualHeight * 0.4;
                }
            };

            MainGrid.MouseMove += (object sender, System.Windows.Input.MouseEventArgs e) =>
            {
                Point pos = e.MouseDevice.GetPosition(MainGrid);
                pos.X /= MainGrid.ActualWidth / 2;
                pos.Y /= MainGrid.ActualHeight / 2;
                pos.X -= 1;
                pos.Y -= 1;

                pos.X *= pos.X;
                pos.Y *= pos.Y;

                pos.X = 1 - pos.X;
                pos.Y = 1 - pos.Y;

                if (GlobalSettings.Animations)
                {
                    Animators.Tail(
                        ShrinkToken,
                        (double x) => { ThumbShrinkage = x; UpdateSize(); },
                        ThumbShrinkage,
                        1 - pos.X * pos.Y
                        );
                }
                else
                {
                    ThumbShrinkage = 1 - pos.X * pos.Y;
                    UpdateSize();
                }
            };

            MainGrid.MouseLeave += (object sender, System.Windows.Input.MouseEventArgs e) =>
            {
                ClickPotential = false;
                if (GlobalSettings.Animations)
                {
                    Animators.Tail(
                        ShrinkToken,
                        (double x) => { ThumbShrinkage = x; UpdateSize(); },
                        ThumbShrinkage,
                        1
                        );
                }
                else
                {
                    ThumbShrinkage = 1;
                    UpdateSize();
                }
            };

            MainGrid.MouseDown += (object sender, System.Windows.Input.MouseButtonEventArgs e) =>
            {
                ClickPotential = true;
                MainGrid.Focus();
            };

            MainGrid.MouseUp += (object sender, System.Windows.Input.MouseButtonEventArgs e) =>
            {
                if (ClickPotential)
                {
                    ClickPotential = false;
                    Value          = !Value;
                }
            };
        }
Esempio n. 2
0
 private void BtnSave_Onclick(object sender, RoutedEventArgs e)
 {
     MainGrid.CommitEdit();
 }
Esempio n. 3
0
 private void ExportExcel_Click(object sender, RoutedEventArgs e)
 {
     MainGrid.ExportExcel("StoresTarget");
 }
Esempio n. 4
0
        public async Task doInstall()
        {
            try
            {
                MainGrid.Focus();
                updateDoing("Contacting GitHub");
                animateProgress(dotProgress, 33);
                RestClient  client   = new RestClient("https://api.github.com/repos/dothq/browser/");
                RestRequest request  = new RestRequest("releases");
                var         response = await client.ExecuteAsync(request);

                if (!response.Content.StartsWith("["))
                {
                    throw new Exception("Server sent an invalid response");
                }
                updateDoing("Parsing Data");
                animateProgress(dotProgress, 66);
                Debug.WriteLine(response.Content);
                JArray  releases      = JArray.Parse(response.Content);
                JObject latestRelease = releases[0].Value <JObject>();
                JArray  assets        = latestRelease["assets"].Value <JArray>();
                JObject asset         = null;
                for (int i = 0; i < assets.Count; i++)
                {
                    JObject thisAsset = assets[i].Value <JObject>();
                    if (thisAsset["content_type"].Value <string>() == "application/x-zip-compressed")
                    {
                        asset = thisAsset;
                        break;
                    }
                }
                if (asset == null)
                {
                    throw new Exception("Unable to find archive");
                }
                updateDoing("Downloading archive");
                animateProgress(dotProgress, 100);
                WebClient dlClient   = new WebClient();
                DateTime  lastUpdate = DateTime.Now;
                dlClient.DownloadProgressChanged += (object sender, DownloadProgressChangedEventArgs e) =>
                {
                    if (lastUpdate.Second == DateTime.Now.Second)
                    {
                        return;
                    }
                    lastUpdate = DateTime.Now;
                    Debug.WriteLine("Downloaded  " + (double)e.BytesReceived);
                    Debug.WriteLine("To Download " + (double)e.TotalBytesToReceive);
                    Debug.WriteLine("Percent     " + ((100 * e.BytesReceived / e.TotalBytesToReceive)).ToString());
                    animateProgress(dotProgress, Convert.ToInt32(((100 * e.BytesReceived / e.TotalBytesToReceive) + 100)));
                };
                string tempFileName = System.IO.Path.GetTempFileName();
                await dlClient.DownloadFileTaskAsync(new Uri(asset["browser_download_url"].Value <string>()), tempFileName);

                if (Directory.Exists(InstallationPath))
                {
                    deleteFolder(InstallationPath);
                }
                Directory.CreateDirectory(InstallationPath);
                updateDoing("Unpacking");
                ZipFile.ExtractToDirectory(tempFileName, InstallationPath);

                string   DotBinary = "";
                string[] files     = Directory.GetFiles(InstallationPath);
                for (int i = 0; i < files.Length; i++)
                {
                    if (files[i].EndsWith(".exe"))
                    {
                        DotBinary = files[i];
                    }
                }

                if (createShortcut)
                {
                    updateDoing("Creating Shortcut");
                    object       shDesktop = "Desktop";
                    WshShell     shell     = new WshShell();
                    IWshShortcut shortcut  = (IWshShortcut)shell.CreateShortcut((string)shell.SpecialFolders.Item(ref shDesktop) + @"\Dot Browser.lnk");
                    shortcut.Description = "Start Dot Browser";
                    shortcut.TargetPath  = DotBinary;
                    shortcut.Save();
                }

                updateDoing("Dot is now installed");
                animateProgress(dotProgress, 300, 1000);
                animate(dotProgress, false, 1000);
                await Task.Delay(1000);

                Process.Start(DotBinary);
                await Task.Delay(5000);

                Process.GetCurrentProcess().Kill();
            }
            catch (Exception e)
            {
                updateDoing(e.Message);
                Close.Visibility       = Visibility.Visible;
                dotProgress.Foreground = Brushes.Red;
            }
        }
Esempio n. 5
0
 private void Window_MouseDown(object sender, MouseButtonEventArgs e)
 {
     MainGrid.Focus();
 }
Esempio n. 6
0
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            StatusBand.Hide();

            #region Validation

            if (TitleTextBox.Text.Length == 0)
            {
                StatusBand.Warning(FindResource("Feedback.Warning.Title") as string);
                TitleTextBox.Focus();
                return;
            }

            if (MessageTextBox.Text.Length == 0)
            {
                StatusBand.Warning(FindResource("Feedback.Warning.Message") as string);
                MessageTextBox.Focus();
                return;
            }

            if (string.IsNullOrWhiteSpace(Secret.Password))
            {
                Dialog.Ok("Feedback", "You are probably running from the source code", "Please, don't try to log into the account of the e-mail sender. " +
                          "Everytime someone does that, the e-mail gets locked and this feature (the feedback) stops working.", Dialog.Icons.Warning);
                return;
            }

            #endregion

            #region UI

            StatusBand.Info(FindResource("Feedback.Sending").ToString());

            Cursor             = Cursors.AppStarting;
            MainGrid.IsEnabled = false;
            MainGrid.UpdateLayout();

            #endregion

            //Please, don't try to log with this e-mail and password. :/
            //Everytime someone does this, I have to change the password and the Feedback feature stops working until I update the app.
            var passList = Secret.Password.Split('|');

            var smtp = new SmtpClient
            {
                Timeout               = 5 * 60 * 1000, //Minutes, seconds, miliseconds
                Port                  = Secret.Port,
                Host                  = Secret.Host,
                EnableSsl             = true,
                UseDefaultCredentials = true,
                Credentials           = new NetworkCredential(Secret.Email, passList[_current])
            };

            //Please, don't try to log with this e-mail and password. :/
            //Everytime someone does this, I have to change the password and the Feedback feature stops working until I update the app.
            var mail = new MailMessage
            {
                From       = new MailAddress("*****@*****.**"),
                Subject    = "ScreenToGif - Feedback",
                IsBodyHtml = true
            };

            mail.To.Add("*****@*****.**");

            #region Text

            var sb = new StringBuilder();
            sb.Append("<html xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\">");
            sb.Append("<head><meta content=\"en-us\" http-equiv=\"Content-Language\" />" +
                      "<meta content=\"text/html; charset=utf-16\" http-equiv=\"Content-Type\" />" +
                      "<title>Screen To Gif - Feedback</title>" +
                      "</head>");

            sb.AppendFormat("<style>{0}</style>", Util.Other.GetTextResource("ScreenToGif.Resources.Style.css"));

            sb.Append("<body>");
            sb.AppendFormat("<h1>{0}</h1>", TitleTextBox.Text);
            sb.Append("<div id=\"content\"><div>");
            sb.Append("<h2>Overview</h2>");
            sb.Append("<div id=\"overview\"><table><tr>");
            sb.Append("<th _locid=\"UserTableHeader\">User</th>");

            if (MailTextBox.Text.Length > 0)
            {
                sb.Append("<th _locid=\"FromTableHeader\">Mail</th>");
            }

            sb.Append("<th _locid=\"VersionTableHeader\">Version</th>");
            sb.Append("<th _locid=\"WindowsTableHeader\">Windows</th>");
            sb.Append("<th _locid=\"BitsTableHeader\">Instruction Size</th>");
            sb.Append("<th _locid=\"MemoryTableHeader\">Working Memory</th>");
            sb.Append("<th _locid=\"IssueTableHeader\">Issue?</th>");
            sb.Append("<th _locid=\"SuggestionTableHeader\">Suggestion?</th></tr>");
            sb.AppendFormat("<tr><td class=\"textcentered\">{0}</td>", Environment.UserName);

            if (MailTextBox.Text.Length > 0)
            {
                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", MailTextBox.Text);
            }

            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Assembly.GetExecutingAssembly().GetName().Version.ToString(4));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.OSVersion.VersionString);
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.Is64BitOperatingSystem ? "64 bits" : "32 Bits");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Humanizer.BytesToString(Environment.WorkingSet));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", IssueCheckBox.IsChecked.Value ? "Yes" : "No");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr></table></div></div>", SuggestionCheckBox.IsChecked.Value ? "Yes" : "No");

            sb.Append("<h2>Details</h2><div><div><table>");
            sb.Append("<tr id=\"ProjectNameHeaderRow\"><th class=\"messageCell\" _locid=\"MessageTableHeader\">Message</th></tr>");
            sb.Append("<tr name=\"MessageRowClassProjectName\">");
            sb.AppendFormat("<td class=\"messageCell\">{0}</td></tr></table>", MessageTextBox.Text);
            sb.Append("</div></div></div></body></html>");

            #endregion

            mail.Body = sb.ToString();

            foreach (AttachmentListBoxItem attachment in AttachmentListBox.Items)
            {
                mail.Attachments.Add(new Attachment(attachment.Attachment));
            }

            smtp.SendCompleted += Smtp_OnSendCompleted;
            smtp.SendMailAsync(mail);
        }
        private async void MonthChanged(object sender, EventArgs e)
        {
            await PrepareGrid();

            await MainGrid.FadeTo(1, 500, Easing.Linear);
        }
Esempio n. 8
0
 private void MainGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e)
 {
     MainGrid.CommitEdit();
 }
Esempio n. 9
0
        public void MatrixAnimationUsingPathDoesRotateWithTangentExample()
        {
            // Create a NameScope for the page so that
            // we can use Storyboards.
            NameScope.SetNameScope(MainGrid, new NameScope());

            // Create a button.
            Map.MapBlock aButton = new Map.MapBlock();
            aButton.LeftSideVisable  = true;
            aButton.RightSideVisable = true;
            // Create a MatrixTransform. This transform
            // will be used to move the button.
            MatrixTransform buttonMatrixTransform = new MatrixTransform();

            aButton.RenderTransform = buttonMatrixTransform;

            // Register the transform's name with the page
            // so that it can be targeted by a Storyboard.
            MainGrid.RegisterName("ButtonMatrixTransform", buttonMatrixTransform);

            // Create a Canvas to contain the button
            // and add it to the page.
            // Although this example uses a Canvas,
            // any type of panel will work.
            Canvas mainPanel = new Canvas();

            mainPanel.Width  = 400;
            mainPanel.Height = 400;
            mainPanel.Children.Add(aButton);
            MainGrid.Children.Add(mainPanel);

            // Create the animation path.
            PathGeometry animationPath = new PathGeometry();
            PathFigure   pFigure       = new PathFigure();

            pFigure.StartPoint = new Point(10, 100);
            PolyBezierSegment pBezierSegment = new PolyBezierSegment();

            pBezierSegment.Points.Add(new Point(35, 0));
            pBezierSegment.Points.Add(new Point(135, 0));
            pBezierSegment.Points.Add(new Point(160, 100));
            pBezierSegment.Points.Add(new Point(180, 190));
            pBezierSegment.Points.Add(new Point(285, 200));
            pBezierSegment.Points.Add(new Point(310, 100));
            pFigure.Segments.Add(pBezierSegment);
            animationPath.Figures.Add(pFigure);

            // Freeze the PathGeometry for performance benefits.
            animationPath.Freeze();

            // Create a MatrixAnimationUsingPath to move the
            // button along the path by animating
            // its MatrixTransform.
            MatrixAnimationUsingPath matrixAnimation =
                new MatrixAnimationUsingPath();

            matrixAnimation.PathGeometry   = animationPath;
            matrixAnimation.Duration       = TimeSpan.FromSeconds(5);
            matrixAnimation.RepeatBehavior = RepeatBehavior.Forever;

            // Set the animation's DoesRotateWithTangent property
            // to true so that rotates the rectangle in addition
            // to moving it.
            matrixAnimation.DoesRotateWithTangent = true;

            // Set the animation to target the Matrix property
            // of the MatrixTransform named "ButtonMatrixTransform".
            Storyboard.SetTargetName(matrixAnimation, "ButtonMatrixTransform");
            Storyboard.SetTargetProperty(matrixAnimation,
                                         new PropertyPath(MatrixTransform.MatrixProperty));

            // Create a Storyboard to contain and apply the animation.
            Storyboard pathAnimationStoryboard = new Storyboard();

            pathAnimationStoryboard.Children.Add(matrixAnimation);

            // Start the storyboard when the button is loaded.
            aButton.Loaded += delegate(object sender, RoutedEventArgs e)
            {
                // Start the storyboard.
                pathAnimationStoryboard.Begin(MainGrid);
            };
        }
Esempio n. 10
0
 private void Button_OnClicked(object sender, EventArgs e)
 {
     MainGrid.TranslateTo(200, 300, 1000, Easing.Linear);
 }
Esempio n. 11
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     MainGrid.ClearShapes();
 }
Esempio n. 12
0
        public async void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            stopwatch.Start();
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                if (Math.Abs(e.TotalX) > Math.Abs(e.TotalY) && MainGrid.TranslationY == 0)
                {
                    MainGrid.TranslationX =
                        Math.Min(MainGrid.TranslationX + e.TotalX, Application.Current.MainPage.Width);
                    MainGrid1.TranslationX =
                        Math.Min(MainGrid1.TranslationX + e.TotalX, Application.Current.MainPage.Width);
                    MainGrid2.TranslationX =
                        Math.Max(MainGrid2.TranslationX + e.TotalX, 0);
                    //Content.TranslationY =
                    //  Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs(Content.Height - App.ScreenHeight));
                    break;
                }
                else if (MainGrid.TranslationX == 0 && e.TotalY < 0)
                {
                    MainGrid.TranslationY =
                        Math.Max(MainGrid.TranslationY + e.TotalY, -Application.Current.MainPage.Height);
                    break;
                }
                break;



            case GestureStatus.Completed:
                // Store the translation applied during the pan
                stopwatch.Stop();
                double time   = Convert.ToDouble(stopwatch.ElapsedMilliseconds);
                double speedx = MainGrid.TranslationX / time;
                double speedy = MainGrid.TranslationY / time;

                stopwatch.Reset();
                if (-MainGrid.TranslationX > (HalfWidth) && (MainGrid.TranslationX < 0) || speedx < -1)
                {
                    NextTapped(null, null);
                    MainGrid.TranslateTo(-(Application.Current.MainPage.Width), 0);

                    await MainGrid2.TranslateTo(0, 0);

                    TranslateOriginal();
                }
                else if (MainGrid.TranslationX > (HalfWidth) || Math.Abs(speedx) > 1)
                {
                    PlayPreviousitem();
                    MainGrid.TranslateTo(Application.Current.MainPage.Width, 0);

                    await MainGrid1.TranslateTo(0, 0);

                    TranslateOriginal();
                }
                else if (-MainGrid.TranslationY > App.Current.MainPage.Height / 4 || speedy < -1)
                {
                    MainGrid.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);
                    await ControlsLayout.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);

                    UpSvg.RotateTo(180);
                    MainCollectionView.Margin    = new Thickness(0, ControlsLayout.Height, 0, 0);
                    MainCollectionView.IsVisible = true;
                    //CollectionStack.TranslateTo(0,-((ControlsLayout.Height) - App.Current.MainPage.Height));
                }
                else
                {
                    TranslateOriginalAnimate();
                }
                break;
            }
        }
 public void OnParentGridRowEntered()
 {
     AddDataForSetList();
     CreateControllers(typeof(SetList));
     Assert.IsFalse(MainGrid.Focused, "MainGrid.Focused initially");
     Assert.IsFalse(ParentGrid.Focused, "ParentGrid.Focused initially");
     Assert.IsFalse(MainGridController.IsFixingFocus, "IsFixingFocus initially");
     MainGrid.Focus();
     Assert.AreEqual(1, View.SetMouseCursorToDefaultCount,
                     "SetMouseCursorToDefaultCount after focusing main grid");
     Controller.Populate(); // Populate parent and main grids
     Assert.AreEqual("Event 2 of 2", View.StatusBarText,
                     "StatusBarText after Populate");
     Assert.AreEqual(1, View.OnParentAndMainGridsShownAsyncCount,
                     "OnParentAndMainGridsShownAsyncCount after Populate");
     Assert.IsFalse(MainGrid.Focused, "MainGrid.Focused after Populate");
     Assert.IsTrue(ParentGrid.Focused, "ParentGrid.Focused after Populate");
     Assert.AreEqual(2, MainGrid.CellColorScheme.InvertCount,
                     "MainGrid.CellColorScheme.InvertCount after Populate");
     Assert.AreEqual(2, ParentGridController.BindingList.Count,
                     "Parent list count after Populate");
     Assert.AreEqual(2, MainGridController.FirstVisibleColumnIndex,
                     "Main grid FirstVisibleColumnIndex after Populate");
     Assert.IsFalse(MainGridController.GetBindingColumn("Date").IsVisible,
                    "Is Date column to be shown?");
     Assert.IsTrue(MainGridController.GetBindingColumn("SetNo").IsVisible,
                   "Is SetNo column to be shown?");
     Assert.AreEqual(6, MainGridController.BindingList.Count,
                     "Main list count after Populate"); // Includes new row
     Assert.IsTrue(MainGridController.IsFixingFocus, "IsFixingFocus after Populate");
     Assert.AreEqual(0, ParentGridController.FirstVisibleColumnIndex,
                     "Main grid FirstVisibleColumnIndex after Populate");
     Assert.AreEqual(2, View.SetMouseCursorToDefaultCount,
                     "SetMouseCursorToDefaultCount after Populate");
     // Emulate the unwanted internal logic of DataGridView that, following the end of
     // Populate, causes an extra validation of the first main grid row, even though the
     // parent grid is focused.  Without the workaround we are about to test, this
     // would switch focus to the main grid and make its first row current, neither of
     // which we want. See the documentation for MainGridController.IsFixingFocus.
     MainGridController.OnRowValidated(0);
     // Confirm that the workaround was executed.
     Assert.IsFalse(MainGridController.IsFixingFocus,
                    "IsFixingFocus after OnRowValidated");
     MainGrid.Focus();
     Assert.AreEqual("Set 6 of 6", View.StatusBarText,
                     "StatusBarText when main grid focused");
     MainGridController.OnRowEnter(1);
     Assert.AreEqual("Set 2 of 6", View.StatusBarText,
                     "StatusBarText when 2nd main grid row entered");
     ParentGrid.Focus();
     Assert.AreEqual("Event 2 of 2", View.StatusBarText,
                     "StatusBarText after focusing parent grid");
     ParentGridController.OnRowEnter(0);
     Assert.AreEqual("Event 1 of 2", View.StatusBarText,
                     "StatusBarText when 1st parent selected");
     Assert.AreEqual(4, MainGridController.BindingList.Count,
                     "Main list count when 1st parent selected"); // Includes insertion row
     View.StatusBarText = string.Empty;                           // Simulates editor window deactivated.
     ParentGridController.OnWindowActivated();
     Assert.AreEqual("Event 1 of 2", View.StatusBarText,
                     "StatusBarText when editor window reactivated");
 }
Esempio n. 14
0
        public Button(string Text = "")
        {
            this.Text = Text;

            MainGrid.Background = BGBrush;
            MainGrid.Focusable  = true;

            Label.HorizontalAlignment        = HorizontalAlignment.Stretch;
            Label.VerticalAlignment          = VerticalAlignment.Stretch;
            Label.HorizontalContentAlignment = HorizontalAlignment.Center;
            Label.VerticalContentAlignment   = VerticalAlignment.Center;
            Label.Padding = new Thickness(0);

            Label.Foreground = FGBrush;

            MainGrid.Children.Add(Label);

            MainGrid.SizeChanged += (object sender, System.Windows.SizeChangedEventArgs e) =>
            {
                if (MainGrid.ActualHeight > 1)
                {
                    Label.FontSize = MainGrid.ActualHeight * 0.5;
                }
            };

            MainGrid.MouseEnter += (object sender, System.Windows.Input.MouseEventArgs e) =>
            {
                if (GlobalSettings.Animations)
                {
                    Animators.Animate(
                        HToken,
                        (double h) => { H = h; UpdateColors(); },
                        GlobalSettings.AnimationSpeed * 2,
                        H, 1);
                }
                else
                {
                    H = 1; UpdateColors();
                }
            };

            MainGrid.MouseLeave += (object sender, System.Windows.Input.MouseEventArgs e) =>
            {
                if (GlobalSettings.Animations)
                {
                    Animators.Animate(
                        HToken,
                        (double h) => { H = h; UpdateColors(); },
                        GlobalSettings.AnimationSpeed,
                        H, 0);
                    if (ClickPotential)
                    {
                        Animators.AnimateNatural(
                            PToken,
                            (double p) => { P = p; UpdateColors(); },
                            GlobalSettings.AnimationSpeed / 2,
                            P, 0);
                    }
                }
                else
                {
                    H = 0;
                    P = 0;
                    UpdateColors();
                }
                ClickPotential = false;
            };

            MainGrid.MouseDown += (object sender, System.Windows.Input.MouseButtonEventArgs e) =>
            {
                ClickPotential = true;
                if (GlobalSettings.Animations)
                {
                    Animators.Animate(
                        PToken,
                        (double p) => { P = p; UpdateColors(); },
                        GlobalSettings.AnimationSpeed * 4,
                        P, 1);
                }
                else
                {
                    P = 1; UpdateColors();
                }
                MainGrid.Focus();
            };

            MainGrid.MouseUp += (object sender, System.Windows.Input.MouseButtonEventArgs e) =>
            {
                if (ClickPotential)
                {
                    ClickPotential = false;
                    OnClick?.Invoke();
                }
                if (GlobalSettings.Animations)
                {
                    Animators.Animate(
                        PToken,
                        (double p) => { P = p; UpdateColors(); },
                        PSpeed,
                        P, 0);
                }
                else
                {
                    P = 0; UpdateColors();
                }
            };
        }
Esempio n. 15
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("DisplayName", typeof(string));
            dt.Columns.Add("PrimaryName", typeof(string));
            dt.Columns.Add("RelatedName", typeof(string));
            dt.Columns.Add("FieldTypeImageUrl", typeof(string));
            dt.Columns.Add("EditLink", typeof(string));
            dt.Columns.Add("IsSystem", typeof(bool));

            foreach (MetaField field in mc.FindReferencesTo(true))
            {
                // don't process references from bridges
                if (field.Owner.IsBridge)
                {
                    continue;
                }

                DataRow row = dt.NewRow();
                row["Name"] = String.Format(CultureInfo.InvariantCulture,
                                            "{0},{1}",
                                            field.Owner.Name,
                                            field.Name);

                // DisplayName - get from attribute or use PluralName
                if (!String.IsNullOrEmpty(field.Attributes.GetValue <string>(McDataTypeAttribute.ReferenceDisplayBlock, string.Empty)) &&
                    field.Attributes.ContainsKey(McDataTypeAttribute.ReferenceDisplayText))
                {
                    row["DisplayName"] = CHelper.GetResFileString(field.Attributes[McDataTypeAttribute.ReferenceDisplayText].ToString());
                }
                else
                {
                    row["DisplayName"] = CHelper.GetResFileString(field.Owner.PluralName);
                }

                // PrimaryName - current class
                row["PrimaryName"] = CHelper.GetResFileString(mc.FriendlyName);

                // RelatedName - link
                row["RelatedName"] = CHelper.GetMetaClassAdminPageLink(field.Owner, this.Page);

                // FieldTypeImageUrl
                string postfix = string.Empty;
                if (field.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                {
                    postfix = "_sys";
                }

                row["FieldTypeImageUrl"] = String.Format(CultureInfo.InvariantCulture,
                                                         "~/images/IbnFramework/metainfo/backreference{0}.gif",
                                                         postfix);

                // Edit - we use related class and related field as params
                row["EditLink"] = String.Format(CultureInfo.InvariantCulture,
                                                "{0}?class={1}&refclass={2}&reffield={3}&mode=1N",
                                                EditFieldLink,
                                                mc.Name,
                                                field.Owner.Name,
                                                field.Name);

                // IsSystem
                row["IsSystem"] = field.Attributes.ContainsKey(MetaClassAttribute.IsSystem) || field.Owner.TitleFieldName == field.Name;

                dt.Rows.Add(row);
            }

            DataView dv = dt.DefaultView;

            if (_pc[sortKey] == null)
            {
                _pc[sortKey] = "DisplayName";
            }

            dv.Sort = _pc[sortKey];

            MainGrid.DataSource = dv;
            MainGrid.DataBind();

            foreach (GridViewRow row in MainGrid.Rows)
            {
                ImageButton ib = (ImageButton)row.FindControl("DeleteButton");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");
                }
            }
        }
Esempio n. 16
0
        private void BindGrid()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Title", typeof(string)));
            dt.Columns.Add(new DataColumn("Day1", typeof(string)));
            dt.Columns.Add(new DataColumn("Day2", typeof(string)));
            dt.Columns.Add(new DataColumn("Day3", typeof(string)));
            dt.Columns.Add(new DataColumn("Day4", typeof(string)));
            dt.Columns.Add(new DataColumn("Day5", typeof(string)));
            dt.Columns.Add(new DataColumn("Day6", typeof(string)));
            dt.Columns.Add(new DataColumn("Day7", typeof(string)));
            dt.Columns.Add(new DataColumn("DayT", typeof(string)));
            dt.Columns.Add(new DataColumn("StateFriendlyName", typeof(string)));

            MetaView currentView = GetMetaView();

            currentView.Filters = GetFilters();

            McMetaViewPreference currentPreferences = Mediachase.UI.Web.Util.CommonHelper.CreateDefaultReportPreferenceTimeTracking(currentView);

            MetaObject[] list = null;
            if (String.Compare(Mediachase.IBN.Business.Configuration.Domain, "ibn47.mediachase.net", true) == 0)
            {
                list = currentView.List(currentPreferences, McRoundValues);

                // For Excel
                for (int i = 1; i <= 8; i++)
                {
                    MainGrid.Columns[i].ItemStyle.CssClass = "TdTextClass";
                }
            }
            else
            {
                list = currentView.List(currentPreferences);
            }

            foreach (MetaObject mo in list)
            {
                DataRow row = dt.NewRow();

                string additionalTitle = string.Empty;
                string prefix          = "";
                string postfix         = "";

                if (cbShowWeekNumber.Checked && mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() != MetaViewGroupByType.Total.ToString())
                {
                    DateTime dtNew = DateTime.MinValue;

                    try
                    {
                        dtNew = (DateTime)mo.Properties["Title"].Value;
                    }
                    catch
                    {
                    }

                    if (dtNew != DateTime.MinValue)
                    {
                        additionalTitle = string.Format("(#{0})", Iso8601WeekNumber.GetWeekNumber((DateTime)mo.Properties["Title"].Value));
                    }
                }

                if (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Primary.ToString())
                {
                    prefix  = "<b>";
                    postfix = "</b>";
                    if (GroupingList.SelectedValue == GroupingWeekUser)
                    {
                        row["Title"] = String.Format("{0}{1} - {2}{3} {4}", prefix, ((DateTime)mo.Properties["Title"].Value).ToString("d MMM yyyy"), ((DateTime)mo.Properties["Title"].Value).AddDays(6).ToString("d MMM yyyy"), prefix, additionalTitle);
                    }
                    else
                    {
                        row["Title"] = String.Format("{0}{1}{2} {3}", prefix, mo.Properties["Title"].Value.ToString(), postfix, additionalTitle);
                    }
                }
                else if (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Secondary.ToString())
                {
                    prefix  = "<b>";
                    postfix = "</b>";
                    if (GroupingList.SelectedValue == GroupingUserWeek)
                    {
                        row["Title"] = String.Format("<div style='padding-left: 25px;'>{0}{1} - {2}{3} {4}</div>", prefix, ((DateTime)mo.Properties["Title"].Value).ToString("d MMM yyyy"), ((DateTime)mo.Properties["Title"].Value).AddDays(6).ToString("d MMM yyyy"), prefix, additionalTitle);
                    }
                    else
                    {
                        row["Title"] = String.Format("<div style='padding-left: 25px;'>{0}{1}{2} {3}</div>", prefix, mo.Properties["Title"].Value.ToString(), postfix, additionalTitle);
                    }
                }
                else if (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Total.ToString())
                {
                    prefix       = "<b>";
                    postfix      = "</b>";
                    row["Title"] = String.Format("{0}{1}{2} {3}", prefix, mo.Properties["Title"].Value.ToString(), postfix, additionalTitle);
                }
                else
                {
                    row["Title"] = String.Format("<div style='padding-left: 50px;'>{0} {1}</div>", mo.Properties["Title"].Value.ToString(), additionalTitle);
                }

                if (String.Compare(Mediachase.IBN.Business.Configuration.Domain, "ibn47.mediachase.net", true) == 0)
                {
                    if (mo.Properties["MetaViewGroupByType"] == null || (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Total.ToString()) || (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Secondary.ToString()))
                    {
                        row["Day1"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day1"].Value) / 60.0, postfix);
                        row["Day2"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day2"].Value) / 60.0, postfix);
                        row["Day3"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day3"].Value) / 60.0, postfix);
                        row["Day4"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day4"].Value) / 60.0, postfix);
                        row["Day5"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day5"].Value) / 60.0, postfix);
                        row["Day6"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day6"].Value) / 60.0, postfix);
                        row["Day7"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["Day7"].Value) / 60.0, postfix);
                        row["DayT"] = String.Format("{0}{1:F2}{2}", prefix, Convert.ToInt32(mo.Properties["DayT"].Value) / 60.0, postfix);
                    }
                }
                else
                {
                    row["Day1"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day1"].Value) / 60, Convert.ToInt32(mo.Properties["Day1"].Value) % 60, postfix);
                    row["Day2"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day2"].Value) / 60, Convert.ToInt32(mo.Properties["Day2"].Value) % 60, postfix);
                    row["Day3"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day3"].Value) / 60, Convert.ToInt32(mo.Properties["Day3"].Value) % 60, postfix);
                    row["Day4"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day4"].Value) / 60, Convert.ToInt32(mo.Properties["Day4"].Value) % 60, postfix);
                    row["Day5"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day5"].Value) / 60, Convert.ToInt32(mo.Properties["Day5"].Value) % 60, postfix);
                    row["Day6"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day6"].Value) / 60, Convert.ToInt32(mo.Properties["Day6"].Value) % 60, postfix);
                    row["Day7"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["Day7"].Value) / 60, Convert.ToInt32(mo.Properties["Day7"].Value) % 60, postfix);
                    row["DayT"] = String.Format("{0}{1:D2}:{2:D2}{3}", prefix, Convert.ToInt32(mo.Properties["DayT"].Value) / 60, Convert.ToInt32(mo.Properties["DayT"].Value) % 60, postfix);
                }

                if (mo.Properties["StateFriendlyName"].Value != null)
                {
                    row["StateFriendlyName"] = CHelper.GetResFileString(mo.Properties["StateFriendlyName"].Value.ToString());
                }
                else
                {
                    row["StateFriendlyName"] = "";
                }

                dt.Rows.Add(row);
            }

            // Header Text
            for (int i = 0; i < MainGrid.Columns.Count; i++)
            {
                MetaField field     = currentPreferences.GetVisibleMetaField()[i];
                string    fieldName = field.Name;

                // First day of week can be different, so we should specify it.
                if (fieldName == "Day1" || fieldName == "Day2" || fieldName == "Day3" || fieldName == "Day4" || fieldName == "Day5" || fieldName == "Day6" || fieldName == "Day7")
                {
                    DateTime curDate = CHelper.GetRealWeekStartByDate(DateTime.UtcNow);
                    if (fieldName == "Day2")
                    {
                        curDate = curDate.AddDays(1);
                    }
                    else if (fieldName == "Day3")
                    {
                        curDate = curDate.AddDays(2);
                    }
                    else if (fieldName == "Day4")
                    {
                        curDate = curDate.AddDays(3);
                    }
                    else if (fieldName == "Day5")
                    {
                        curDate = curDate.AddDays(4);
                    }
                    else if (fieldName == "Day6")
                    {
                        curDate = curDate.AddDays(5);
                    }
                    else if (fieldName == "Day7")
                    {
                        curDate = curDate.AddDays(6);
                    }

                    MainGrid.Columns[i].HeaderText = GetGlobalResourceObject("IbnFramework.TimeTracking", curDate.DayOfWeek.ToString()).ToString();
                }
                else
                {
                    MainGrid.Columns[i].HeaderText = CHelper.GetResFileString(field.FriendlyName);
                }
            }

            MainGrid.DataSource = dt;
            MainGrid.DataBind();
        }
Esempio n. 17
0
 private IEnumerable <IMeshContributor> GetMeshContributors(MainGrid grid)
 {
     IMeshContributor[] groundContributor = grid.Points.Where(item => !item.Voxels[0].Filled).Select(item => new HorizontalMeshContributor(item)).ToArray();
     IMeshContributor[] contributors      = grid.FilledCells.Select(item => new CellMeshContributor(item)).ToArray();
     return(groundContributor.Concat(contributors));
 }
Esempio n. 18
0
        private void BindGrid()
        {
            // DataTable structure
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add(idColumn, typeof(string));
            dt.Columns.Add(principalColumn, typeof(string));
            dt.Columns.Add(isInheritedColumn, typeof(bool));
            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(mc.Name))
            {
                dt.Columns.Add(right.RightName, typeof(string));
            }
            dt.Columns.Add(editColumn, typeof(string));
            dt.Columns.Add(resetColumn, typeof(string));

            // Fill data
            DataRow dr;

            foreach (MetaObject mo in Mediachase.Ibn.Data.Services.Security.GetGlobalAcl(mc.Name))
            {
                int principalId = (PrimaryKeyId)mo.Properties["PrincipalId"].Value;

                dr                  = dt.NewRow();
                dr[idColumn]        = mo.PrimaryKeyId.Value;
                dr[principalColumn] = CHelper.GetUserName(principalId);

                bool       isInhereted = false;
                MetaObject obj         = StateMachineUtil.GetGlobalAclStateItem(mc.Name, mo.PrimaryKeyId.Value, int.Parse(StateMachineList.SelectedValue), int.Parse(StateList.SelectedValue));
                if (obj == null)
                {
                    obj         = mo;
                    isInhereted = true;
                }

                dr[isInheritedColumn] = isInhereted;

                for (int i = 1; i < MainGrid.Columns.Count - 2; i++)
                {
                    BoundField rightsField = MainGrid.Columns[i] as BoundField;
                    if (rightsField != null)
                    {
                        string fieldName = rightsField.DataField;
                        dr[fieldName] = CHelper.GetPermissionImage((int)obj.Properties[fieldName].Value, isInhereted);
                    }
                }

                string url = String.Format(CultureInfo.InvariantCulture,
                                           "javascript:ShowWizard(&quot;{7}?ClassName={0}&btn={1}&PrincipalId={2}&SmId={3}&StateId={4}&quot;, {5}, {6});",
                                           mc.Name, Page.ClientScript.GetPostBackEventReference(RefreshButton, ""),
                                           principalId, StateMachineList.SelectedValue, StateList.SelectedValue,
                                           dialogWidth, dialogHeight,
                                           ResolveClientUrl("~/Apps/Security/Pages/Admin/GlobalRoleAclStateEdit.aspx"));
                dr[editColumn] = String.Format(CultureInfo.InvariantCulture,
                                               "<a href=\"{0}\"><img src=\"{1}\" title=\"{2}\" width=\"16\" height=\"16\" border=\"0\" /></a>", url, ResolveUrl("~/Images/IbnFramework/edit.gif"), GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Edit").ToString());

                dt.Rows.Add(dr);
            }


            MainGrid.DataSource = dt;
            MainGrid.DataBind();
        }
 private async void MonthStartChanging(object sender, EventArgs e)
 {
     await MainGrid.FadeTo(0, 500, Easing.Linear);
 }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            StorageFolder sfolder = null;

            try
            {
                sfolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("Settings-Music_Player");
            }
            catch (Exception)
            {
            }
            if (sfolder == null)
            {
                sfolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Settings-Music_Player");
            }
            StorageFile settings = null;

            try
            {
                settings = await sfolder.GetFileAsync("MusicPlayerSettings.usersettings");
            }
            catch (Exception)
            {
            }
            IReadOnlyList <StorageFile> ir;

            if (settings == null)
            {
                settings = await sfolder.CreateFileAsync("MusicPlayerSettings.usersettings");
            }
            string text = string.Empty;

            try
            {
                text = await FileIO.ReadTextAsync(settings);
            }
            catch (Exception)
            {
            }
            if (text == string.Empty)
            {
                await FileIO.WriteTextAsync(settings, @"E:\songs\Music\Hindi songs\Nf");

                text = await FileIO.ReadTextAsync(settings);
            }
            else
            {
                ir = await((await StorageFolder.GetFolderFromPathAsync(text)).CreateFileQueryWithOptions(query).GetFilesAsync());
                AddToMasterPlaylist(sfolder, ir);
                int i = 0;
                StorageItemThumbnail[] st = new StorageItemThumbnail[ir.Count];
                st = await getThumbnails(ir);

                MusicProperties mp = null;
                foreach (StorageFile sf in ir)
                {
                    bi = new BitmapImage();
                    bi.SetSource(st[i]);
                    mp = await sf.Properties.GetMusicPropertiesAsync();

                    o.Add(new Music {
                        Thumbnail = bi, Duration = ((mp.Duration.Hours < 10) ? ("0" + mp.Duration.Hours.ToString()) : mp.Duration.Hours.ToString()) + ":" + ((mp.Duration.Minutes < 10) ? ("0" + mp.Duration.Minutes.ToString()) : (mp.Duration.Minutes.ToString())) + ":" + ((mp.Duration.Seconds < 10) ? ("0" + mp.Duration.Seconds.ToString()) : (mp.Duration.Seconds.ToString())), Title = mp.Title, Album = mp.Album, CurrentFile = sf
                    });

                    i++;
                }
                ObservableCollection <Music> og = new ObservableCollection <Music>();

                Music[] mus = await getByAlbum(ir.ToArray());

                foreach (Music m in mus)
                {
                    og.Add(m);
                }
                MainGrid.ItemsSource = og;
                MainGrid.UpdateLayout();
                p_ring.Visibility = Visibility.Collapsed;
            }
        }
        void BindGrid()
        {
            MetaObject[] list = this.CurrentView.List(CurrentPreferences);

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Title", typeof(string)));
            dt.Columns.Add(new DataColumn("Day1", typeof(float)));
            dt.Columns.Add(new DataColumn("Day2", typeof(float)));
            dt.Columns.Add(new DataColumn("Day3", typeof(float)));
            dt.Columns.Add(new DataColumn("Day4", typeof(float)));
            dt.Columns.Add(new DataColumn("Day5", typeof(float)));
            dt.Columns.Add(new DataColumn("Day6", typeof(float)));
            dt.Columns.Add(new DataColumn("Day7", typeof(float)));
            dt.Columns.Add(new DataColumn("DayT", typeof(float)));
            dt.Columns.Add(new DataColumn("StateFriendlyName", typeof(string)));

            foreach (MetaObject mo in list)
            {
                DataRow row             = dt.NewRow();
                string  additionalTitle = string.Empty;

                if (cbShowWeekNumber.Checked && mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() != MetaViewGroupByType.Total.ToString())
                {
                    DateTime dtNew = DateTime.MinValue;

                    try
                    {
                        dtNew = (DateTime)mo.Properties["Title"].Value;
                    }
                    catch
                    {
                    }

                    if (dtNew != DateTime.MinValue)
                    {
                        additionalTitle = string.Format("(#{0})", Iso8601WeekNumber.GetWeekNumber((DateTime)mo.Properties["Title"].Value));
                    }
                }

                if (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Primary.ToString())
                {
                    if (Convert.ToInt32(ddPrimary.SelectedValue, CultureInfo.InvariantCulture) != 0)
                    {
                        row["Title"] = String.Format("<b>{0} {1}</b>", mo.Properties["Title"].Value.ToString(), additionalTitle);
                    }
                    else
                    {
                        row["Title"] = String.Format("<b>{0} - {1} {2}</b>", ((DateTime)mo.Properties["Title"].Value).ToString("d MMM yyyy"), ((DateTime)mo.Properties["Title"].Value).AddDays(6).ToString("d MMM yyyy"), additionalTitle);
                    }
                }
                else if (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Secondary.ToString())
                {
                    if (Convert.ToInt32(ddSecondary.SelectedValue, CultureInfo.InvariantCulture) != 0)
                    {
                        row["Title"] = String.Format("<div style='padding-left: 25px;'>{0} {1}</div>", mo.Properties["Title"].Value.ToString(), additionalTitle);
                    }
                    else
                    {
                        row["Title"] = String.Format("<div style='padding-left: 25px;'>{0} - {1} {2}</div>", ((DateTime)mo.Properties["Title"].Value).ToString("d MMM yyyy"), ((DateTime)mo.Properties["Title"].Value).AddDays(6).ToString("d MMM yyyy"), additionalTitle);
                    }
                }
                else if (mo.Properties["MetaViewGroupByType"] != null && mo.Properties["MetaViewGroupByType"].OriginalValue.ToString() == MetaViewGroupByType.Total.ToString())
                {
                    row["Title"] = String.Format("<div style='padding-left: 25px;'>{0} {1}</div>", mo.Properties["Title"].Value.ToString(), additionalTitle);
                }
                else
                {
                    //TO DO: switch
                    switch (this.ThirdGroupById)
                    {
                    case 0:
                    {
                        row["Title"] = String.Format("<div style='padding-left: 45px;'>{0}-{1} {2}</div>", ((DateTime)mo.Properties["StartDate"].Value).ToString("d MMM yyyy"), ((DateTime)mo.Properties["StartDate"].Value).AddDays(6).ToString("d MMM yyyy"), additionalTitle);
                        break;
                    }

                    case 1:
                    {
                        row["Title"] = String.Format("<div style='padding-left: 45px;'>{0} {1}</div>", mo.Properties["Owner"].Value.ToString(), additionalTitle);
                        break;
                    }

                    case 2:
                    {
                        string sTitle = (mo.Properties["Project"].Value != null) ? mo.Properties["Project"].Value.ToString() : mo.Properties["Title"].Value.ToString();
                        row["Title"] = String.Format("<div style='padding-left: 45px;'>{0} {1}</div>", sTitle, additionalTitle);
                        break;
                    }
                    }
                }

                row["Day1"] = Convert.ToDouble(mo.Properties["Day1"].Value);
                row["Day2"] = Convert.ToDouble(mo.Properties["Day2"].Value);
                row["Day3"] = Convert.ToDouble(mo.Properties["Day3"].Value);
                row["Day4"] = Convert.ToDouble(mo.Properties["Day4"].Value);
                row["Day5"] = Convert.ToDouble(mo.Properties["Day5"].Value);
                row["Day6"] = Convert.ToDouble(mo.Properties["Day6"].Value);
                row["Day7"] = Convert.ToDouble(mo.Properties["Day7"].Value);
                row["DayT"] = Convert.ToDouble(mo.Properties["DayT"].Value);

                if (mo.Properties["StateFriendlyName"].Value != null)
                {
                    row["StateFriendlyName"] = CHelper.GetResFileString(mo.Properties["StateFriendlyName"].Value.ToString());
                }
                else
                {
                    row["StateFriendlyName"] = "";
                }

                dt.Rows.Add(row);
            }

            // Header Text
            for (int i = 0; i < MainGrid.Columns.Count; i++)
            {
                MetaField field     = CurrentPreferences.GetVisibleMetaField()[i];
                string    fieldName = field.Name;

                // First day of week can be different, so we should specify it.
                if (fieldName == "Day1" || fieldName == "Day2" || fieldName == "Day3" || fieldName == "Day4" || fieldName == "Day5" || fieldName == "Day6" || fieldName == "Day7")
                {
                    DateTime curDate = CHelper.GetRealWeekStartByDate(DateTime.UtcNow);
                    if (fieldName == "Day2")
                    {
                        curDate = curDate.AddDays(1);
                    }
                    else if (fieldName == "Day3")
                    {
                        curDate = curDate.AddDays(2);
                    }
                    else if (fieldName == "Day4")
                    {
                        curDate = curDate.AddDays(3);
                    }
                    else if (fieldName == "Day5")
                    {
                        curDate = curDate.AddDays(4);
                    }
                    else if (fieldName == "Day6")
                    {
                        curDate = curDate.AddDays(5);
                    }
                    else if (fieldName == "Day7")
                    {
                        curDate = curDate.AddDays(6);
                    }

                    MainGrid.Columns[i].HeaderText = GetGlobalResourceObject("IbnFramework.TimeTracking", curDate.DayOfWeek.ToString()).ToString();
                }
                else
                {
                    MainGrid.Columns[i].HeaderText = CHelper.GetResFileString(field.FriendlyName);
                }
            }

            MainGrid.DataSource = dt;
            MainGrid.DataBind();
        }
Esempio n. 22
0
        /// <summary>
        /// Internals the bind.
        /// </summary>
        private void internalBind()
        {
            MainGrid.Columns.Clear();

            McMetaViewPreference mvPref = GetMetaViewPreference();

            MainGrid.AllowPaging = true;

            if (mvPref.Attributes["PageSize"] != null)
            {
                int pageSize = Convert.ToInt32(mvPref.Attributes.GetValue("PageSize").ToString());
                if (pageSize != -1)
                {
                    MainGrid.PageSize = pageSize;
                }
                else
                {
                    MainGrid.PageSize = 10000;
                    //MainGrid.AllowPaging = false;
                }

                //CHelper.SafeSelect(ddPaging, mvPref.Attributes.Get("PageSize").ToString());
            }
            else
            {
                MainGrid.PageSize = 10;
                mvPref.Attributes.Set("PageSize", 10);
                Mediachase.Ibn.Core.UserMetaViewPreference.Save((int)DataContext.Current.CurrentUserId, mvPref);
            }

            int width = 0;

            if (this.ShowCheckboxes)
            {
                width += 22 + 7;
            }

            #region Check Additional columns from xml

            foreach (MetaGridCustomColumnInfo customColumn in this.CustomColumns)
            {
                MainGrid.Columns.Add(customColumn.Column);
                width += customColumn.Width + 7;
            }

            #endregion


            int counter = 0;
            foreach (MetaField field in this.VisibleMetaFields)
            {
                int cellWidth = 0;

                if (PlaceName == String.Empty)
                {
                    MainGrid.Columns.Add((new ListColumnFactory(this.ViewName)).GetColumn(this.Page, field));
                }
                else
                {
                    MainGrid.Columns.Add((new ListColumnFactory(this.ViewName)).GetColumn(this.Page, field, PlaceName));
                }


                cellWidth = mvPref.GetMetaFieldWidth(counter, 100);
                if (cellWidth == 0)
                {
                    cellWidth = 100;
                }
                width += cellWidth;

                counter++;
            }

            width += this.VisibleMetaFields.Length * 7;


            MainGrid.Width = width;

            #region Adding PrimaryKeyColumn
            MainGrid.Columns.Add((new ListColumnFactory(this.ViewName)).GetCssColumn(this.Page, CurrentView.MetaClass.Name));
            #endregion

            internalBindHeader();

            FilterElement fe = null;

            if (this.SearchKeyword != string.Empty)
            {
                fe = ListManager.CreateFilterByKeyword(mvPref.MetaView.MetaClass, this.SearchKeyword);
                mvPref.Filters.Add(fe);
            }

            MetaObject[] list = CurrentView.List(mvPref);

            if (fe != null)
            {
                mvPref.Filters.Remove(fe);
            }

            if (CurrentView.PrimaryGroupBy == null && CurrentView.SecondaryGroupBy == null)
            {
                MainGridExt.IsEmpty = (list.Length == 0);

                if (list.Length == 0)
                {
                    list = new MetaObject[] { new MetaObject(CurrentView.MetaClass) };
                }

                MainGrid.DataSource = list;
            }
            else
            {
                if (CurrentView.SecondaryGroupBy != null)
                {
                    list = MetaViewGroupUtil.ExcludeCollapsed(MetaViewGroupByType.Secondary, CurrentView.SecondaryGroupBy, CurrentView.PrimaryGroupBy, mvPref, list);
                }

                list = MetaViewGroupUtil.ExcludeCollapsed(MetaViewGroupByType.Primary, CurrentView.PrimaryGroupBy, null, mvPref, list);

                MainGridExt.IsEmpty = (list.Length == 0);

                if (list.Length == 0)
                {
                    list = new MetaObject[] { new MetaObject(CurrentView.MetaClass) };
                }

                MainGrid.DataSource = list;
            }

            this.Count = list.Length;
            if (MainGridExt.IsEmpty)
            {
                this.Count = 0;
            }
            MainGrid.DataBind();

            internalBindPaging();

            if (list.Length == 0)
            {
                MainGrid.CssClass = "serverGridBodyEmpty";
            }
        }
        //This function is basically used to do the animation as we are panning
        void Image_Panning(object sender, MR.Gestures.PanEventArgs e)
        {
            initXCord  = TicTacToeViewModel.initXCord;
            initYCord  = TicTacToeViewModel.inityCord;
            finalXCord = TicTacToeViewModel.finalXCord;
            finalYCord = TicTacToeViewModel.finalYCord;

            if (initXCord == -1 || initYCord == -1)
            {
                return;
            }

            int initialPoint = Int32.Parse(initYCord.ToString() + initXCord.ToString());

            //Here we are initializing the variable s to the image that we are controlling/panning
            var label = e.Sender as MR.Gestures.Label;

            if (label == null)
            {
                return;
            }

            MainGrid.RaiseChild(label);

            //These two lines is what does the animations. TotalDistance is what made the animation smooth. += Is what assigns a handler to an event
            label.TranslationX += e.TotalDistance.X;
            label.TranslationY += e.TotalDistance.Y;

            //This sets up once we try to trade images to bring it back to its original spot, due to it going past the grid length which kept causing bugs.
            if (e.ViewPosition.Y > MainGrid.Height)
            {
                TicTacToeViewModel.finalXCord = TicTacToeViewModel.initXCord;
                TicTacToeViewModel.finalYCord = TicTacToeViewModel.inityCord;
                return;
            }

            if (finalXCord < 0 || finalYCord < 0)
            {
                return;
            }

            int finalPoint = Int32.Parse(finalYCord.ToString() + finalXCord.ToString());

            //We are rotating the rest of the blocks as we are panning a block.
            if (initialPoint > finalPoint && prevFinalPoint != finalPoint)
            {
                shiftRightAnimation(initialPoint, finalPoint, label);
            }
            else if (initialPoint < finalPoint && prevFinalPoint != finalPoint)
            {
                shiftLeftAnimation(initialPoint, finalPoint, label);
            }

            prevFinalPoint = finalPoint;

            //This is used to update the initial point so it stops blocks from shifting that don't need to be shifted, therefore causeing overlap, page 246 of BuJo
            string initialUpdatedStringPoint = prevFinalPoint.ToString();;

            if (initialUpdatedStringPoint.Length == 1)
            {
                initialUpdatedStringPoint = "0" + initialUpdatedStringPoint;
            }

            TicTacToeViewModel.inityCord = Int32.Parse(initialUpdatedStringPoint[0].ToString());
            TicTacToeViewModel.initXCord = Int32.Parse(initialUpdatedStringPoint[1].ToString());
        }
 public void Initialize()
 {
     InitializeComponent();
     this.AddWidthCondition(1200).Add(x =>
                                      MainGrid.FindVisualChild <SpacingUniformGrid>()?.SetValue(SpacingUniformGrid.ColumnsProperty, x ? 2 : 1));
 }
Esempio n. 25
0
 // Use this for initialization
 void Start()
 {
     grid = FindObjectOfType <MainGrid>();
     InvokeRepeating("GoingToAttack", 15, 10);
     Invoke("PlaceUnit", Random.Range(1, 4));
 }
Esempio n. 26
0
 private void SearchNowTapped(object sender, EventArgs e)
 {
     MainGrid.RaiseChild(TopContainerStack);
     MainGrid.RaiseChild(CIUserIco);
 }
Esempio n. 27
0
        private void BindGrid()
        {
            // DataTable structure
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add(idColumn, typeof(string));
            dt.Columns.Add(roleColumn, typeof(string));
            dt.Columns.Add(isInheritedColumn, typeof(bool));

            CustomTableRow[] classRights = CustomTableRow.List(SqlContext.Current.Database.Tables[Mediachase.Ibn.Data.Services.Security.BaseRightsTableName],
                                                               FilterElement.EqualElement("ClassOnly", 1));

            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(mc.Name))
            {
                // Check for Class Right (ex. Create)
                bool   isClassRight = false;
                string rightUid     = right.BaseRightUid.ToString();
                foreach (CustomTableRow r in classRights)
                {
                    if (r["BaseRightUid"].ToString() == rightUid)
                    {
                        isClassRight = true;
                        break;
                    }
                }
                if (isClassRight)
                {
                    continue;
                }

                dt.Columns.Add(right.RightName, typeof(string));
            }
            dt.Columns.Add(editColumn, typeof(string));
            dt.Columns.Add(resetColumn, typeof(string));

            // Fill data
            DataRow dr;

            foreach (MetaObject mo in Mediachase.Ibn.Data.Services.RoleManager.GetObjectRoleItems(mc.Name))
            {
                string roleName = mo.Properties["RoleName"].Value.ToString();

                dr             = dt.NewRow();
                dr[idColumn]   = mo.PrimaryKeyId;
                dr[roleColumn] = CHelper.GetResFileString(mo.Properties["FriendlyName"].Value.ToString());
                if (mo.Properties["ClassName"].Value != null)
                {
                    string className = (string)mo.Properties["ClassName"].Value;
                    if (className.Contains("::"))
                    {
                        string[] s = new string[] { "::" };
                        className = className.Split(s, StringSplitOptions.None)[0];
                    }
                    dr[roleColumn] += String.Format(CultureInfo.InvariantCulture,
                                                    " ({0})",
                                                    CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(className).PluralName));
                }

                bool       isInhereted = false;
                MetaObject obj         = StateMachineUtil.GetObjectRoleStateItem(mc.Name, mo.PrimaryKeyId.Value, int.Parse(StateMachineList.SelectedValue, CultureInfo.InvariantCulture), int.Parse(StateList.SelectedValue, CultureInfo.InvariantCulture));
                if (obj == null)
                {
                    obj         = mo;
                    isInhereted = true;
                }

                for (int i = 1; i < MainGrid.Columns.Count - 2; i++)
                {
                    BoundField rightsField = MainGrid.Columns[i] as BoundField;
                    if (rightsField != null)
                    {
                        string fieldName = rightsField.DataField;
                        dr[fieldName] = CHelper.GetPermissionImage((int)obj.Properties[fieldName].Value, isInhereted);
                    }
                }

                dr[isInheritedColumn] = isInhereted;

                string url = String.Format(CultureInfo.InvariantCulture,
                                           "javascript:ShowWizard(&quot;{7}?ClassName={0}&btn={1}&Role={2}&SmId={3}&StateId={4}&quot;, {5}, {6});",
                                           mc.Name,
                                           Page.ClientScript.GetPostBackEventReference(RefreshButton, ""),
                                           roleName,
                                           StateMachineList.SelectedValue,
                                           StateList.SelectedValue,
                                           dialogWidth, editDialogHeight,
                                           ResolveClientUrl("~/Apps/Security/Pages/Admin/ObjectRoleStateEdit.aspx"));
                dr[editColumn] = String.Format(CultureInfo.InvariantCulture,
                                               "<a href=\"{0}\"><img src=\"{1}\" title=\"{2}\" width=\"16\" height=\"16\" border=\"0\" /></a>",
                                               url,
                                               ResolveUrl("~/Images/IbnFramework/edit.gif"),
                                               GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Edit").ToString());

                dt.Rows.Add(dr);
            }

            MainGrid.DataSource = dt;
            MainGrid.DataBind();
        }
Esempio n. 28
0
 private void OnSideMenuShow(object sender, EventArgs e)
 {
     MainGrid.RaiseChild(SMSideMenu);
     System.Diagnostics.Debug.WriteLine("Side menu showing...");
 }
Esempio n. 29
0
 public void RemoveFocus(object sender, EventArgs e)
 {
     MainGrid.Focus();
 }
Esempio n. 30
0
 private void ExportExcel_Click(object sender, RoutedEventArgs e)
 {
     MainGrid.ExportExcel("GlExpensis");
     _viewModel.AllowExport = false;
 }