コード例 #1
0
 public void OpenWebSite()
 {
     try
     {
         Process.Start("https://github.com/icehunter/ffxivapp-plugin-log");
     }
     catch (Exception ex)
     {
         var popupContent = new PopupContent();
         popupContent.Title   = PluginViewModel.Instance.Locale["app_WarningMessage"];
         popupContent.Message = ex.Message;
         Plugin.PHost.PopupMessage(Plugin.PName, popupContent);
     }
 }
コード例 #2
0
 public void OpenGithub()
 {
     try
     {
         Process.Start("https://github.com/Bio2hazard/talis.xivplugin.twintania");
     }
     catch (Exception ex)
     {
         var popupContent = new PopupContent
         {
             Title   = PluginViewModel.Instance.Locale["app_WarningMessage"],
             Message = ex.Message
         };
         Plugin.PHost.PopupMessage(Plugin.PName, popupContent);
     }
 }
コード例 #3
0
 public void OpenGuildWebSite()
 {
     try
     {
         Process.Start("http://trickplay.chapterfain.com/");
     }
     catch (Exception ex)
     {
         var popupContent = new PopupContent
         {
             Title   = PluginViewModel.Instance.Locale["app_WarningMessage"],
             Message = ex.Message
         };
         Plugin.PHost.PopupMessage(Plugin.PName, popupContent);
     }
 }
コード例 #4
0
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name		OnFilterTapped
 /// <summary>
 /// It is used to display the Filter Pop-up
 /// </summary>
 /// ------------------------------------------------------------------------------------------------
 ///
 private async void OnFilterTapped()
 {
     try
     {
         if (AppData.SyncInProgress)
         {
             await DisplayAlert("Sync In Progress", "Please wait for the sync to finish before taking further actions.", "OK", null);
         }
         else
         {
             Task.Delay(800);
             PopupContent.ShowPopupRelative(FilterContent = new FilterView(PopupContent), _imgFilter, Device.OnPlatform <double>(280, 320, 300), 260 + (AppData.PropertyModel.FilterTypes.Take(3).ToList().Count * 40), true, "");
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
コード例 #5
0
ファイル: PluginHost.cs プロジェクト: Arzzz/ffxivapp
        /// <summary>
        /// </summary>
        /// <param name="pluginName"></param>
        /// <param name="popupContent"></param>
        public void PopupMessage(string pluginName, PopupContent popupContent)
        {
            if (popupContent == null)
            {
                return;
            }
            var pluginInstance = App.Plugins.Loaded.Find(popupContent.PluginName);

            if (pluginInstance == null)
            {
                return;
            }
            var    title        = String.Format("[{0}] {1}", pluginName, popupContent.Title);
            var    message      = popupContent.Message;
            Action cancelAction = null;

            if (popupContent.CanCancel)
            {
                cancelAction = delegate { pluginInstance.Instance.PopupResult = MessageBoxResult.Cancel; };
            }
            MessageBoxHelper.ShowMessageAsync(title, message, delegate { pluginInstance.Instance.PopupResult = MessageBoxResult.OK; }, cancelAction);
        }
コード例 #6
0
        private void ProcessSample()
        {
            var openFileDialog = new OpenFileDialog {
                InitialDirectory = Path.Combine(Common.Constants.LogsPath, "Parser"),
                Multiselect      = false,
                Filter           = "JSON Files (*.json)|*.json",
            };

            openFileDialog.FileOk += delegate {
                try {
                    var parse = File.ReadAllText(openFileDialog.FileName, Encoding.UTF8);
                    JsonHelper.ToParseControl.ConvertJson(openFileDialog.FileName, parse);
                }
                catch (Exception ex) {
                    var popupContent = new PopupContent {
                        Title   = PluginViewModel.Instance.Locale["app_WarningMessage"],
                        Message = ex.Message,
                    };
                    Plugin.PHost.PopupMessage(Plugin.PName, popupContent);
                }
            };
            openFileDialog.ShowDialog();
        }
コード例 #7
0
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name        AddActionClick
        /// ------------------------------------------------------------------------------------------------
        ///
        /// <summary> Handles a click on add action
        /// </summary>
        /// ------------------------------------------------------------------------------------------------
        ///
        private void AddActionClick(object sender, EventArgs e)
        {
            SRiVisitMeta visit = AppData.PropertyModel.SelectedVisit.Visit;

            if (!AppData.ConfigModel.Actions(visit.Organisation, visit.Visit.VisitType).Any())
            {
                DisplayAlert("Cannot add Action", "No action types set up in Uniform for this visit type. Please contact your Uniform administrator for assistance.", "Ok");
            }
            else
            {
                PopupContent.ShowPopupRelative(new AddActionView(this, PopupContent), Lbl_AddActions, Width * 0.40, GetHeight(GroupedListViewModel.Count), true, "");
                PopupContent._triangleImage.Source = "";

                AppData.PropertyModel.SelectedAction = new SelectedAction(new SRiAction()
                {
                    DueDate     = DateTime.Now,
                    VisitKeyVal = visit.Visit.KeyVal,
                    MDKeyVal    = visit.Visit.MDKeyVal,
                    MDSubSys    = visit.Visit.MDSubSys,
                    Paragraphs  = new List <SRiActionParagraph>()
                }, AppData.PropertyModel.SelectedVisit.NewActionMapping, true);
            }
        }
コード例 #8
0
 /// <summary>
 /// The method called periodically by the framework to determine if the command should be enabled.
 /// </summary>
 bool CanExecutePopupCommand(PopupContent content)
 {
   return content != null;
 }
コード例 #9
0
    /// <summary>
    /// The method called when the custom popup command is clicked.
    /// </summary>
    void OnPopupCommand(PopupContent content)
    {
      //Cast the content parameter to our custom popup content class.
      DynamicPopupContent dynamicContent = content as DynamicPopupContent;
      if (dynamicContent == null)
        return;

      //Call a method on the custom popup content object to show some statistics for the current popup content.
      dynamicContent.ShowStatistics();
    }
コード例 #10
0
        protected override async Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            await QueuedTask.Run(() =>
            {
                var mapPoint = MapPointBuilder.CreateMapPoint(e.ClientPoint.X, e.ClientPoint.Y);
                var result   = ActiveMapView.GetFeatures(mapPoint);
                List <PopupContent> popups = new List <PopupContent>();
                foreach (var kvp in result)
                {
                    var layer = kvp.Key as BasicFeatureLayer;
                    if (layer == null)
                    {
                        continue;
                    }
                    var fields   = layer.GetFieldDescriptions().Where(f => f.Name == "DI_JI_HAO");
                    var tableDef = layer.GetTable().GetDefinition();
                    var oidField = tableDef.GetObjectIDField();
                    foreach (var id in kvp.Value)
                    {
                        //获取地级编号
                        //DI_JI_HAO
                        var qf = new QueryFilter()
                        {
                            WhereClause = $"{oidField} = {id}", SubFields = string.Join(",", fields.Select(f => f.Name))
                        };
                        var rows = layer.Search(qf);
                        if (!rows.MoveNext())
                        {
                            continue;
                        }
                        using (var row = rows.Current)
                        {
                            foreach (var field in fields)
                            {
                                var val = row[field.Name];
                                if (field.Name == "DI_JI_HAO")
                                {
                                    PopupContent pc = new PopupContent(new Uri("http://59.42.105.34:5001/client/?id=" + val), "林业");
                                    popups.Add(pc);
                                }
                            }
                        }
                    }
                }

                //Flash the features that intersected the sketch geometry.
                MessageBox.Show(popups.ToString());
                ActiveMapView.FlashFeature(result);
                var height             = System.Windows.SystemParameters.WorkArea.Height / 2;
                var width              = System.Windows.SystemParameters.WorkArea.Width / 2;
                var topLeftCornerPoint = new System.Windows.Point(0, 0);
                var popupDef           = new PopupDefinition()
                {
                    Append   = true,                                  // if true new record is appended to existing (if any)
                    Dockable = true,                                  // if true popup is dockable - if false Append is not applicable
                    Position = topLeftCornerPoint,                    // Position of top left corner of the popup (in pixels)
                    Size     = new System.Windows.Size(width, height) // size of the popup (in pixels)
                };

                //Show the custom pop-up with the custom commands and the default pop-up commands.
                try
                {
                    ActiveMapView.ShowCustomPopup(popups, null, true, popupDef);
                } catch (System.Exception e1)
                {
                    MessageBox.Show(string.Format("{0}", e1));
                }

                //return the collection of pop-up content object.
            });
        }
コード例 #11
0
        /// <summary>
        /// Called when a sketch is completed.
        /// </summary>
        protected override async Task <bool> OnSketchCompleteAsync(ArcGIS.Core.Geometry.Geometry geometry)
        {
            List <PopupContent> popupContent = await QueuedTask.Run(() =>
            {
                //Get the features that intersect the sketch geometry.
                var mapPoint = geometry as MapPoint;
                var sb       = new StringBuilder();

                sb.AppendLine(string.Format("OnSketchCompleteAsync X: {0}", mapPoint.X));
                sb.Append(string.Format("Y: {0}", mapPoint.Y));
                if (mapPoint.HasZ)
                {
                    sb.AppendLine();
                    sb.Append(string.Format("Z: {0}", mapPoint.Z));
                }
                MessageBox.Show(sb.ToString());

                var result = ActiveMapView.GetFeatures(geometry);

                //For each feature in the result create a new instance of our custom pop-up content class.
                List <PopupContent> popups = new List <PopupContent>();
                foreach (var kvp in result)
                {
                    //kvp.Value.ForEach(id => popups.Add(new DynamicPopupContent(kvp.Key, id)));
                    //kvp.Value.ForEach(id => popups.Add(new PopupContent(new Uri("https://www.google.com/webhp?ie=UTF-8&rct=j"), "xxxx")));
                    //popups.Add(new PopupContent("<b>This text is bold.</b>", "Custom tooltip from HTML string"));

                    var layer = kvp.Key as BasicFeatureLayer;
                    if (layer == null)
                    {
                        continue;
                    }
                    var fields   = layer.GetFieldDescriptions().Where(f => f.Name == "DI_JI_HAO");
                    var tableDef = layer.GetTable().GetDefinition();
                    var oidField = tableDef.GetObjectIDField();
                    foreach (var id in kvp.Value)
                    {
                        //获取地级编号
                        //DI_JI_HAO
                        var qf = new QueryFilter()
                        {
                            WhereClause = $"{oidField} = {id}", SubFields = string.Join(",", fields.Select(f => f.Name))
                        };
                        var rows = layer.Search(qf);
                        if (!rows.MoveNext())
                        {
                            continue;
                        }
                        using (var row = rows.Current)
                        {
                            foreach (var field in fields)
                            {
                                var val = row[field.Name];
                                if (field.Name == "DI_JI_HAO")
                                {
                                    PopupContent pc = new PopupContent(new Uri("http://59.42.105.34:5001/client/?id=" + val), "林业");
                                    popups.Add(pc);
                                }
                            }
                        }
                    }
                }

                //Flash the features that intersected the sketch geometry.
                ActiveMapView.FlashFeature(result);

                //return the collection of pop-up content object.
                return(popups);
            });

            var height             = System.Windows.SystemParameters.WorkArea.Height / 2;
            var width              = System.Windows.SystemParameters.WorkArea.Width / 2;
            var topLeftCornerPoint = new System.Windows.Point(0, 0);
            var popupDef           = new PopupDefinition()
            {
                Append   = true,                                  // if true new record is appended to existing (if any)
                Dockable = true,                                  // if true popup is dockable - if false Append is not applicable
                Position = topLeftCornerPoint,                    // Position of top left corner of the popup (in pixels)
                Size     = new System.Windows.Size(width, height) // size of the popup (in pixels)
            };

            //Show the custom pop-up with the custom commands and the default pop-up commands.
            ActiveMapView.ShowCustomPopup(popupContent, null, true, popupDef);
            return(true);
        }
コード例 #12
0
        /// <summary>
        /// </summary>
        private static void AddOrUpdateEvent()
        {
            var selectedId = Guid.Empty;

            try
            {
                if (MainView.View.Events.SelectedItems.Count == 1)
                {
                    selectedId = new Guid(GetValueBySelectedItem(MainView.View.Events, "Key"));
                }
            }
            catch (Exception ex)
            {
                Logging.Log(LogManager.GetCurrentClassLogger(), "", ex);
            }
            if (string.IsNullOrWhiteSpace(MainView.View.TDelay.Text) || string.IsNullOrWhiteSpace(MainView.View.TRegEx.Text))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(MainView.View.TCategory.Text))
            {
                MainView.View.TCategory.Text = PluginViewModel.Instance.Locale["event_MiscellaneousLabel"];
            }
            if (Regex.IsMatch(MainView.View.TDelay.Text, @"[^0-9]+"))
            {
                var popupContent = new PopupContent
                {
                    PluginName = Plugin.PName,
                    Title      = PluginViewModel.Instance.Locale["app_WarningMessage"],
                    Message    = "Delay can only be numeric."
                };
                Plugin.PHost.PopupMessage(Plugin.PName, popupContent);
                return;
            }
            var logEvent = new LogEvent
            {
                Sound      = MainView.View.TSound.Text,
                TTS        = (MainView.View.TTTS.Text ?? "").Trim(),
                Rate       = (int)MainView.View.TRate.Value,
                RegEx      = MainView.View.TRegEx.Text,
                Category   = MainView.View.TCategory.Text,
                Executable = MainView.View.TExecutable.Text,
                Arguments  = MainView.View.TArguments.Text,
                Volume     = MainView.View.TVolume.Value * 100
            };
            int result;

            if (Int32.TryParse(MainView.View.TDelay.Text, out result))
            {
                logEvent.Delay = result;
            }
            if (selectedId == Guid.Empty)
            {
                logEvent.Key = Guid.NewGuid();
                PluginViewModel.Instance.Events.Add(logEvent);
            }
            else
            {
                logEvent.Key = selectedId;
                var index = PluginViewModel.Instance.Events.TakeWhile(@event => @event.Key != selectedId)
                            .Count();
                PluginViewModel.Instance.Events[index] = logEvent;
            }
            MainView.View.Events.UnselectAll();
            MainView.View.TRegEx.Text      = "";
            MainView.View.TTTS.Text        = "";
            MainView.View.TExecutable.Text = "";
            MainView.View.TArguments.Text  = "";
        }
コード例 #13
0
 /// <summary>
 /// The method called periodically by the framework to determine if the command should be enabled.
 /// </summary>
 bool CanExecutePopupCommand(PopupContent content)
 {
     return(content != null);
 }
コード例 #14
0
        /// <summary>
        /// </summary>
        private static void AddEvent()
        {
            var selectedKey = "";

            try
            {
                if (MainView.View.Events.SelectedItems.Count == 1)
                {
                    selectedKey = GetValueBySelectedItem(MainView.View.Events, "RegEx");
                }
            }
            catch (Exception ex)
            {
                Logging.Log(LogManager.GetCurrentClassLogger(), "", ex);
            }
            if (MainView.View.TSound.Text.Trim() == "" || MainView.View.TDelay.Text.Trim() == "" || MainView.View.TRegEx.Text.Trim() == "")
            {
                return;
            }
            if (MainView.View.TCategory.Text.Trim() == "")
            {
                MainView.View.TCategory.Text = "Miscellaneous";
            }
            if (Regex.IsMatch(MainView.View.TDelay.Text, @"[^0-9]+"))
            {
                var popupContent = new PopupContent();
                popupContent.PluginName = Plugin.PName;
                popupContent.Title      = PluginViewModel.Instance.Locale["app_WarningMessage"];
                popupContent.Message    = "Delay can only be numeric.";
                Plugin.PHost.PopupMessage(Plugin.PName, popupContent);
                return;
            }
            var soundEvent = new SoundEvent
            {
                Sound    = MainView.View.TSound.Text,
                Delay    = 0,
                RegEx    = MainView.View.TRegEx.Text,
                Category = MainView.View.TCategory.Text,
                Enabled  = true
            };
            int result;

            if (Int32.TryParse(MainView.View.TDelay.Text, out result))
            {
                soundEvent.Delay = result;
            }
            if (String.IsNullOrWhiteSpace(selectedKey))
            {
                var found = PluginViewModel.Instance.Events.Any(se => se.RegEx == soundEvent.RegEx);
                if (!found)
                {
                    PluginViewModel.Instance.Events.Add(soundEvent);
                }
            }
            else
            {
                var index = PluginViewModel.Instance.Events.TakeWhile(se => se.RegEx != selectedKey)
                            .Count();
                PluginViewModel.Instance.Events[index] = soundEvent;
            }
            MainView.View.Events.UnselectAll();
            MainView.View.TRegEx.Text = "";
        }